I follow this turorial when parsing XML using XPath, and it gives the following example to open a document:
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true); // never forget this!
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse("books.xml");
What I would like to do is change, so it Documentreads a variable Stringthat I have already done, instead of reading from a file. How can i do this?
source
share