java - Parsing XML into Android Application -


I'm trying to parse my Android application. I read a lot of questions about parsing XML on StaxHowFourFlow, yet I'm not sure how to handle for loop in my case.

If anybody loved me to give a good example of working for this case of XML, I would be very grateful.

For example I found on STACKOVERFLOW

  try {DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance (); DocumentBuilder db = dbf.newDocumentBuilder (); Document Doctor = db.parse (* / insert my URL / *); Doc.getDocumentElement () Normal () .; Node list nodlist = doc.getElementsByTagName (* / what's my case here? / *); Item = new text view [nodlist.gateLong ()]; For (int i = 0; i & lt; nodeList.getLength (); i ++) {node node = node list. Item (i); Item [i] = new text view (this); Element fstElmnt = (element) node; Nodelist item list = fstElmnt.getElementsByTagName (* / what's my case here? / *); Element Item Element = (Element) itemList.item (0); ItemList = itemElement.getChildNodes (); Item [i] .setText ("item =" + ((node) itemlist.image (0)). Match adw ()); Layout.addView (item [i]); }} Hold (exception e) {System.out.println ("XML paging expision =" + e); } / ** Set the layout view to display * / setContentView (layout); }   

The above code is not an example I am using. It's just the same on the Internet to analyze XML on the Android app. But my XML is more complex than our originally posted ones.

Use XmlPullParser to parse XML in your Android application. It's very easy and very fast.

I use XmlPullParser in all my applications.

Follow this tutorial, it's a good example to use XmlPullParser.



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -