How to parse nillable fields in XML.
book
Article ID: KB0085578
calendar_today
Updated On:
TIBCO ActiveMatrix BusinessWorks
-
Not Applicable
-
Show More
Show Less
Description
Description: If the element files are defined nillable in the schema, we directly set these elements to be empty in the XML data input and an error will be thrown.
Issue/Introduction
How to parse nillable fields in XML.
Resolution
There are at least two ways to enable the nillable element. One way is by adding the following lines into your schema: <xs:element name="NillableDateField" type="xs:dateTime" nillable="true"/> <xs:element name="NilableDecimalField" type="xs:decimal" nillable="true"/> Then in the data input, use the following format: <n1:NilableDecimalField xsi:nil="true"/> <n1:NillableDateField xsi:nil="true"/> The other way is to define the schema as follows: <xs:simpleType name="decimal-or-empty"> <xs:union memberTypes="xs:decimal empty-string"/> </xs:simpleType> <xs:simpleType name="date-or-empty"> <xs:union memberTypes="xs:date empty-string"/> </xs:simpleType> <xs:simpleType name="empty-string"> <xs:restriction base="xs:string"> <xs:enumeration value=""/> </xs:restriction> </xs:simpleType> <xs:element name="NillableDateField" type="date-or-empty"/> The input field format can be directly set to be empty: <n1:NilableDecimalField/> <n1:NillableDateField/>
Additional Information
X3C XML schema part-1
Feedback
thumb_up
Yes
thumb_down
No