Skip to content

Commit

Permalink
Correct interchange sequence in schema XSD, X12 control schema updates
Browse files Browse the repository at this point in the history
- Set TA1 max occurrences to 99,9999
- Declare transactions outside of group as prohibited, adjust test
  • Loading branch information
MikeEdgar committed Jun 10, 2020
1 parent f9b6528 commit 359f90a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/main/resources/X12/v00200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

<interchange header="ISA" trailer="IEA">
<sequence>
<segment type="TA1" maxOccurs="1" />
<segment type="TA1" maxOccurs="99999" />

<group header="GS" trailer="GE">
<transaction header="ST" trailer="SE" />
</group>

<transaction header="ST" trailer="SE" use="prohibited" />
</sequence>
</interchange>

Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/X12/v00402.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

<interchange header="ISA" trailer="IEA">
<sequence>
<segment type="TA1" maxOccurs="1" />
<segment type="TA1" maxOccurs="99999" />

<group header="GS" trailer="GE">
<transaction header="ST" trailer="SE" />
</group>

<transaction header="ST" trailer="SE" use="prohibited" />
</sequence>
</interchange>

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/schema/EDISchema-v4.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@
<sequence>
<element name="sequence">
<complexType>
<choice maxOccurs="unbounded">
<element name="segment" type="tns:segmentStandard" minOccurs="0"/>
<sequence>
<element name="segment" type="tns:segmentStandard" minOccurs="0" maxOccurs="unbounded"/>
<element name="group" type="tns:groupControlType" minOccurs="0"/>
<element name="transaction" type="tns:transactionControlType" minOccurs="0"/>
</choice>
</sequence>
</complexType>
</element>
</sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,9 @@ void testValidatedSegmentTags() throws EDISchemaException, EDIStreamException {
writeHeader(writer);
EDIValidationException e = assertThrows(EDIValidationException.class, () -> writer.writeStartSegment("ST"));
assertEquals(EDIStreamEvent.SEGMENT_ERROR, e.getEvent());
assertEquals(EDIStreamValidationError.UNEXPECTED_SEGMENT, e.getError());
assertEquals(EDIStreamValidationError.LOOP_OCCURS_OVER_MAXIMUM_TIMES, e.getError());
assertEquals("ST", e.getData().toString());
assertEquals("ST", e.getLocation().getSegmentTag());
assertEquals(2, e.getLocation().getSegmentPosition());
}

Expand Down

0 comments on commit 359f90a

Please sign in to comment.