Hello DFDL Community,

I have a simple data format:

        Label: Message

Here is a sample input:

        Dear Sir: Thank you for your response.

I will take this perspective: 

        The data format consists of a series of
        two strings (label and message),
        separated by colon.

Here is the XML that I wish to produce:

<really-simple-format>
      <label>Dear Sir</label>
      <message>Thank you for your response.</message>
</really-simple-format>

I have identified 3 approaches to design the DFDL schema:

1. Inline the DFDL stuff with the XML schema stuff.

2. Don't inline any DFDL stuff; instead, put all the DFDL stuff at the top, 
inside xs:annotation.

3. Inline some DFDL stuff, put some DFDL stuff at the top, inside xs:annotation.

Below I show the 3 approaches. Which is best practice? I know you will say the 
third approach (mix approach) is best practice. Okay, then, which DFDL stuff 
should be inlined and which should be put at the top, inside xs:annotation? 
What is the rationale for how you divvy up the DFDL stuff between inline and at 
the top? Do you agree with how I divvied up the DFDL stuff? Would you put more 
stuff inline? If so, what other stuff would you put inline?

------------------------------------
    All Inline Approach
------------------------------------

<xs:element name="really-simple-format"
    dfdl:alignment="implicit" 
    dfdl:alignmentUnits="bytes"
    dfdl:encoding="UTF-8"
    dfdl:escapeSchemeRef=""
    dfdl:ignoreCase="no"
    dfdl:initiator=""  
    dfdl:leadingSkip="0"
    dfdl:lengthKind="delimited" 
    dfdl:outputNewLine="%CR;%LF;"
    dfdl:representation="text"
    dfdl:terminator=""
    dfdl:textPadKind="none"
    dfdl:textTrimKind="none"
    dfdl:trailingSkip="0"
    dfdl:truncateSpecifiedLengthString="no"
    >
    <xs:complexType>
        <xs:sequence 
            dfdl:alignment="implicit"  
            dfdl:alignmentUnits="bytes"   
            dfdl:encoding="UTF-8" 
            dfdl:ignoreCase="no"
            dfdl:initiatedContent="no"
            dfdl:initiator="" 
            dfdl:leadingSkip="0" 
            dfdl:lengthKind="delimited" 
            dfdl:outputNewLine="%CR;%LF;"
            dfdl:separator=":" 
            dfdl:separatorPosition="infix"
            dfdl:separatorSuppressionPolicy="never" 
            dfdl:sequenceKind="ordered"
            dfdl:terminator="" 
            dfdl:trailingSkip="0" 
            >
            <xs:element name="label" type="xs:string" 
                dfdl:alignment="implicit" 
                dfdl:alignmentUnits="bytes"
                dfdl:encoding="UTF-8"
                dfdl:escapeSchemeRef=""
                dfdl:ignoreCase="no"
                dfdl:initiator=""  
                dfdl:leadingSkip="0"
                dfdl:lengthKind="delimited" 
                dfdl:outputNewLine="%CR;%LF;"
                dfdl:representation="text"
                dfdl:terminator=""
                dfdl:textPadKind="none"
                dfdl:textTrimKind="none"
                dfdl:trailingSkip="0"
                dfdl:truncateSpecifiedLengthString="no"
            />
            <xs:element name="message" type="xs:string"
                dfdl:alignment="implicit" 
                dfdl:alignmentUnits="bytes"
                dfdl:encoding="UTF-8"
                dfdl:escapeSchemeRef=""
                dfdl:ignoreCase="no"
                dfdl:initiator=""  
                dfdl:leadingSkip="0"
                dfdl:lengthKind="delimited" 
                dfdl:outputNewLine="%CR;%LF;"
                dfdl:representation="text"
                dfdl:terminator=""
                dfdl:textPadKind="none"
                dfdl:textTrimKind="none"
                dfdl:trailingSkip="0"
                dfdl:truncateSpecifiedLengthString="no" 
            />
        </xs:sequence>
    </xs:complexType>
</xs:element>

------------------------------------
    No Inline Approach
------------------------------------

