It's possible with SAX 2.0.2. It supports DTD processing and validation for XML documents which do not have a DOCTYPE through the EntityResolver2 interface [1] (the javadoc is a little out of date).
[1] http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html#getExternalSubset(java.lang.String,%20java.lang.String)
Gareth Reakes <[EMAIL PROTECTED]> wrote on 05/28/2004 03:35:55 AM:
> Hi,
> IIRC you can't currently do this easily through the standard API
> (I can't recall the last time I worked with a DTD :)). Options:
>
> i) add a doctype after you get the document.
>
> ii) Take a look at some code in Pathan which does validation of sub trees
> by looking the root node up in the current grammars. You should be able to
> use this to validate the document against any grammar you have. If you
> take a look at the API for Grammar you should be able to do this anyway.
>
>
> Gareth
>
> On Thu, 27 May 2004 [EMAIL PROTECTED] wrote:
>
> > Hi,
> >
> > I would like to validate xml dokuments with always the same DTD.
> > The XML file can have a DOCTYPE .. line or not.
> > I can not change the XML file.
> >
> > If I'm getting a XML dokument with a DOCTYPE I'm able to change
> the DTD to my
> > default DTD (I'm using the HandlerBase::resolveEntity) - no problem
> >
> > But if I'm getting a XML File without DOCTYPE am not able to change the DTD
> > because resolveEntity is not called. This is my problem.
> >
> > How can I force a default DTD
> >
> > Thanks.
> >
> > Christian
> >
> >
> >
> >
> >
> > -------------------------------------------------
> > This mail sent through IMP: http://horde.org/imp/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> --
> Gareth Reakes, Managing Director Parthenon Computing
> +44-1865-811184 http://www.parthcomp.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
- Validation with a default DTD listen-ch
- Re: Validation with a default DTD Gareth Reakes
- Michael Glavassevich
