Reputation: 11
I'm trying to validate an incoming XML. The XML has an attribute verb="". The XSD has an enumeration of the possible verb values and it doesn't include the "" option:
<xsd:attribute name="verb" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="Create" />
<xsd:enumeration value="Delete" />
<xsd:enumeration value="Retrieve" />
<xsd:enumeration value="RetrieveByContent" />
<xsd:enumeration value="Update" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
I tried to add <xsd:enumeration value="" />
but it didn't work. Can anyone help me with fixing the XSD?
Thanks in advance.
Upvotes: 1
Views: 775
Reputation: 80176
You should use xsd:string
(or xsd:token
whichever makes more sense) as the base instead of xsd:NMTOKEN
. xsd:NMTOKEN
, xsd:NMTOKENS
etc are provided for compatibility with DTD.
Upvotes: 2