Hi list,

I've got a problem validating a xml by a xsd.

A short preview about the xsd:

<complexType name="MyType2">
 <attribute name="MyAttribute" type="string" use="required" />
</complexType>

<complexType name="MyType1 ... />

<element name="MyRoot">
 <complexType>
  <choice>
   <element name="MyType1" ... />
   <element name="MyType2" type="MyType2" minOccurs="1" maxOccurs="1" />
  </choice>
 </complexType>
</element>


Ok, my XML file looks like this:

<MyRoot xmlns="..." ...>
 <MyType2 MyAttribute="something">
  ...
 </MyType2>
</MyRoot>


Now I try to validate this with jDOM by using xerces. Then I got the
following error:
 - Error on line 6: cvc-complex-type.3.2.2: Attribute "MyAttribute" must
not occur in element "MyType2".


I validated the same xml with the same xsd with oXygen (which also uses
xerces) and with some online validators. All told me that the xml is valid.

So my question is, why does the JAVA implementation gives tells me that
the xml is not valid.

I'm grateful for some hints.

Thanks!

Best regards,
Ronny

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to