Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify XML schema data type of decimal or blank

Tags:

xml

xsd

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.)

like image 607
Jeremy Stein Avatar asked Nov 21 '25 05:11

Jeremy Stein


1 Answers

Add nillable="true".

like image 124
John Saunders Avatar answered Nov 23 '25 20:11

John Saunders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!