Reputation: 105213
Here is the schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="entry">
<xs:attribute name="key" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="p">
<xs:complexType>
<xs:sequence>
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
This XML should fail validation against this schema, because key
attribute is missed:
<p><entry/></p>
But it doesn't fail. What am I doing wrong?
Upvotes: 0
Views: 40
Reputation: 2998
The name
attribute in the entry
element defintion does not link to a type definition.
You just have to add a reference to the type in your entry
element definition (to effectively type it) :
<xs:element type="entry" name="entry" minOccurs="0" maxOccurs="unbounded"/>
Upvotes: 1