The contents of my webpage is an XML file and I am saving this content in a string. I have to read the nodes of the XML file. How do I fetch the values of the nodes from this XML file?
Can someone please help me on this?
The contents of my webpage is an XML file and I am saving this content in a string. I have to read the nodes of the XML file. How do I fetch the values of the nodes from this XML file?
Can someone please help me on this?
you can use a Document
In Java, how do I parse XML as 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);
}