Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use some thing like:</p> <pre><code>HttpEntity entity = response.getEntity(); InputStream input = entity.getContent(); andchange your method: getDomElement(InputStream xmlStream){ Document document = db.parse(xmlStream); } </code></pre> <p>and in your XMLActivity.java do somthing like</p> <pre><code>static final String URL = "http://sathishm.com/test.xml"; // XML node keys static final String KEY_ITEM = "row"; // parent node static final String KEY_ID = "rank"; static final String KEY_NAME = "metro_area"; static final String KEY_COST = "durum"; static final String KEY_DESC = "latitude"; ArrayList&lt;HashMap&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); XMLParser parser = new XMLParser(); InputStream stream = parser.getXmlFromUrl(URL); // getting XML Document doc = parser.getDomElement(stream); // getting DOM element NodeList nl = doc.getElementsByTagName(KEY_ITEM); // looping through all item nodes &lt;item&gt; for (int i = 0; i &lt; nl.getLength(); i++) { // creating new HashMap HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); Element e = (Element) nl.item(i); NodeList childList=e.getElementByTagName("your tag"); Element childElement=(Element)childList.item(0); String value; Node child = e.getFirstChild(); if (child instanceof CharacterData) { CharacterData cd = (CharacterData) child; value=cd.getData(); } // adding each child node to HashMap key =&gt; value map.put(KEY_ID,value); // adding HashList to ArrayList menuItems.add(map); } </code></pre>
    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.
    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