Can I force a parser to use fixed DTD for validation?
843834Jul 29 2001 — edited May 2 2007How do I force a SAX parser to use a fixed DTD (and ignore any DOCTYPE decl. in the xml doc) ??
I have been searching Java forums, apache website, the web, and SAX APIs for a way to do this but without luck. The usage is that I want to validate with a DTD located on the server, and wish to set my parser to always use that DTD, rather than requiring the user to declare a DOCTYPE declaration in the xml doc. The only solution I've seen so far is to actually search for a DOCTYPE decl in the xml, and replace it if it's there, with our own. This seems like a "hack" to me...
I've played around with EntityResolver and peeked at DTDHandler but those don't seem to work or be the right approach.
Any help would be appreciated!
Thanks
Stephen Boniface