<?xml version="1.0" encoding="UTF-8"?> | |
<schema xmlns="http://www.ogf.org/dfdl/dfdl-1.0/XMLSchemaSubset" | |
targetNamespace="http://www.example.org/example1/" | |
xmlns:tns="http://www.example.org/example1/" | |
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" | |
xmlns:xsd="http://www.ogf.org/dfdl/dfdl-1.0/XMLSchemaSubset" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
> | |
<!-- PRP example --> | |
<annotation> | |
<appinfo source="http://www.ogf.org/dfdl/"> | |
<dfdl:defineVariable name="counter" type="xsd:int" defaultValue="0"/> | |
</appinfo> | |
</annotation> | |
<element name="PRP"> | |
<complexType> | |
<sequence> | |
<element name="occurs" type="xsd:int" | |
dfdl:textStringJustification="right" | |
dfdl:textStringPadCharacter="%WSP;" | |
dfdl:terminator="%WSP;"/> | |
<element name="date" type="xsd:dateTime" | |
dfdl:lengthKind="pattern" | |
dfdl:lengthPattern="[^ ]+\s+[^ ]+" | |
dfdl:calendarPatternKind="explicit" | |
dfdl:calendarPattern="MM/dd/yy' 'HH:mm:ss"/> | |
<element name="unknownnum1" type="xsd:int" | |
dfdl:terminator="%WSP;" | |
dfdl:textStringJustification="right" | |
dfdl:textStringPadCharacter="%WSP;"/> | |
<element name="unknownnum2" type="xsd:int" | |
dfdl:lengthKind="delimited" | |
dfdl:terminator="%WSP;" | |
dfdl:textStringJustification="right" | |
dfdl:textStringPadCharacter="%WSP;"/> | |
<sequence dfdl:hiddenGroupRef="tns:prpIntroGroup"/> | |
<element name="frame" type="tns:frame" maxOccurs="unbounded"/> | |
</sequence> | |
</complexType> | |
</element> | |
<group name="prpIntroGroup"> | |
<sequence> | |
<element name="names" type="tns:prpIntro" /> | |
</sequence> | |
</group> | |
<complexType name="prpIntro"> | |
<sequence> | |
<element name="Description" type="tns:mydesc" | |
maxOccurs="unbounded" | |
dfdl:occursCountKind="expression" | |
dfdl:occursCount="{ ../../tns:occurs }"/> | |
</sequence> | |
</complexType> | |
<complexType name="mydesc"> | |
<sequence> | |
<element name="Name" type="xsd:string" | |
dfdl:terminator="%WSP;%WSP;%WSP;%WSP;"/> | |
<!-- we can't use %WSP; as padding because it includes \n --> | |
<element name="Unit" type="xsd:string" default="NA" | |
dfdl:textStringPadCharacter=" " | |
dfdl:textStringJustification="right" | |
dfdl:terminator="%NL;"/> | |
</sequence> | |
</complexType> | |
<group name="frameHeaderGroup"> | |
<sequence> | |
<element name="frameHeader" type="xsd:string" dfdl:terminator="%NL;" /> | |
</sequence> | |
</group> | |
<complexType name="frame"> | |
<sequence> | |
<sequence dfdl:hiddenGroupRef="tns:frameHeaderGroup"/> | |
<element name="number" maxOccurs="unbounded" | |
dfdl:occursCountKind="expression" | |
dfdl:occursCount="{ ../../tns:occurs }"> | |
<annotation> | |
<appinfo source="http://www.ogf.org/dfdl/"> | |
<dfdl:setVariable ref="tns:counter">{ 0 }</dfdl:setVariable> | |
</appinfo> | |
</annotation> | |
<complexType> | |
<sequence> | |
<element name="local_name" type="xsd:string" | |
dfdl:inputValueCalc="{ /tns:PRP/tns:names/tns:Description[$counter]/tns:Name }"> | |
<annotation> | |
<appinfo source="http://www.ogf.org/dfdl/"> | |
<!-- this have BEFORE timing, so for the first local_name $counter = 1 --> | |
<dfdl:setVariable ref="tns:counter">{ | |
$counter + 1 | |
}</dfdl:setVariable> | |
</appinfo> | |
</annotation> | |
</element> | |
<element name="unit_type" type="xsd:string" | |
dfdl:inputValueCalc="{ /tns:PRP/tns:names/tns:Description[$counter]/tns:Unit }"/> | |
<element name="value" type="xsd:float" | |
dfdl:lengthKind="explicit" | |
dfdl:length="12" | |
dfdl:textStringJustification="left" | |
dfdl:textStringPadCharacter="%NL;"/> | |
</sequence> | |
</complexType> | |
</element> | |
</sequence> | |
</complexType> | |
</schema> |