Android Question XML Parsing problem

mauro vicamini

Active Member
Licensed User
Longtime User
Hello Everyone,
I've got a problem parsing this XML:
B4X:
<?xml version='1.0' encoding='iso-8859-1'?><INTERVENTI><INTERVENTO><CODICE>901742732</CODICE><DESCRIZIONE>MONITORAGGIO RODITORI ESCA</DESCRIZIONE><INDIRIZZO><![CDATA[MONDADORI SPA - AREA ESTERNA MENSA+FOGLIA - VIA MONDADORI, 1 - Segrate]]></INDIRIZZO><ORA></ORA><TIPO>A</TIPO><TIPO_GESTIONE>A</TIPO_GESTIONE><CLIENTE><![CDATA[ARNOLDO MONDADORI EDITORE SPA]]></CLIENTE><DESTINAZIONE>2_4236_N</DESTINAZIONE><TRATTAMENTO>174</TRATTAMENTO><MAPPE>http://localhost:8080/biosanisystem/servlet/it.biosanisystem.prg.BioSanisystemRemoteManagerServlet?action=immagine&amp;fn=web\Clienti\2823 (MONDADORI SPA)\PLANIMETRIE\2_4236_N\mondadori area esterna mensa-foglia e sottofoglia esporta.jpg </MAPPE><SOGLIA1>0</SOGLIA1><SOGLIA2>25</SOGLIA2><SOGLIA3>50</SOGLIA3><CONSUMI><PRODOTTO><CODICEPRODOTTO>1</CODICEPRODOTTO><QTA>0</QTA> <UM>pz</UM> </PRODOTTO><PRODOTTO><CODICEPRODOTTO>60</CODICEPRODOTTO><QTA>0</QTA> <UM>pz</UM> </PRODOTTO></CONSUMI><TEMPOINT>60.0</TEMPOINT><TEMPOSPOST></TEMPOSPOST> <TIPOCONTRATTO>N</TIPOCONTRATTO><AREAINT>Zone ed aree interessate</AREAINT><AVVISARE><![CDATA[ ]]></AVVISARE><NOTE><![CDATA[ ]]></NOTE><DDT><NUMERO>6</NUMERO><DATA>13/01/2017</DATA><RIGHE><RIGA><NUMRIGA>1</NUMRIGA><DESCRRIGA><![CDATA[RISTORATMATIC T Erogatore di esca rodenticida in polipropilene, con la caratteristica forma a "T" rovesciata,dotato di tappo di sicurezza con chiave. Non occupa superficie calpestabile, non è accessibile ai bambini ed agli animali domestici.
BEST BOX Comby: erogatore d?esca rodenticida in plastica dura, con chiusura a chiave di sicurezza, dotato di un ponte interno per posizionare trappole collanti per insetti striscianti, posizionamento sicuro delle esche rodneticide per non permetterne la fuoriuscite di prodotto e alloggio per trappole a cattura (es.T-REX).]]></DESCRRIGA><QRIGA>30</QRIGA></RIGA></RIGHE></DDT></INTERVENTO><MEZZO>0</MEZZO></INTERVENTI>
The XML is get from an HttpJob and passed directly to the SAX Parser from the GetInputStream.
The error that I get is
B4X:
org.apache.harmony.xml.ExpatParser$ParseException: At line 1,column 1405: not well-formated (invald token)
I've checked the XML with different XML validators and all the response was OK.
What could it be the problem?

Thank you so much for the attention.
 

mauro vicamini

Active Member
Licensed User
Longtime User
Create a TextReader with Initialize2 and set the encoding to: iso-8859-1

Parse it with Parser.Parse2.
Hi Erel!
Thanks so much for the hyper-fast answer!!
If I use the TextReader is sufficient to inizialize it with the Initialize2 method and than passing it to the SaxParser Parse2 method or I've to use also the ReadAll method of TextReader Object before passing it to the SaxParser?
 
Upvote 0
Top