- From: Kisu San <Kishore.san@gmail.com>
- Date: Sun, 30 Nov 2008 01:52:50 -0800 (PST)
- To: public-xml-id@w3.org
Hi I am using following code to convert String representation of xml to Document object. But it is not working. Nor throwing any exception. can anyone please help?? import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } -- View this message in context: http://www.nabble.com/xmlString-to-Document-object-converstion-tp20738166p20738166.html Sent from the w3.org - public-xml-id mailing list archive at Nabble.com.
Received on Monday, 1 December 2008 08:42:20 UTC