On Tue, Oct 01, 2002 at 09:47:11AM +1000, Peter Donald wrote: > Hiya, > > Does anyone know of a method in which you can force an XML parser to validate > against a specific DTD regardless of whether it is declared or not. So > effectively I want to ignore the presence of DOCTYPE and always specify the > doctype myself.
I hit this problem, and came up with: http://doctypechanger.sourceforge.net/ which is an XML "pre-parser", to strip, modify or add a DOCTYPE declaration to an incoming XML bytestream. > I can see this is possible using external APIs or parser specific APIs but > does anyone know of any vaguely standard way of doing this. Set a feature of > some sort? You can use a custom EntityResolver to force a specific DTD (perhaps specified via an XML catalog). The problem is that if no DOCTYPE declaration is present there is no way to force validation. There is a SAX 2 extension that fixes this: http://sax.sourceforge.net/apidoc/org/xml/sax/ext/EntityResolver2.html In the meanwhile, I think using hacks like doctypechanger is the only option. --Jeff > -- > Cheers, > > Peter Donald > He strains to hear a whisper who refuses to hear a shout. > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>