Android examples for XML:XML Parse
parse XML Content via Reader
//package com.java2s; import java.io.IOException; import java.io.Reader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { public static Document parseReader(Reader reader) throws org.xml.sax.SAXException, IOException, ParserConfigurationException { return newDocumentBuilder().parse( new org.xml.sax.InputSource(reader)); }/*from w w w. j a va 2s .c om*/ private static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { // SAXParsers are not concurrency compatible, so always return a new instance to prevent thread issues DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); return dbf.newDocumentBuilder(); } }