OK! I found the problem! There is maybe a bug when you are using LoadXMLData(). The first line of the XMl file <?xml version='1.0' encoding = 'UTF-8' ?> - not the space before and after the "=" in the "encode" element?? yip thats right, the spaces thew the error! take them out, and hey presto it works! Yet loading from file it doesn't care! To me that's a bug, but there could also be some explanation. BTW, this made no diff. using Android or Win32
Jeremy On Thu, Dec 5, 2013 at 1:12 PM, Jeremy Coulter <[email protected]> wrote: > Ok, so what I did was put the source code onto my dev backup VM on my > laptop and connected to the AP then sent the commands to the server to get > the XML returned. > If I use "LoadXMLData()" it still fails but tells me its expecting a"?" or > "white space" on "line:1" which has the <?XML....blah blah?> on it. I have > a sneaky suspicion I might know what it is, and will be looking tonight and > will report back > > Jeremy > > > On Wed, Dec 4, 2013 at 11:37 AM, Jeremy Coulter <[email protected]>wrote: > >> hmm...well that could be. I am just perplexed why its fine when the data >> in the string (or DOMString) variable is written then read from a file, and >> what is different there as apposed to reading it from a string directly. >> Bloody annoying! >> >> Jeremy >> >> >> On Wed, Dec 4, 2013 at 11:16 AM, Jolyon Smith <[email protected]>wrote: >> >>> 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 <[email protected]> >>> 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: [email protected] >>> Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> Unsubscribe: send an email to [email protected] with >>> Subject: unsubscribe >>> Jolyon Smith <[email protected]> >>> 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 <[email protected]> >>> 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: [email protected] >>> Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> Unsubscribe: send an email to [email protected] with >>> Subject: unsubscribe >>> Jeremy Coulter <[email protected]> >>> 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: [email protected] >>> Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> Unsubscribe: send an email to [email protected] with >>> Subject: unsubscribe >>> >>> >>> _______________________________________________ >>> NZ Borland Developers Group - Delphi mailing list >>> Post: [email protected] >>> Admin: http://delphi.org.nz/mailman/listinfo/delphi >>> Unsubscribe: send an email to [email protected] with >>> Subject: unsubscribe >>> >> >> >
<<compose-unknown-contact.jpg>>
<<postbox-contact.jpg>>
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
