Skip to content

Commit

Permalink
Correct example
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeEdgar committed Oct 26, 2019
1 parent 7b30531 commit c6d3148
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,38 +88,39 @@ InputStream stream = new FileInputStream(...);
EDIStreamReader reader = factory.createEDIStreamReader(stream);

while (reader.hasNext()) {
switch (reader.next()) {
case Events.START_INTERCHANGE:
/* Retrieve the standard - "X12" or "EDIFACT" */
String standard = reader.getStandard();
/*-
* Retrieve the version string array. An array is used to support
* the componentized version element used in the EDIFACT standard.
*
* e.g. [ "00501" ] (X12) or [ "UNOA", "3" ] (EDIFACT)
*/
String[] version = reader.getVersion();
break;

case Events.START_SEGMENT:
// Retrieve the segment name - e.g. "ISA" (X12) or "UNB" (EDIFACT)
String segmentName = reader.getText();
break;

case Events.END_SEGMENT:
break;

case Events.START_COMPOSITE:
break;

case Events.END_COMPOSITE:
break;

case Events.ELEMENT_DATA:
// Retrieve the value of the current element
String data = reader.getText();
break;
}
switch (reader.next()) {
case START_INTERCHANGE:
/* Retrieve the standard - "X12" or "EDIFACT" */
String standard = reader.getStandard();

/*
* Retrieve the version string array. An array is used to support
* the componentized version element used in the EDIFACT standard.
*
* e.g. [ "00501" ] (X12) or [ "UNOA", "3" ] (EDIFACT)
*/
String[] version = reader.getVersion();
break;

case START_SEGMENT:
// Retrieve the segment name - e.g. "ISA" (X12) or "UNB" (EDIFACT)
String segmentName = reader.getText();
break;

case END_SEGMENT:
break;

case START_COMPOSITE:
break;

case END_COMPOSITE:
break;

case ELEMENT_DATA:
// Retrieve the value of the current element
String data = reader.getText();
break;
}
}

reader.close();
Expand Down

0 comments on commit c6d3148

Please sign in to comment.