Maybe. There are often many ways to model the same thing in DFDL, and which is 
better....


I think "blank lines between" conceptually doesn't match "trailing".


If you want to match any number of blank lines between rows, I've done this in 
the past with a hidden group containing

an array element named "emptyLine".


So each record is up to the first NL, then array of zero or more emptyline in 
hidden group.


This is "modeling syntax as data", but since it's tucked into a hidden group, 
doesn't clutter the logical model.


An advantage here... if you want to be able to unparse the data preserving 
those blank lines, then just make the group non-hidden.


On the other hand, if you want to cannonicalize the data (strip out any extra 
blank lines), then hide the group.

________________________________
From: Costello, Roger L. <[email protected]>
Sent: Friday, November 30, 2018 10:15:22 AM
To: [email protected]
Subject: Here's how to enable an arbitrary number of newlines between rows!


A few days ago Mike wrote:



trailingEmpty is really "trailing empty lax"  … any number of trailing 
separators will be accepted.



Ah! That can be used to enable any number of newlines between rows!



Here is an input where sometimes there is one NL between rows, sometimes there 
are two NL’s between rows, and sometimes there are four NL’s between rows:



[cid:[email protected]]



The combination of



dfdl:separator="%NL;"



and



dfdl:separatorSuppressionPolicy="trailingEmpty"



enables this functionality.



The below DFDL schema works great for any number of NL’s between rows.



Do you agree that the way to implement the “arbitrary number of NL’s between 
rows” capability is by using trailingEmpty?  /Roger



<xs:element name="really-simple-format">
    <xs:complexType>
        <xs:sequence dfdl:separator="%NL;"
                        dfdl:separatorPosition="infix"
                        dfdl:separatorSuppressionPolicy="trailingEmpty">
            <xs:element name="row" maxOccurs="unbounded">
                <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>
        </xs:sequence>
    </xs:complexType>
</xs:element>






Reply via email to