Skip to content

Parsing edi file with interchange & transaction message => jaxb #249

Answered by MikeEdgar
vadim-trotno asked this question in Q&A
Discussion options

You must be logged in to vote

@vadim-trotno You can accomplish this using an EDIStreamFilter. After you build the EDIStreamReader, you can wrap it with a filter that will set the schema at the relevant event. This will intercept the reader as it feeds EDI data into the XML reader that was also created from the factory.

EDIStreamReader reader = factory.createEDIStreamReader(stream);
EDIStreamFilter filter = new MyCustomFilter();
EDIStreamReader filteredReader = factory.createFilteredReader(reader, filter);
class MyCustomFilter implements EDIStreamFilter {
  public boolean accept(EDIStreamReader reader) {
    if (reader.getEventType() == EDIStreamEvent.START_TRANSACTION) {
      SchemaFactory schemaFactory = SchemaFactory.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vadim-trotno
Comment options

Answer selected by vadim-trotno
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants