You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sander Bos <sa...@x-hive.com> on 2004/01/09 18:12:22 UTC
Full validation of DTDs
Hi there,
If I have a document like:
===
<!DOCTYPE test SYSTEM "test.dtd">
<test/>
===
and a DTD like
===
<!ELEMENT test EMPTY>
<!ELEMENT illegal_decl (some, none, existing, element, names)>
===
is it possible to get errors from the DTD being incorrect (for instance
'some' is not defined in any way). I tried parsing the document with an
XNI parser with
parserConfig.setFeature("http://xml.org/sax/features/validation",
true);
parserConfig.setFeature("http://apache.org/xml/features/validation/schem
a-full-checking", true);
but the full-checking does not seem to have an effect for my DTD, the
illegal_decl is not noticed. Is what I see what I should see? Is there
any way to have Xerces report errors for this DTD (e.g. with a preparser
or something like that)?
Kind regards,
--Sander.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Full validation of DTDs
Posted by Michael Glavassevich <mr...@apache.org>.
Hi Sander,
The parser doesn't report any errors for your example because there's no
such constraint for DTDs. Only if an element called 'some' is in your
instance document, will the parser report an error for the missing element
declaration [1] while validating.
[1] http://www.w3.org/TR/REC-xml#elementvalid
On Fri, 9 Jan 2004, Sander Bos wrote:
>
> Hi there,
>
> If I have a document like:
>
> ===
> <!DOCTYPE test SYSTEM "test.dtd">
> <test/>
> ===
>
> and a DTD like
>
> ===
> <!ELEMENT test EMPTY>
> <!ELEMENT illegal_decl (some, none, existing, element, names)>
> ===
>
> is it possible to get errors from the DTD being incorrect (for instance
> 'some' is not defined in any way). I tried parsing the document with an
> XNI parser with
> parserConfig.setFeature("http://xml.org/sax/features/validation",
> true);
>
> parserConfig.setFeature("http://apache.org/xml/features/validation/schem
> a-full-checking", true);
> but the full-checking does not seem to have an effect for my DTD, the
> illegal_decl is not noticed. Is what I see what I should see? Is there
> any way to have Xerces report errors for this DTD (e.g. with a preparser
> or something like that)?
>
> Kind regards,
>
> --Sander.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org