Specify XML schema data type of decimal or blank

Posted by Jeremy Stein on Stack Overflow See other posts from Stack Overflow or by Jeremy Stein
Published on 2010-03-24T20:00:01Z Indexed on 2010/03/24 20:03 UTC
Read the original article Hit count: 394

Filed under:
|

Is there a way in an XML schema to specify that an element may contain either an empty string or a decimal?

If I specify the type as xs:decimal like this:

<xs:element name="Sample" type="xs:decimal" />

then a blank value would not pass validation:

<Sample/>

(I realize that the best way to indicate no value would be to not include the element, but I was wondering if there was a way to allow blank or decimal.)

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xml-schema