You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Mark Womack <mw...@bevocal.com> on 2003/01/28 20:26:52 UTC

Conditional DTD validation?

Is there any way to have the XMLReader perform DTD validation conditionally?
I would like it to perform DTD validation if it finds a DOCTYPE entity, and
do anything if it does not.  Right now I enable validation before parsing
any xml file, but if no DOCTYPE is found, I get the following exception:

09:38:52,530 ERROR  PromptMapReader : **Parsing Error**
  Line:    5
  URI:     null
  Message: Document root element "prompt_mapping", must match DOCTYPE root
"null".

where "prompt_mapping" is the root element in the root element of my xml
document.  Is there a handler or interface someplace that I can override or
provide my own version that can turn on the validation when a DOCTYPE is
present?

I am using Xerces 2.2.0.

The reason I am asking is that I want to have the DOCTYPE present during
development, but for production deployment I want to comment it out.  I'd
like to be able to make this change to the xml sources without changing my
xml parsing code accordingly.

Thanks,
-Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org