Description
This schema uses a nillable complex element.
<xs:element name="input"> <xs:complexType> <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix"> <xs:element name="person" maxOccurs="unbounded" dfdl:occursKind="implicit" dfdl:initiator="Person:" nillable="true" dfdl:nilValue="%ES;" dfdl:nilValueDelimiterPolicy="initiator"> <xs:complexType> <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"> <xs:element name="name" type="xs:string" /> <xs:element name="age" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element>
Parsing this data:
Person:John Doe,29 Person:Sally Smith,34 Person: Person:Bob Jones,51
That produces this infoset when parsing:
<input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <person> <name>John Doe</name> <age>29</age> </person> <person> <name>Sally Smith</name> <age>34</age> </person> <person xsi:nil="true"></person> <person> <name>Bob Jones</name> <age>51</age> </person> </input>
Unparsing dies with error:
Unparse Error: Element {}person does not have a value.