Click to See Complete Forum and Search --> : Getting error


DavidKleinschni
08-07-2010, 05:39 AM
When I try to validate my xml file against my schema I receive the following error: "cvc-complex-type.2.4.a: Invalid content was found starting with element 'E2'. One of '{"":E2}' is expected."

What's wrong?

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com">

<xsd:element name="E1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="E2">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element name="E3" type="xsd:string"/>
<xsd:element name="E4" type="xsd:string"/>
</xsd:sequence>
<xsd:element name="E5" type="xsd:string"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="E3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>

<E1 xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com test.xsd">
<E2>
<E3>bla</E3>
<E4>blub</E4>
</E2>
<E2>
<E5>XYZ</E5>
</E2>
</E1>