You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Benson Cheng <Be...@viacore.net> on 2002/06/20 19:37:16 UTC
Allow emptyTag for optional fields
I have a schema question, how can I write the schema that allows emptyTag for optional fields, for example:
Schema:
<xsd:element name="Partner">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="Age" type="xsd:positiveInteger" minOccurs="0"/>
</xsd:sequence>
</xsd:element>
XML-1:
<Partner>
<Name>MyName</Name>
</Partner>
XML-2:
<Partner>
<Name>MyName2</Name>
<Age/>
</Partner>
For the second XML, the Xerces throws a error like "Value '' is not a integer", my question is how can I change the schema so it can allow both XML, I know I can change the type of "Age" to xsd:string and use the regular expression "[0-9]{1,}", but I am wonder is there way to keep the xsd:positiveInteger type and also allow the empty tag the same time?
Thanks
Benson.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org