Nov
10
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(file); // or if you need to specify an encoding explitily // Document document = builder.parse( // new InputStreamReader(new FileInputStream(file), encoding));
One Ping to “How do I create a DOM Document from an XML file?”
Leave a Reply
You must be logged in to post a comment.
April 19th, 2009 at 12:23 am
[…] how-do-i-create-a-dom-document-from-an-xml-file […]