Package com.adaptris.adapter.edistream.process
Top level classes that perform the transformation process of EDI to XML and XML to EDI.
Advantages and features of the edi stream component:
- Loosely coupled classes, no need for rebuilding should a msg require different parsing settings
- Uses stax parsing for xml - reduces processing overhead by only processing what we are interesting in and keep memory overhead low
- Output file generation is also streaming, so the output is generated as we parse the input file
- The process of generating the output can be put in a separate thread for increased performance if need be
- Validation of edi supported and can be easily configured as required
- Parser Registry - a number of gxmls can be loaded, so a single instance of this adapter can process a number of different msgs
- XML tags used in the input parsing and output formatting are configurable
- Charset encoding on the input and output can be specified
- Edi separators used in input parsing and output formatting are configurable
- The triming of whitespace from the data content of the document is configurable
- New and old gXml formats are supported (upto v0.8), the system can automatically determine the gxml file version and parse it without the need of a config flag
- EDIFACT UNA segment processing - edi separators can be configured dynamically from the present of this segment
- EDIFACT UNB charset processing (redmineID=407) - the charset of the input document can be detected and set automatically based on the syntax field of the UNB segment ie UNOA/UNOB etc
- Auto detection of the message name, version and standard from the input EDI document
- Support for EDIFACT, X12 and TRADACOMMS
Context diagram for component
The component has two main functions:
- Take an Edi file and create a XML file representation of it using the Edi message structure definition - gXml
- Take a XML file and create an Edi file of it using the Edi message structure definition - gXml
Component overview of the Edi Stream parser component
The diagram has been split into three parts:
- Bottom layer - parsing layer - all data coming into the system is parsed in by a parser
- Middle layer - processing layer - performs the transformation of the data
- Output layer - converts the internal data structure into the specified output format, this could be modified to run on a separate thread to boast performance
- Processing layer:
- Xml2EdiProcessor - main class responsible for driving the conversion of the XML file to Edi
- Edi2XmlProcessor - main class responsible for driving the conversion of the Edi file to Xml
- ParsingRulesRegistry - responsible for loading and holding gXml data
- ParsingRulesNavigator - key parsing class, identifies a rule for the current item being parsed. Also maintains the current parsing position, and informs listeners of parsing progress.
- Parsing Layer:
- Xml parsers - gXml and XML encoded edi
- The parsers are based on a Stax pattern where each xml element is associated with its own parser class. There is a parser for each element type.
- A single class parses the Edi document, it uses the StreamParser from the old Edi component to tokenize the input stream
- Validation:
- Validation can be configured by linking in the EdiValidator object.
- This class listens to parsing events and verifies the document as it is parsed
- It builds up a list of issues which are then queried on parsing completion
-
Class Summary Class Description EDI2XMLProcessor Main processing class overseeing the conversion of a EDI file to a XML encoded EDI file.EdiStreamCommonProcessor Encapsulates common functionality for both processors: EDI2XML and XML2EDIXML2EDIProcessor Main processing class overseeing the conversion of a XML encoding EDI file to an EDI file.