You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2018/11/26 18:35:45 UTC
DFDL schema for input file with rows separated by one or more
newlines?
Hello DFDL community,
I have an input file containing a sequence of rows, separated by one or more newlines, for example:
[cid:image002.png@01D4858C.EE9ED7D0]
If I assume that there are no more than 3 newlines between rows, then this works:
<xs:sequence dfdl:separator="%NL; %NL;%NL; %NL;%NL;%NL;"
dfdl:separatorPosition="infix"
dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
Of course, if the input contains 4 newlines between rows, then it breaks.
I guess, the following is not legal, right?
dfdl:separator="%NL;+?"
Is there a more robust solution?
Below is my DFDL schema.
/Roger
<xs:element name="really-simple-format">
<xs:complexType>
<xs:sequence dfdl:separator="%NL; %NL;%NL; %NL;%NL;%NL;"
dfdl:separatorPosition="infix"
dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
<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>
Re: DFDL schema for input file with rows separated by one or more
newlines?
Posted by Mike Beckerle <mb...@tresys.com>.
I think NL* NL+ are both reasonable suggestions. But no, today there is nothing like that.
Already on the 'we also need this' list is LSP, LSP*, LSP+ which is whitespace but NOT including line-endings. I.e.., Linear (as in within a line) whitespace.
Reverse engineering data out of human-authored documents is not DFDL's forte. I've done it quite a bit, but DFDL is not the ideal kit for that work.
________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Monday, November 26, 2018 1:35:45 PM
To: users@daffodil.apache.org
Subject: DFDL schema for input file with rows separated by one or more newlines?
Hello DFDL community,
I have an input file containing a sequence of rows, separated by one or more newlines, for example:
[cid:image002.png@01D4858C.EE9ED7D0]
If I assume that there are no more than 3 newlines between rows, then this works:
<xs:sequence dfdl:separator="%NL; %NL;%NL; %NL;%NL;%NL;"
dfdl:separatorPosition="infix"
dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
Of course, if the input contains 4 newlines between rows, then it breaks.
I guess, the following is not legal, right?
dfdl:separator="%NL;+?"
Is there a more robust solution?
Below is my DFDL schema.
/Roger
<xs:element name="really-simple-format">
<xs:complexType>
<xs:sequence dfdl:separator="%NL; %NL;%NL; %NL;%NL;%NL;"
dfdl:separatorPosition="infix"
dfdl:separatorSuppressionPolicy="trailingEmptyStrict">
<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>