[DUG] Can anyone explain this one?

Jeremy Coulter jscoulter at gmail.com
Sun Oct 7 09:33:23 NZDT 2012


Well…..as it turned out, this was an INCREADIBLY simple fix !

 

I forgot to set the Request.ContentType  to being text/xml  J

I spotted it when I was Googling something else and knew straight away what I hadn’t done……hangs head in shame ;-)

 

From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Jolyon Smith
Sent: Friday, 5 October 2012 09:47
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Can anyone explain this one?

 

OK, then I suppose another possibility is that whatever is getting the text representation of your xml document to include in your request content is doing it by grabbing the root node of the document "as text/string" rather than the complete xml document.  In pseudo code:


  httpRequest.Content.AsString := xmldoc.RootNode.AsString;

vs

  httpRequest.Content.AsString := xmldoc.AsString;

i.e. It may not be your HTTP code or whatever components you are using per se (it is highly unlikely that the HTTP component is deliberately and selectively checking for xml content and then doing a surgical strike to cleanly remove the prolog from that xml), but rather the code that assembles the request to send via that HTTP component is not getting the xml in quite the correct fashion, despite the actual source xml "dom" itself being correct and complete.

I hope that makes sense.  :)

 

 

On 5 October 2012 09:39, Jeremy Coulter <jscoulter at gmail.com> wrote:

Yip, its definitly there. I build the XML up, and I am checking it before it leaves so I know that at the point of calling the "Post" its definitly there.

the one thing I havent done is run up wireshark.....this will tell me if its leaving my machine in tact I guess.

 

Jeremy

On Fri, Oct 5, 2012 at 8:41 AM, Jolyon Smith <jsmith at deltics.co.nz> wrote:

If adding an "extra" prolog fixes it then I would ask if the prolog is really there in the original xml to start with ?

Some XML viewers will add a default prolog when viewing xml that doesn't contain any prolog.  When viewing this xml in IE for example:

 

<root>

  <child />

</root>

 

What IE actually shows is:

 

<?xml version="1.0"?>

-<root>

    <child/>

 </root>

 

I am sure I have seen similar behaviour in other xml viewers.  I find this an increasingly prevalent problem, with computer software trying to be too "helpful"; especially irksome in data viewers that introduce artefacts in the data being viewed that aren't actually present.

 

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe

 


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20121007/4243d2c7/attachment.html 


More information about the Delphi mailing list