Hi Amedeo,
I tried your test.xml and test.dtd using the sax.SAXCount sample using both Xerces-J 1.4.2 and 1.4.3, and both detected the error, so I'm not sure why you don't see an error reported.
$ java sax.SAXCount -v test.xml
[Error] test.xml:9:14: The content of element type "container" must match "(content)".
test.xml: 1793 ms (4 elems, 0 attrs, 25 spaces, 6 chars)
I assume that you've enabled the validation feature, because you indicated in your first note on this thread that you were getting callbacks for other validation errors. Is that correct?
((XMLReader)parser).setFeature("http://xml.org/sax/features/validation",
true);
Thanks,
Henry
------------------------------------------------------------------------
Henry Zongaro XML Parsers development
IBM SWS Toronto Lab Tie Line 778-6044; Phone (416) 448-6044
mailto:[EMAIL PROTECTED]
Please respond to [EMAIL PROTECTED]
To: "xerces-j-user" <[EMAIL PROTECTED]>
cc:
Subject: Re: DTD validation
> are you sure you implemented the ErrorHandler to capture the error and
> warning messages?
Yes.
By the way, I also use an IBM Alphaworks utility named XML Viewer, based upon
the XML4J parser and it shows the same behaviour.
Amedeo
>
>
> Please respond to xerces-j-user <[EMAIL PROTECTED]>
> To: xerces-j-user <[EMAIL PROTECTED]>
> cc:
>
> Subject: Re: DTD validation
>
> Hi Anish,
>
> > Your XML file and the Dtd is correct . Your dtd correctly says that
> there
> > will be a name tag inside the content tag. So the parser is correctly
> not
> > complaining.
>
> Inside the content tag, _not_ inside the container tag at the same level
> with
> the content tag.
> I would like to have the parser complain because it has found a name tag
> _outside_ the content tag. How should I write the DTD to obtain this
> behaviour?
>
> Am I missing something fundamental?
>
> Thanks
>
> Amedeo
