You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Guillaume Jacob - Sun Microsystems <Gu...@france.sun.com> on 2000/10/17 07:45:46 UTC

SAX2 validation problem

I am facing a validation problem using xerces-j version 1.1.3.

I want to parse an XML document with a validating SAX parser.

My DTD defines the following element:
<!ELEMENT A
  ((B|C)*, D?)
>

When I am parsing an XML document where the content of element A mixes
text with other elements, I get the following error:
The content of element type "A" must match "((B|C)*,D?)

If I change my DTD definition to:
<!ELEMENT A
  ((#PCDATA|B|C)*, D?)
>
I get the following error:
A '(' character or an element type is required in the declaration of
element type "A"

Do you have any suggestion ? All I can add is that the problem does not
appear when I use a SAX 1 validating parser (i.e. the parser
does not complain when I don't declare the #PCDATA in my DTD).

Thanks in advance

Guillaume Jacob

--
Guillaume JACOB - SUN Microsystems

mailto: Guillaume.Jacob@France.Sun.COM
phone:  +33.4.76.41.43.27



Re: SAX2 validation problem

Posted by Andy Clark <an...@apache.org>.
Guillaume Jacob - Sun Microsystems wrote:
> <!ELEMENT A
>   ((B|C)*, D?)
> >
> 
> When I am parsing an XML document where the content of element A 
> mixes text with other elements, I get the following error:
> The content of element type "A" must match "((B|C)*,D?)


Because your model only allows element content, no text (except
for whitespace).

> If I change my DTD definition to:
> <!ELEMENT A
>   ((#PCDATA|B|C)*, D?)

This is an illegal content model. You can't use the Mixed and
Children content model together.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org