Jeremy Stein
Jeremy Stein

Reputation: 19651

Specify XML schema data type of decimal or blank

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

Upvotes: 3

Views: 3054

Answers (1)

John Saunders
John Saunders

Reputation: 161773

Add nillable="true".

Upvotes: 5

Related Questions