Another possibility – less likely but an outside one – is that there might be 
something about end of line terminators – ie windows uses CR LF, and linux/Unix 
uses LF.  I only raise it because if you save to a file and load it seems OK, 
so there might be something getting the wrong line terminator (not your fault 
even).

(MacOS by contrast uses CR as a line terminator just to be convenient).

Programs like ftp convert text files automatically in transmission, other 
communication protocols might not.

Got bitten by it frequently when looking after cross platform software - moving 
text data and source to and from Unix from Windows files often need to be 
converted by utilities (I have one using sed).   (Source would not compile 
until converted)

John Bird

From: Jolyon Smith 
Sent: Tuesday, December 03, 2013 10:50 AM
To: NZ Borland Developers Group - Delphi List 
Subject: Re: [DUG] Strange Error in Android


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
  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
  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>>

_______________________________________________
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

Reply via email to