xml parsing - Android XML parser 3G issue: result string are splitted and duplicated -


I have to get data from XML received from webservice.

I use the SAC parser, such as compliance:

  URL url = new URL (this.pUrl); SAXParserFactory spf = SAXParserFactory.newInstance (); SAXParser sp = spf.newSAXParser (); XMLReader xr = sp.getXMLReader (); Product Handler Handler = New Product Handler (); Xr.setContentHandler (handler); Input source = new input source (url.openstream ()); Is.setEncoding ("ISO-8859-1"); Xr.parse (is);  

XML items:

  & lt; Products & gt; & Lt; Id_product & gt; 4548 & lt; / Id_product & gt; & Lt; Name & gt; Special Snack 30g Chocolate & lt; / Name & gt; & Lt; Price & gt; 15,00 & lt; / Pricing & gt; & Lt; / Products & gt;  

Handler snippet:

  .. else if (localName.equals ("name")) {this.in_nome = true; } .. else if (localName.equals ("name")) {this.in_nome = false; } .. and if (this.in_name) {xmlparsing.setNames (new string (ch, start, length)); }  

When I use WiFi connection, it works well.

If I use a 3G connection, some items are full and are duplicated.

For example

Wifi behavior:

Product Name: Special Snack 30g Chocolate

3G Behavior:

  Product Name: Special SNA; Product name: 30 grams of special snack chocolate;  

This behavior causes a problem in the list of products (the product ID associated with the wrong name).

How can I solve it?


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -