When creating a DOM from a stream, the information such as encoding, standalone, version, in the XML declaration is not retained by DOM L2, but, DOM L3 does. The DOCTYPE can be retrieved using the getDoctype() method of the Document object.
-----Original Message-----
From: Matthew Oatham [mailto:matthewoatham@hotmail.com]
Sent: Monday, April 14, 2003 8:28 PM
To: general@xml.apache.org
Subject: creating DOM from file

When I create a DOM from an existing file the resulting xml has the following elements missing
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
I am using DocumentBuilder.parse(File file) to load the DOM tree. Is there a way to retain or add these elements?