You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <pe...@apache.org> on 2002/10/01 01:47:11 UTC
Validate XML all the time?
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 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?
--
Cheers,
Peter Donald
He strains to hear a whisper who refuses to hear a shout.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Validate XML all the time?
Posted by Leo Simons <le...@apache.org>.
On Tue, 2002-10-01 at 01:47, 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 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?
I think there is none. There's hacks for it to be found all over the
place of course (it is a common need) =)
cheers,
Leo
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Validate XML all the time?
Posted by Jeff Turner <je...@apache.org>.
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: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Validate XML all the time?
Posted by Peter Royal <pr...@apache.org>.
On Monday, September 30, 2002, at 10:11 PM, Jason van Zyl wrote:
> I use the Multi Schema Validator (msv) to make a Validator object that
> can be used to validate a document against DTD, XSD, RelaxNG. Works
> nicely and is pretty easy to use. It's worked great for me so far.
>
> http://tambora.zenplex.org/cgi-bin/cvsweb.cgi/plexus/component-builds/
> transactor/src/java/org/apache/plexus/transactor/
> Validator.java?rev=1.2&content-type=text/x-cvsweb-markup
>
Excellent library :) There's one hiding in Phoenix too:
http://cvs.apache.org/viewcvs/jakarta-avalon-phoenix/src/java/org/
apache/avalon/phoenix/components/configuration/validator/
JarvConfigurationValidator.java?rev=1.7&content-type=text/vnd.viewcvs-
markup
Needs to be pushed back into the excalibur/configuration package though.
if only there was more time...
-pete
--
peter royal -> proyal@apache.org
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Validate XML all the time?
Posted by Jason van Zyl <ja...@zenplex.com>.
On Mon, 2002-09-30 at 19:47, 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 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?
I use the Multi Schema Validator (msv) to make a Validator object that
can be used to validate a document against DTD, XSD, RelaxNG. Works
nicely and is pretty easy to use. It's worked great for me so far.
http://tambora.zenplex.org/cgi-bin/cvsweb.cgi/plexus/component-builds/transactor/src/java/org/apache/plexus/transactor/Validator.java?rev=1.2&content-type=text/x-cvsweb-markup
> --
> Cheers,
>
> Peter Donald
> He strains to hear a whisper who refuses to hear a shout.
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
jvz.
Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org
In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
-- Jacques Ellul, The Technological Society
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>