Jump to content

Passing null values for numeric field


pavankumard
 Share

Recommended Posts

Hi, I have an element NumericField as shown below. ......... <xs:element name="NumericField" nillable="true" minOccurs="0" maxOccurs="unbounded" > <xs:complexType> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute name="Number" form="unqualified" type="xs:integer" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> ....... In the input XML for above schema i should be able to pass a tag like <NumericField Number="1" />How to achieve this?Thanks in advance.-Pavan.

Link to comment
Share on other sites

I think it should be just

<xs:element name="NumericField" nillable="true" minOccurs="0" maxOccurs="unbounded" ><xs:complexType><xs:attribute name="Number" form="unqualified" type="xs:integer" /></xs:complexType></xs:element>

xs:simpleContent defines the content of an element, not its attributes. And there's no need to extend xs:integer if that's the only thing you're using.

Link to comment
Share on other sites

I think it should be just
<xs:element name="NumericField" nillable="true" minOccurs="0" maxOccurs="unbounded" ><xs:complexType><xs:attribute name="Number" form="unqualified" type="xs:integer" /></xs:complexType></xs:element>

xs:simpleContent defines the content of an element, not its attributes. And there's no need to extend xs:integer if that's the only thing you're using.

I am sorry, I didnt put the question properly. The schema should also suppor the tags like<NumericField Number="1">123.456</NumericField> , here 123.456 is just an example, it can any valid decimal number.so, in addition to the above it should also support the below tag..<NumericField Number="1" />
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...