| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <tdml:testSuite suiteName="Sequence Groups" |
| description="Section 14 - Sequence Groups with Delimiters" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" |
| xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ct="http://w3.ibm.com/xmlns/dfdl/ctInfoset" |
| xmlns:ex="http://example.com" |
| xmlns:tns="http://example.com" |
| defaultRoundTrip="true"> |
| |
| <tdml:defineSchema name="SequenceGroupDelimiters-Embedded.dfdl.xsd"> |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" leadingSkip="0" trailingSkip="0" separator="" |
| encoding="utf-8" occursCountKind="parsed" separatorSuppressionPolicy="anyEmpty" |
| textNumberRep="standard" ignoreCase="no" representation="text" |
| lengthUnits="characters" lengthKind="delimited" /> |
| |
| <xs:element name="SG_01" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator=":: || : $"> |
| <xs:element name="seq1"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator=","> |
| <xs:element name="num1" type="xs:int" |
| maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| <xs:element name="seq2"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator="."> |
| <xs:element name="num2" type="xs:int" |
| maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| <xs:element name="seq3"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator=";"> |
| <xs:element name="num3" type="xs:int" |
| maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| <xs:element name="seq4"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator="|"> |
| <xs:element name="num4" type="xs:int" |
| maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="SG_02" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separatorPosition="infix" |
| dfdl:separator=","> |
| <xs:element name="s1" type="xs:int" maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="SG_03" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separatorPosition="infix" |
| dfdl:separator=", ,, ,,,"> |
| <xs:element name="s1" type="xs:int" maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="SG_04" dfdl:lengthKind="delimited"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator=""> |
| <xs:element name="s1" type="xs:string" |
| dfdl:lengthKind="explicit" dfdl:length="3" /> |
| <xs:element name="s2" type="xs:string" |
| dfdl:lengthKind="explicit" dfdl:length="4" /> |
| <xs:element name="s3" type="xs:string" |
| dfdl:lengthKind="explicit" dfdl:length="5" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="SeqGrp_01" |
| model="SequenceGroupDelimiters-Embedded.dfdl.xsd" |
| description="Section 14 Sequence groups with delimiters, a whitespace separated list for separator - DFDL-14-008R" |
| root="SG_01" |
| roundTrip="twoPass"> |
| <tdml:document><![CDATA[1,2,3,4:5.6.7.8$9;10;11;12::13|14|15|16]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| <SG_01> |
| <seq1> |
| <num1>1</num1> |
| <num1>2</num1> |
| <num1>3</num1> |
| <num1>4</num1> |
| </seq1> |
| <seq2> |
| <num2>5</num2> |
| <num2>6</num2> |
| <num2>7</num2> |
| <num2>8</num2> |
| </seq2> |
| <seq3> |
| <num3>9</num3> |
| <num3>10</num3> |
| <num3>11</num3> |
| <num3>12</num3> |
| </seq3> |
| <seq4> |
| <num4>13</num4> |
| <num4>14</num4> |
| <num4>15</num4> |
| <num4>16</num4> |
| </seq4> |
| </SG_01> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="SeqGrp_02" root="SG_02" |
| model="SequenceGroupDelimiters-Embedded.dfdl.xsd" |
| description="Section 14 Sequence groups with delimiters -negative test -DFDL-14-008R"> |
| |
| <tdml:document><![CDATA[,]]></tdml:document> |
| <tdml:errors> |
| <tdml:error /> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="SeqGrp_03" root="SG_03" |
| model="SequenceGroupDelimiters-Embedded.dfdl.xsd" |
| description="Section 14 Sequence groups with delimiters -multiple separators - DFDL-14-008R" |
| roundTrip="twoPass"> |
| |
| <tdml:document><![CDATA[1,,2,,,3,4]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| <SG_03> |
| <s1>1</s1> |
| <s1>2</s1> |
| <s1>3</s1> |
| <s1>4</s1> |
| </SG_03> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="SeqGrp_04" root="SG_04" |
| model="SequenceGroupDelimiters-Embedded.dfdl.xsd" |
| description="Section 14 Sequence groups with delimiters -empty string separator - DFDL-14-008R"> |
| |
| <tdml:document><![CDATA[abcdefghijkl]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| <SG_04> |
| <s1>abc</s1> |
| <s2>defg</s2> |
| <s3>hijkl</s3> |
| </SG_04> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| |
| <tdml:defineSchema name="dfdlPrefix.xsd"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" encoding="utf-8" byteOrder="bigEndian" |
| occursCountKind="parsed" ignoreCase="no" representation="text" |
| lengthKind="delimited" separatorSuppressionPolicy="anyEmpty" |
| initiatedContent="no" documentFinalTerminatorCanBeMissing="yes" /> |
| |
| <xs:element name="description" type="xs:string" /> |
| <xs:element name="comment" type="xs:string" /> |
| <xs:element name="quantity" type="xs:int" /> |
| <xs:element name="price" type="xs:float" /> |
| |
| <xs:element name="list" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="||" |
| dfdl:separatorPosition="prefix"> |
| <xs:element name="Item" dfdl:lengthKind="delimited" |
| type="xs:string" maxOccurs="unbounded" minOccurs="0"> |
| </xs:element> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="list_01" dfdl:lengthKind="delimited"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="Start" |
| dfdl:separatorPosition="prefix"> |
| <xs:element name="Item" dfdl:lengthKind="delimited" |
| maxOccurs="unbounded" minOccurs="0"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator=":" |
| dfdl:separatorPosition="prefix"> |
| <xs:element ref="ex:description" /> |
| <xs:element ref="ex:comment" /> |
| <xs:element ref="ex:quantity" /> |
| <xs:element ref="ex:price" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="NS_02"> |
| <xs:complexType> |
| <xs:sequence dfdl:initiatedContent="no" |
| dfdl:separatorPosition="infix" dfdl:separator="," |
| dfdl:separatorSuppressionPolicy="never" dfdl:terminator="%NL;"> |
| <xs:element name="num" type="xs:int" maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="prefix" root="list" |
| model="dfdlPrefix.xsd" description="separatorPosition is prefix - DFDL-14-009R"> |
| |
| <tdml:document><![CDATA[||Shirts,Sold on Monday,30,$17.99||Shoes,Sold on Tuesday,23,$89.99]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <list> |
| <Item>Shirts,Sold on Monday,30,$17.99</Item> |
| <Item>Shoes,Sold on Tuesday,23,$89.99</Item> |
| </list> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="prefix_01" root="list_01" |
| model="dfdlPrefix.xsd" description="separatorPosition is prefix - DFDL-14-009R"> |
| |
| <tdml:document><![CDATA[Start:Shirts:Sold on Monday:30:17.99Start:Shoes:Sold on Tuesday:23:89.99]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <list_01> |
| <Item> |
| <description>Shirts</description> |
| <comment>Sold on Monday</comment> |
| <quantity>30</quantity> |
| <price>17.99</price> |
| </Item> |
| <Item> |
| <description>Shoes</description> |
| <comment>Sold on Tuesday</comment> |
| <quantity>23</quantity> |
| <price>89.99</price> |
| </Item> |
| </list_01> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="NumSeq_02" root="NS_02" |
| model="dfdlPrefix.xsd" |
| description="Schema definition error for occursCountKind 'parsed' with separatorPolicy 'required' (or separatorSuppressionPolicy 'never')."> |
| |
| <tdml:document><![CDATA[1,2,3,4,5,6 |
| ]]></tdml:document> |
| <tdml:errors> |
| <tdml:error></tdml:error> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="groupRefInheritProps.xsd"> |
| |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" encoding="utf-8" byteOrder="bigEndian" |
| occursCountKind="parsed" ignoreCase="no" representation="text" |
| lengthKind="delimited" textNumberRep="standard" separatorSuppressionPolicy="anyEmpty" |
| initiatedContent="no" /> |
| |
| <xs:element name="description" type="xs:string" /> |
| <xs:element name="comment" type="xs:string" /> |
| <xs:element name="quantity" type="xs:int" /> |
| <xs:element name="price" type="xs:float" /> |
| |
| <xs:group name="namedGroup"> |
| <xs:sequence dfdl:separatorPosition="infix"> |
| <xs:element ref="ex:description" /> |
| <xs:element ref="ex:comment" /> |
| <xs:element ref="ex:quantity" /> |
| <xs:element ref="ex:price" dfdl:initiator="$" /> |
| </xs:sequence> |
| </xs:group> |
| |
| <xs:element name="Item" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| |
| <xs:group ref="ex:namedGroup" dfdl:separator="," /> |
| |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="list" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="||" |
| dfdl:separatorPosition="infix"> |
| <xs:element ref="ex:Item" maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="groupRefInheritProps" |
| root="list" model="groupRefInheritProps.xsd" |
| description="separator defined on a group reference - DFDL-14-008R" |
| roundTrip="false"> |
| |
| <tdml:document><![CDATA[Shirts,Sold on Monday,30,$17.99||Shoes,Sold on Tuesday,23,$89.99]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <list> |
| <Item> |
| <description>Shirts</description> |
| <comment>Sold on Monday</comment> |
| <quantity>30</quantity> |
| <price>17.99</price> |
| </Item> |
| <Item> |
| <description>Shoes</description> |
| <comment>Sold on Tuesday</comment> |
| <quantity>23</quantity> |
| <price>89.99</price> |
| </Item> |
| </list> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="sequenceWithinSequence.xsd"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" encoding="utf-8" byteOrder="bigEndian" |
| occursCountKind="parsed" ignoreCase="no" representation="text" |
| lengthKind="delimited" textNumberRep="standard" separatorSuppressionPolicy="anyEmpty" |
| initiatedContent="no" /> |
| |
| <xs:element name="description" type="xs:string" /> |
| <xs:element name="comment" type="xs:string" /> |
| <xs:element name="quantity" type="xs:int" /> |
| <xs:element name="price" type="xs:float" /> |
| |
| <xs:element name="Item" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="," |
| dfdl:separatorPosition="infix"> |
| <xs:element ref="ex:description" /> |
| <xs:element ref="ex:comment" /> |
| <xs:sequence dfdl:separator="," |
| dfdl:separatorPosition="infix"> |
| <xs:element ref="ex:quantity" /> |
| <xs:element ref="ex:price" dfdl:initiator="$" /> |
| </xs:sequence> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="list" dfdl:lengthKind="implicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="||" |
| dfdl:separatorPosition="infix"> |
| <xs:element ref="ex:Item" maxOccurs="unbounded" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="sequenceWithinSequence" |
| root="list" model="sequenceWithinSequence.xsd" |
| description="nested delimited sequences, infix separators - DFDL-14-008R"> |
| |
| <tdml:document><![CDATA[Shirts,Sold on Monday,30,$17.99||Shoes,Sold on Tuesday,23,$89.99]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <list> |
| <Item> |
| <description>Shirts</description> |
| <comment>Sold on Monday</comment> |
| <quantity>30</quantity> |
| <price>17.99</price> |
| </Item> |
| <Item> |
| <description>Shoes</description> |
| <comment>Sold on Tuesday</comment> |
| <quantity>23</quantity> |
| <price>89.99</price> |
| </Item> |
| </list> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="nextInitNotDelim"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" encoding="utf-8" byteOrder="bigEndian" |
| occursCountKind="parsed" ignoreCase="no" representation="text" |
| lengthKind="delimited" textNumberRep="standard" |
| initiatedContent="no" /> |
| |
| <xs:element name="elem"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator=""> |
| <xs:element name="quantity" type="xs:int"/> |
| <xs:element name="item" type="xs:string" dfdl:initiator="Item:%SP;" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <!-- |
| Test name: delimitedByNextInitFail |
| Schema: nextInitNotDelim |
| Purpose: This test demonstrates that the next element's initiator is not a sufficient |
| delimiter for an element of lengthKind "delimited" |
| --> |
| |
| <tdml:parserTestCase name="delimitedByNextInitFail" root="elem" model="nextInitNotDelim" |
| description=""> |
| |
| <tdml:document><![CDATA[450Item: Shirts]]></tdml:document> |
| <tdml:errors> |
| <tdml:error>Parse Error</tdml:error> |
| <tdml:error>xs:int</tdml:error> |
| <tdml:error>Unable to parse</tdml:error> |
| <tdml:error>450Item: Shirts</tdml:error> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="lastElts"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" initiator="" |
| terminator="" encoding="utf-8" byteOrder="bigEndian" |
| occursCountKind="implicit" ignoreCase="no" representation="text" |
| lengthKind="delimited" textNumberRep="standard" initiatedContent="no" |
| textTrimKind="none" textStringPadCharacter="%SP;" textNumberPadCharacter="%SP;" |
| textStringJustification="center" textNumberJustification="right" |
| truncateSpecifiedLengthString="no"/> |
| |
| <xs:group name="lastElts"> |
| <!-- DFDL badly needs %SP+; and %S+; the latter meaning whitespace other than line endings. --> |
| <xs:sequence dfdl:separator="%SP; %SP;%SP; %SP;%SP;%SP; %SP;%SP;%SP;%SP; %SP;%SP;%SP;%SP;%SP; %SP;%SP;%SP;%SP;%SP;%SP;" |
| dfdl:terminator="%NL;"> |
| |
| <xs:element name="code" type="xs:string" |
| dfdl:lengthKind="delimited" /> |
| <xs:element name="another" type="xs:string" |
| dfdl:lengthKind="delimited" minOccurs="0"/> |
| <xs:element name="note" minOccurs="0" type="xs:string" |
| dfdl:lengthKind="pattern" dfdl:lengthPattern=".{0,30}(?=\n)"/> |
| </xs:sequence> |
| </xs:group> |
| |
| <xs:element name="testLastElts"> |
| <xs:complexType> |
| <xs:group ref="tns:lastElts" /> |
| </xs:complexType> |
| </xs:element> |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="lastElts" root="testLastElts" |
| model="lastElts" description="test for last optional element contains the separator, but is not escaped." |
| roundTrip="twoPass"> |
| |
| <tdml:document> |
| <tdml:documentPart type="text"><![CDATA[G2 R1 |
| ]]></tdml:documentPart> |
| </tdml:document> |
| |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:testLastElts> |
| <tns:code>G2</tns:code> |
| <tns:another>R1</tns:another> |
| </tns:testLastElts> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="delimiterScanning"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" lengthKind="implicit" separatorPosition="infix" /> |
| |
| <xs:element name="explicit"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator=";"> |
| <xs:element name="foo" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" /> |
| <xs:sequence dfdl:separator =","> |
| <xs:element name="bar" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" /> |
| <xs:element name="baz" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" /> |
| </xs:sequence> |
| <xs:element name="qux" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="delimited"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator=";"> |
| <xs:element name="foo" type="xs:string" dfdl:lengthKind="delimited" /> |
| <xs:sequence dfdl:separator =","> |
| <xs:element name="bar" type="xs:string" dfdl:lengthKind="delimited" /> |
| <xs:element name="baz" type="xs:string" dfdl:lengthKind="delimited" /> |
| </xs:sequence> |
| <xs:element name="qux" type="xs:string" dfdl:lengthKind="delimited" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="delimiterScanning_01" root="explicit" |
| model="delimiterScanning" description="test for correct delimiter scanning"> |
| |
| <tdml:document> |
| <tdml:documentPart type="text"><![CDATA[foo;bar,b,z;qux]]></tdml:documentPart> |
| </tdml:document> |
| |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:explicit> |
| <tns:foo>foo</tns:foo> |
| <tns:bar>bar</tns:bar> |
| <tns:baz>b,z</tns:baz> |
| <tns:qux>qux</tns:qux> |
| </tns:explicit> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="delimiterScanning_02" root="explicit" |
| model="delimiterScanning" description="test for correct delimiter scanning"> |
| |
| <tdml:document> |
| <tdml:documentPart type="text"><![CDATA[foo;bar,b,z,qux]]></tdml:documentPart> |
| </tdml:document> |
| |
| <tdml:errors> |
| <tdml:error>Parse Error</tdml:error> |
| <tdml:error>Failed to parse infix separator</tdml:error> |
| <tdml:error>Separator ';' not found</tdml:error> |
| </tdml:errors> |
| |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="delimiterScanning_03" root="delimited" |
| model="delimiterScanning" description="test for correct delimiter scanning. We should not scan for or find the second comma since bar is the last in the infix separated sequence"> |
| |
| <tdml:document> |
| <tdml:documentPart type="text"><![CDATA[foo;bar,b,z;qux]]></tdml:documentPart> |
| </tdml:document> |
| |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:delimited> |
| <tns:foo>foo</tns:foo> |
| <tns:bar>bar</tns:bar> |
| <tns:baz>b,z</tns:baz> |
| <tns:qux>qux</tns:qux> |
| </tns:delimited> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| |
| </tdml:parserTestCase> |
| |
| <tdml:defineSchema name="separatorSuppressionPolicy"> |
| |
| <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/> |
| <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited" outputNewLine="%CR;%LF;"/> |
| |
| <xs:element name="policyNever"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="%NL;" dfdl:sequenceKind="ordered" dfdl:separatorSuppressionPolicy="never"> |
| <xs:element name="A" type="xs:string" minOccurs="0" dfdl:occursCountKind="implicit" /> |
| <xs:element name="B" type="xs:string" minOccurs="0" dfdl:occursCountKind="implicit" /> |
| <xs:element name="C" type="xs:string" minOccurs="0" dfdl:occursCountKind="implicit" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="policyNeverOptionalStringArray"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="," dfdl:sequenceKind="ordered" dfdl:separatorSuppressionPolicy="never"> |
| <xs:element name="A" type="xs:string" minOccurs="0" maxOccurs="5" dfdl:occursCountKind="implicit" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| <xs:element name="policyNeverOptionalIntArray"> |
| <xs:complexType> |
| <xs:sequence dfdl:separator="," dfdl:sequenceKind="ordered" dfdl:separatorSuppressionPolicy="never"> |
| <xs:element name="A" type="xs:int" minOccurs="0" maxOccurs="5" dfdl:occursCountKind="implicit" /> |
| </xs:sequence> |
| </xs:complexType> |
| </xs:element> |
| |
| </tdml:defineSchema> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never" model="separatorSuppressionPolicy"> |
| <tdml:document> |
| <tdml:documentPart type="text" |
| replaceDFDLEntities="true"><![CDATA[Hello%CR;%LF;world%CR;%LF;]]></tdml:documentPart> |
| </tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:policyNever> |
| <tns:A>Hello</tns:A> |
| <tns:B>world</tns:B> |
| </tns:policyNever> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalStringArray_1" model="separatorSuppressionPolicy"> |
| <tdml:document><![CDATA[1,2,3,4,5]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:policyNeverOptionalStringArray> |
| <A>1</A> |
| <A>2</A> |
| <A>3</A> |
| <A>4</A> |
| <A>5</A> |
| </tns:policyNeverOptionalStringArray> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalStringArray_2" model="separatorSuppressionPolicy"> |
| <tdml:document><![CDATA[,,,,]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:policyNeverOptionalStringArray /> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalStringArray_3" model="separatorSuppressionPolicy" root="policyNeverOptionalStringArray"> |
| <tdml:document><![CDATA[,,,]]></tdml:document> |
| <tdml:errors> |
| <tdml:error>Parse Error</tdml:error> |
| <tdml:error>maxOccurs</tdml:error> |
| <tdml:error>required</tdml:error> |
| <tdml:error>separatorSuppressionPolicy</tdml:error> |
| <tdml:error>never</tdml:error> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalIntArray_1" model="separatorSuppressionPolicy"> |
| <tdml:document><![CDATA[1,2,3,4,5]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:policyNeverOptionalIntArray> |
| <A>1</A> |
| <A>2</A> |
| <A>3</A> |
| <A>4</A> |
| <A>5</A> |
| </tns:policyNeverOptionalIntArray> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalIntArray_2" model="separatorSuppressionPolicy"> |
| <tdml:document><![CDATA[,,,,]]></tdml:document> |
| <tdml:infoset> |
| <tdml:dfdlInfoset> |
| <tns:policyNeverOptionalIntArray /> |
| </tdml:dfdlInfoset> |
| </tdml:infoset> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalIntArray_3" model="separatorSuppressionPolicy" root="policyNeverOptionalIntArray"> |
| <tdml:document><![CDATA[1,a,3,4,5]]></tdml:document> |
| <tdml:errors> |
| <tdml:error>Parse Error</tdml:error> |
| <tdml:error>maxOccurs</tdml:error> |
| <tdml:error>required</tdml:error> |
| <tdml:error>separatorSuppressionPolicy</tdml:error> |
| <tdml:error>never</tdml:error> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| <tdml:parserTestCase name="separatorSuppressionPolicy_never_optionalIntArray_4" model="separatorSuppressionPolicy" root="policyNeverOptionalIntArray"> |
| <tdml:document><![CDATA[1,2,3,4]]></tdml:document> |
| <tdml:errors> |
| <tdml:error>Parse Error</tdml:error> |
| <tdml:error>maxOccurs</tdml:error> |
| <tdml:error>required</tdml:error> |
| <tdml:error>separatorSuppressionPolicy</tdml:error> |
| <tdml:error>never</tdml:error> |
| </tdml:errors> |
| </tdml:parserTestCase> |
| |
| </tdml:testSuite> |