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 Em...@tcc.thomson-csf.com on 2000/12/21 08:58:59 UTC

Xerces 1.2.2 Error during schema validation

Hi all,

I have the following error during a schema validation with Xerces 1.2.2 :

Error at line number, 3: Schema error:  complexType '#1' with a elementOnly
or mixed content need to have at least one particle child.

The document and his schema are :

<?xml version="1.0" encoding="UTF-8"?>

<Foo xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Foo.xsd">
   <Bar number="21">some text</Bar>
   <Bar number="62">some text again</Bar>
</Foo>


<?xml version="1.0" encoding="UTF-8"?>
<schema>
   <element name="Foo">
      <complexType>
	<element ref="Bar" minOccurs="1" maxOccurs="unbounded"/>
      </complexType>
   </element>

   <element name="Bar">
      <complexType content="string">
     	<attribute name="number" type="integer" used="required"/>
      </complexType>
  </element>
</schema>

I don't understand why there is the an error. Can somebody explain it ?
Thanks.
		Emmanuel.

Re: Xerces 1.2.2 Error during schema validation

Posted by Eric Ye <er...@locus.apache.org>.
Here is how to fix the problem:
.......
    <element name="Bar">
       <complexType content="textOnly"> <!-- content="string" is not
valid -->
             <attribute name="number" type="integer" used="required"/>
       </complexType>
    </element>
.......

Best regards
Eric Ye
IBM, Cupertino

----- Original Message -----
From: <Em...@tcc.thomson-csf.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, December 20, 2000 11:58 PM
Subject: Xerces 1.2.2 Error during schema validation


> Hi all,
>
> I have the following error during a schema validation with Xerces 1.2.2 :
>
> Error at line number, 3: Schema error:  complexType '#1' with a
elementOnly
> or mixed content need to have at least one particle child.
>
> The document and his schema are :
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <Foo xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="Foo.xsd">
>    <Bar number="21">some text</Bar>
>    <Bar number="62">some text again</Bar>
> </Foo>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema>
>    <element name="Foo">
>       <complexType>
> <element ref="Bar" minOccurs="1" maxOccurs="unbounded"/>
>       </complexType>
>    </element>
>
>    <element name="Bar">
>       <complexType content="string">
>      <attribute name="number" type="integer" used="required"/>
>       </complexType>
>   </element>
> </schema>
>
> I don't understand why there is the an error. Can somebody explain it ?
> Thanks.
> Emmanuel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>