Example DFDL schema
A fragment of a DFDL schema that shows how delimited text data can be modeled.
Consider the following delimited ASCII text data:
int=5;float=-7.1E8
In
this data int=
andfloat=
denote the start of an element. They are initiators.- The semicolon after 5 marks the boundary between the two elements in a sequence, and is a separator.
5
is an integer in ASCII text.-7.1E8
is a floating point number in ASCII text.
This is represented in a DFDL schema file as follows:
<xs:complexType name="myNumbers">
<xs:sequence>
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/v1.0">
<dfdl:sequence separator=";" encoding="ascii"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="myInt" type="xs:int">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/v1.0">
<dfdl:element representation="text"
textNumberRep="standard" encoding="ascii"
lengthKind="delimited" initiator="int=" …/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="myFloat" type="xs:float">
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/v1.0">
<dfdl:element representation="text"
textNumberRep="standard" encoding="ascii"
lengthKind="delimited" initiator="float=" …/>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
Here is the same information, this time written in the short form:
<xs:complexType name="myNumbers">
<xs:sequence dfdl:separator=";" dfdl:encoding="ascii" >
<xs:element name="myInt" type="xs:int"
dfdl:representation="text"
dfdl:textNumberRep="standard" dfdl:encoding="ascii"
dfdl:lengthKind="delimited" dfdl:initiator="int=" … />
<xs:element name="myFloat" type="xs:float"
dfdl:representation="text"
dfdl:textNumberRep="standard" dfdl:encoding="ascii"
dfdl:lengthKind="delimited" dfdl:initiator="float=" … />
</xs:sequence>
</xs:complexType>
The above examples are for illustrative
purposes only. The schema requires other DFDL properties to be present
in order to make it a valid example.