avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: Validate XML all the time?
Date Tue, 01 Oct 2002 07:17:49 GMT
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:


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:


In the meanwhile, I think using hacks like doctypechanger is the only


> -- 
> Cheers,
> Peter Donald
> He strains to hear a whisper who refuses to hear a shout.
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message