WebHosting

Tuesday, January 24, 2012

How can I get it to parse XML contained within a String instead of a file?

 public static Document loadXMLFromString(String xml) throws Exception
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        InputSource is = new InputSource(new StringReader(xml));
        return builder.parse(is);
    }


No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

Warp AI Terminal 🔥 | The Future of Coding? Agentic Dev Environment Explained!

  Warp AI Terminal 🔥 | The Future of Coding? Agentic Dev Environment Explained! What if your terminal could think, assist, and even act li...