"Swanson, Brion" wrote:
> 
> The problem with DocumentBuilderFactory.newDocument() is that it just spits
> out a new document with a default root element name (as far as I can tell).
> I have a root element name I want to use, but I don't want the document
> associated with any doctype (as it is unused anyway and adding one would
> only promote additional headaches when parsing the resultant document.
> 
> That is, if there's a doctype, then either it's a bogus doctype or it's
> valid.  If it's bogus, I'm not sure if I'd have problems with the parser
> trying to pull in a non-existent file.  In the other case, if the doctype is
> valid, then I'd rather avoid the parsing of the DTD when it won't be used
> anyway.  As I understand it, the doctype is always parsed if it exists and
> its dependant files are also parsed even if they are unused (validation is
> off).

Not in the version of Xerces 2 that I see.  The code in
org.apache.xerces.jaxp.DocumentBuilderImpl says...

    public Document newDocument() {
        return new org.apache.xerces.dom.DocumentImpl();
    }

which should just create a single node.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to