Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing the Xml file which dont have any child nodes
    primarykey
    data
    text
    <p>I am new in android development, I want to parse one particular xml file using Dom Parser. The xml structure is something like this.</p> <pre><code>&lt;Images&gt; &lt;image link="a.tgcdn.net/images/products/zoom/e554_android_plush_robot.jpg"/&gt; &lt;image link="a.tgcdn.net/images/products/zoom/e554_android_plush_robot.jpg"/&gt; &lt;image link="http://cdn.androidpolice.com/wp-content/themes/ap1/images/android1.png"/&gt; &lt;image link="http://cdn.androidpolice.com/wp-content/themes/ap1/images/android1.png"/&gt; &lt;image link="http://cdn.androidpolice.com/wp-content/themes/ap1/images/android1.png"/&gt; &lt;/Images&gt; </code></pre> <p>I want to add those web links in a arraylist. suggest me some way out for it.. Even any link or tutorials related to this will be helpful. Thanks.</p> <p>here is full code..</p> <pre><code>public class MainActivity extends Activity { String xmlurl = "--url of xml---"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayList&lt;String&gt; mImageLink = new ArrayList&lt;String&gt;(); try { URL url = new URL(xmlurl); XMLParser parser = new XMLParser(); String xml = parser.getXMLfromUrl(url); Document doc = parser.getDomElement(xml); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc1 = db.parse(new InputSource(url.openStream())); doc1.getDocumentElement().normalize(); NodeList nodeList = doc1.getElementsByTagName("photo"); for (int i = 0; i &lt; nodeList.getLength(); i++) { Element websiteElement = (Element) nodeList.item(i); nodeList = websiteElement.getChildNodes(); mImageLink.add(websiteElement.getAttribute("link")); } } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } for(int i=0;i&lt;mImageLink.size();i++){ Log.d("Photo link --- " + i,mImageLink.get(i)); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } </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.
 

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