Reasoning for load-external-dtd Xerces default setting?

B

blu4899

Hi,

The Xerces XML parser is reading external DTD references in DOCTYPEs
by default, but is not doing anything with them because validation is
turned off by default. This is documented in
http://xml.apache.org/xerces2-j/features.html#nonvalidating.load-external-dtd

This setting causes many XML instances with broken DTD references in
the DOCTYPE to fail and adds some performance overhead. Is there
anything good that comes from this default setting? Is an XML file
considered not well-formed if the external DTD reference is broken?

thanks,
blu
 
B

Bob Foster

blu4899 said:
Hi,

The Xerces XML parser is reading external DTD references in DOCTYPEs
by default, but is not doing anything with them because validation is
turned off by default. This is documented in
http://xml.apache.org/xerces2-j/features.html#nonvalidating.load-external-dtd

This setting causes many XML instances with broken DTD references in
the DOCTYPE to fail and adds some performance overhead. Is there
anything good that comes from this default setting? Is an XML file
considered not well-formed if the external DTD reference is broken?

I can't find anywhere in the XML spec that says it is. If someone knows
better, I would be delighted to know about it, too.

Bob Foster
 
B

Bob Foster

But, I hasten to add, all parsers I am aware of treat it an unresolvable DTD
URI as an error if validation is enabled (while only some treat an
unresolvable external entity URI as an error).

Tim Bray, in his Annotated XML comments had this to say about URIs: "If you
do something silly like using an empty identifier, or one that doesn't work,
anyone to whom you send the document has every right to complain that it's
broken."

Makes sense. But this doesn't seem to have found its way into the spec.

Bob Foster
 
K

Karl Waclawek

Bob Foster said:
I can't find anywhere in the XML spec that says it is. If someone knows
better, I would be delighted to know about it, too.

Not validating does not mean that the parser should not read external entities.
These can contain entity declarations and attribute default values which the
parser can use to resolve entity references and default attributes properly.

Karl
 
B

Bob Foster

Karl Waclawek said:
Not validating does not mean that the parser should not read external entities.
These can contain entity declarations and attribute default values which the
parser can use to resolve entity references and default attributes
properly.

One can pile up "should" and "can" as high as one likes, but a parser won't
do any of the things it should or can do unless it a) supports the option to
do them and b) is appropriately configured. ;-}

Bob Foster
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top