<xs:annotation>
    <xs:appinfo source="http://www.ogf.org/dfdl/";>
        <dfdl:format  
            alignment="1" 
            alignmentUnits="bytes"  
            binaryFloatRep="ieee" 
            binaryNumberRep="binary"  
            bitOrder="mostSignificantBitFirst"
            byteOrder="bigEndian"  
            calendarPatternKind="implicit"
            documentFinalTerminatorCanBeMissing="yes" 
            emptyValueDelimiterPolicy="none"
            encoding="ISO-8859-1"
            encodingErrorPolicy="replace" 
            escapeSchemeRef=""  
            fillByte="f" 
            floating="no" 
            ignoreCase="no" 
            initiator="" 
            initiatedContent="no" 
            leadingSkip="0" 
            lengthKind="delimited"
            lengthUnits="bits"  
            nilKind="literalValue"  
            nilValueDelimiterPolicy="none"
            occursCountKind="implicit"
            outputNewLine="%CR;%LF;"
            representation="text"
            separator=":" 
            separatorPosition="infix"
            separatorSuppressionPolicy="never"  
            sequenceKind="ordered" 
            terminator=""   
            textBidi="no" 
            textNumberCheckPolicy="strict"
            textNumberPattern="#,##0.###;-#,##0.###" 
            textNumberRep="standard" 
            textNumberRounding="explicit"  
            textNumberRoundingIncrement="0"
            textNumberRoundingMode="roundUnnecessary" 
            textOutputMinLength="0" 
            textPadKind="none" 
            textStandardBase="10"
            textStandardExponentRep="E"
            textStandardInfinityRep="Inf"  
            textStandardNaNRep="NaN"
            textStandardZeroRep="0" 
            textStandardGroupingSeparator="," 
            textTrimKind="none" 
            trailingSkip="0" 
            truncateSpecifiedLengthString="no" 
            utf16Width="fixed" 
        />
    </xs:appinfo>
</xs:annotation>

<xs:element name="really-simple-format">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="label" type="xs:string" />
            <xs:element name="message" type="xs:string" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

------------------------------------
    Mix Approach
------------------------------------

<xs:annotation>
    <xs:appinfo source="http://www.ogf.org/dfdl/";>
        <dfdl:format  
            alignment="1" 
            alignmentUnits="bytes"  
            binaryFloatRep="ieee" 
            binaryNumberRep="binary"  
            bitOrder="mostSignificantBitFirst"
            byteOrder="bigEndian"  
            calendarPatternKind="implicit"
            documentFinalTerminatorCanBeMissing="yes" 
            emptyValueDelimiterPolicy="none"
            encoding="ISO-8859-1"
            encodingErrorPolicy="replace" 
            escapeSchemeRef=""  
            fillByte="f" 
            floating="no" 
            ignoreCase="no" 
            initiator="" 
            initiatedContent="no" 
            leadingSkip="0" 
            lengthKind="delimited"
            lengthUnits="bits"  
            nilKind="literalValue"  
            nilValueDelimiterPolicy="none"
            occursCountKind="implicit"
            outputNewLine="%CR;%LF;"
            representation="text" 
            separatorSuppressionPolicy="never"  
            sequenceKind="ordered" 
            terminator=""   
            textBidi="no" 
            textNumberCheckPolicy="strict"
            textNumberPattern="#,##0.###;-#,##0.###" 
            textNumberRep="standard" 
            textNumberRounding="explicit"  
            textNumberRoundingIncrement="0"
            textNumberRoundingMode="roundUnnecessary" 
            textOutputMinLength="0" 
            textPadKind="none" 
            textStandardBase="10"
            textStandardExponentRep="E"
            textStandardInfinityRep="Inf"  
            textStandardNaNRep="NaN"
            textStandardZeroRep="0" 
            textStandardGroupingSeparator="," 
            textTrimKind="none" 
            trailingSkip="0" 
            truncateSpecifiedLengthString="no" 
            utf16Width="fixed" 
        />
    </xs:appinfo>
</xs:annotation>

<xs:element name="really-simple-format">
    <xs:complexType>
        <xs:sequence dfdl:separator=":" dfdl:separatorPosition="infix">
            <xs:element name="label" type="xs:string" />
            <xs:element name="message" type="xs:string" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

Reply via email to