EDIReader is a Java package for parsing business documents structured according to EDI (Electronic Data Interchange) standards.
It supports the SAX and JAXP interfaces defined for XML, making it suitable for use in any XML-based system that allows the configuration of a custom SAX parser.
EDIReader parses EDI analogous to the way a conventional SAX parser parses XML, calling an arbitrary JAXP ContentHandler with elements and attributes as if it were parsing XML. Therefore, XSLT transformations and DOM-based tools can be applied directly to EDI input.
In many cases, EDIReader and an XSLT stylesheet provide a lightweight and open source alternative to conventional EDI mapper/translators.
Capturing an XML expression of the parsed EDI data is simple with EDIReader, and an EDItoXML utility is included as a demonstration program.
EDIReader is not a conventional EDI mapper/translator, nor by itself a replacement for one. Its purpose is to allow EDI input into a wide variety of XML-based systems so that tools used to transform and otherwise process XML-structured data can be applied to EDI as well. It requires no more configuration than any SAX parser, which is virtually none.
A design goal is to build in as much EDI awareness as is necessary to do its job and no more. Therefore, it handles all of the issues of EDI syntax so that XML tools such as XSLT can be applied to the issues of EDI structure and semantics. Since it does not need to perform full EDI compliance checking, it requires no tables of code values and the like to be installed and updated for particular EDI standards and versions.
Here are some key features of "EDIReader":
· Dynamic standard recognition - the parser differentiates between ANSI X.12 and EDIFACT EDI standards by inspection and uses a factory pattern to construct an appropriate parser subclass.
· Extensible - additional EDI standards can be supported by developing new subclasses.
· Checks for well-formed EDI syntax - EDIReader checks the basic syntactic correctness of the EDI structures according to the rules defined by ANSI X.12 or EDIFACT. This includes proper enveloping, embedded counts of segments and groups, and control number correspondence.
· Easily embedded - the parser can be embedded within your Java application in the same way as you would an XML parser, avoiding the file-based and proprietary interfaces often used with conventional EDI translators.
· Efficient - a single-pass algorithm is used to quickly and efficiently parse the EDI structures.
· Flexible segment terminator handling - EDIReader dynamically identifies the segment terminator character used with each individual EDI interchange. Special characters such as CR and LF may be used as segment terminators, and they may optionally appear after each segment following the formal segment terminator. With EDIReader it is not necessary to configure the terminator before the EDI data is parsed.
· Generation of Functional Acknowledgments - EDIReader can generate EDI function acknowledgments for the function groups within an ANSI X12 interchange as a by-product of parsing.
EDIReader can be enhanced with document-specific plugins that correspond to specific transaction sets (using ANSI terminology) or messages (using EDIFACT terminology). Plugins are optional and allow the parser to recognize segment groups and the way in which these groups are nested and repeated.
The XML generated by EDIReader reflects the segment grouping when a plugin is available, which is particularly useful when mapping EDI documents using XSLT.
Plugins for specific document types are available from BerryWorks Software, and several popular ones are included in the GPL version:
· ANSI 824 - Application Advice
· ANSI 835 - Health Care Claim Payment/Advice
· ANSI 837 - Health Care Claim
· EDIFACT MSCONS - Metered Services Consumption Report
· EDIFACT UTILMD - Utilities Master Data