[DUG] Strange Error in Android

Jolyon Smith jsmith at deltics.co.nz
Wed Dec 4 11:16:48 NZDT 2013


CR, LF CR+LF - all are whitespace in XML unless in a CDATA but since the 
error is occurring before the parser has even dealt with the <?xml> 
declaration CDATA sections are not likely to be in play here.   If the 
Embarcadero parser on Android is broken by variations in whitespace I 
would think twice about trusting it with anything really complicated.  
You know, like actual XML.  ;)

> Jeremy Coulter <mailto:jscoulter at gmail.com>
> Wed, 4 Dec 2013 10:27
> Thanks for the replies. I was away yesterday, but I THINK John might 
> be on the right track. I will be checking it out and will report back.
>
> Jeremy
>
>
>
> _______________________________________________
> 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
> Jolyon Smith <mailto:jsmith at deltics.co.nz>
> Tue, 3 Dec 2013 10:50
>
> Could you post the first line of the XML so we can see what it 
> comprises of ?  i.e. what XML declaration does the string contain 
> which the parser is rejecting ?
>
> As a result of the DOM Vendor implementation model in Delphi, 
> behaviour on Windows is no indication of reliability on Android, iOS 
> or OS X (as you are finding).
>
> For Android it seems that the key to your problem is in 
> XML.Internal.AdomCore_4_3.pas, specifically the 
> EvaluateXmlOrTextDecl() method of TXmlInputSource but without knowing 
> what declaration is being presented to this method it's impossible to 
> say whether the problem lies here, in the process of assigning the 
> string from the HTTP response to the XML document or with the content 
> of the XML string itself.
>
> There is potential for many slips twixt this particular cup and lip.
>
> Robert Martin <mailto:rob at chreos.co.nz>
> Tue, 3 Dec 2013 09:03
> Hi Jeremy
>
> Never done any Delphi Android work but is it possible it is a 
> character set issue?  I am only using XE2 nut if I look at 
> XMLDoc.LoadFromXML() (I don't have a LoadXMLData) it takes an 
> AnsiString on at UTF16 delphi string.
>
> Thanks
> Rob
>
>
>  On 2/12/2013 11:40 p.m., Jeremy Coulter wrote:
>
> _______________________________________________
> 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
> Jeremy Coulter <mailto:jscoulter at gmail.com>
> Mon, 2 Dec 2013 23:40
>
> Hi All.
>
> I am Sending an HTTP request to a server that is returning some XML in 
> an Android app.
>
> However, I get an unexpected result. I am using Indy and the 
> idHTTP.get() function which returns either a string or populates a stream.
>
> I started out first by loading the results into a string variable, 
> i.e.  buffer:=isHTTP.get()  which returns the data fine, BUT if I call 
> LoadXMLData(buffer)  - (LoadXmlData() is in Xml.XMLDoc.pas) which is a 
> function I have used a number of time in Delphi in normal Windows apps 
> and never had a problem – that wasn’t something I did J
>
> However, if in the android app, I load the buffer variable into a 
> string list then save that to file the  call LoadXMLDocument() that 
> takes a file name, it works fine !!
>
> Oh, the error I get is   “ET_INVALID_XML_DECL line:-1” which indicates 
> the XML is invalid but if I do a showmessage(buffer) its perfectly fine.
>
> I have tried loading the result into a stream and the reading it out 
> into a string and I get the same error. I have tried removing the 
> #13#10’s and STILL I get the error. If I write the XML to file first, 
> no problem.
>
> I have tried using String and DOMStrings, but still the same error
>
> Anyone got any ideas? I shouldn’t have to write the xml to file then 
> load it, that’s a bit of a pain.
>
> Thanks, Jeremy
>
> _______________________________________________
> 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/20131204/07a6376f/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1302 bytes
Desc: not available
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20131204/07a6376f/attachment.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
Url : http://listserver.123.net.nz/pipermail/delphi/attachments/20131204/07a6376f/attachment-0001.jpg 


More information about the Delphi mailing list