Hello,
I have a quick question about the following code snippet:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("books.xml");
Please have a look at the last line "builder.parse("books.xml");". I would like to use XPath to retrieve some informations of a xml file without having to deserialize the whole file (since the XML file rather big and I need to go through several of them in a loop).
What exactly does the "builder.parse(...)" method? Is it reading the XML file and writing all the content to memory? Or does it only analyze and read the structure of the XML code? Or in other words, is the text of an element "//books/title" in memory after parsing, or not until I really access the "title" node of that XML?
Thanks a lot for your help
Best Regards,
Ben