I am trying to use javax.xml to validate my xml against my schema. The problem is that if I have a schema like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wmh="http://www.wmhelp.com/2003/eGenerator"
elementFormDefault="qualified">
<xs:element name="aLife">
<xs:complexType>
<xs:sequence>
<xs:element ref="x"/>
<xs:element ref="y"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="x">
<xs:complexType>
<xs:sequence>
<xs:element name="repeated" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="y">
<xs:complexType>
<xs:sequence>
<xs:element name="repeated" type="multistrings"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="multistrings">
<xs:sequence>
<xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Note, in my schema there are actually other elements in the sequences that have been removed for brevity. The validator will throw an error when I use the syntax required for the 'repeated' element inside 'y'. I get an error like this:
Element 'repeated' cannot have character [children], because the type's content type is element-only.
Is this a problem with my schema or something else?
Edited by: miteke on Aug 5, 2008 1:48 PM