Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to parse data as i am getting an expatParser Exception
    primarykey
    data
    text
    <p>guys Following is the xml which i am trying to parse</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;Categories&gt;&lt;category name="Banquet &amp; Marriage Hall" id="1" image=""/&gt;&lt;category name="Crematorium, Burial Ground" id="2" image=""/&gt;&lt;category name="Educational Institution" id="3" image=""/&gt;&lt;category name="Embassies &amp; Consulates" id="4" image=""/&gt;&lt;category name="Fire Station" id="5" image=""/&gt;&lt;category name="Government Office" id="6" image=""/&gt;&lt;/Categories&gt; </code></pre> <p>Following is the code of my parser which i am using </p> <pre><code>public byte parse(){ SAXParserFactory spf = null; SAXParser sp = null; InputStream inputStream = null; try { inputStream = new ByteArrayInputStream(data.getBytes()); spf = SAXParserFactory.newInstance(); if (spf != null) { sp = spf.newSAXParser(); **sp.parse(inputStream, this);** } } /* * Exceptions need to be handled MalformedURLException * ParserConfigurationException IOException SAXException */ catch (Exception e) { System.out.println("Exception: " + e); e.printStackTrace(); } finally { try { if (inputStream != null) inputStream.close(); } catch (Exception e) { } } if (categorieslist != null &amp;&amp; categorieslist.size() &gt; 0) { // Log.d("Array List Size",""+tipsList.get(4).getTitle()); return 1; } else { return 0; } } public ArrayList&lt;Categories&gt; getParserCategoriesList(){ return categorieslist; } public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if(localName.equalsIgnoreCase("Categories")){ if(localName.equalsIgnoreCase("category")){ categories = new Categories(); categorieslist.add(categories); categories.setId(attributes.getValue("id")); Log.d("ID",attributes.getValue("id")); categories.setName(attributes.getValue("name")); Log.d("NAME",attributes.getValue("name")); /*categories.setImage(attributes.getValue("image")); Log.d("image",attributes.getValue("image"));*/ } } </code></pre> <p>sp.parse() is the code which is giving me the expatParser Exception I have been using the same logic in previous 5 xml parsing and i dont get this error. What am i doing wrong or is it dat the xml is wrong ??</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload