Class GrammarParser
java.lang.Object
com.adaptris.adapter.edistream.parser.AbstractParser
com.adaptris.adapter.edistream.parser.xml.AbstractStaxParser<GrammarComponentParser>
com.adaptris.adapter.edistream.parser.xml.grammar.GrammarParser
Main parser class for parsing a gml file, this is file (also known as a
grammar file) that defines the structure of an Edi message and contains
validation details on the data that the message conveys.
This class parses the gxml file and converts it into an object graph representation. This can then be used to process Edi data in a number of ways.
StaX (Streaming api for XML) is the approach used to process the XML. This is a modern and developer friendly alternative to SAX, and is a pull based parsing method as opposed to a push based one like SAX.
Since the xml contains a number repeated elements, dedicated parsing routines have been created made to parse each one. These are located in the Map <String - element tag name, GrammarElementParser - specific element parser> called: parserDelegates. The names of the xml elements are declared in a object: XMLTagnames. This allows the the developer to easy customise the xml element names used for parsing and writing xml. It potentially could even be used to control the xml structure also.
This class parses the gxml file and converts it into an object graph representation. This can then be used to process Edi data in a number of ways.
StaX (Streaming api for XML) is the approach used to process the XML. This is a modern and developer friendly alternative to SAX, and is a pull based parsing method as opposed to a push based one like SAX.
Since the xml contains a number repeated elements, dedicated parsing routines have been created made to parse each one. These are located in the Map <String - element tag name, GrammarElementParser - specific element parser> called: parserDelegates. The names of the xml elements are declared in a object: XMLTagnames. This allows the the developer to easy customise the xml element names used for parsing and writing xml. It potentially could even be used to control the xml structure also.
-
Field Summary
Fields inherited from class com.adaptris.adapter.edistream.parser.xml.AbstractStaxParser
factory, parserDelegates, tagnames, useDebugStax
Fields inherited from class com.adaptris.adapter.edistream.parser.AbstractParser
eventListeners
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StaxParserContext<GrammarComponentParser>
createContext
(XMLStreamReader staxXmlReader) parse
(XMLStreamReader staxXmlReader) Main method to parse the input xml document from the given stax readerMethods inherited from class com.adaptris.adapter.edistream.parser.xml.AbstractStaxParser
checkParserHasBeenInitialized, createXMLStreamReader, createXMLStreamReader, parse, parse, registerParser, setFactory, setTagnames, setUseDebugStax
Methods inherited from class com.adaptris.adapter.edistream.parser.AbstractParser
addParsedEventListener, fireElementEndParseEvent, fireElementStartParseEvent, removeParsedEventListener
-
Constructor Details
-
GrammarParser
public GrammarParser()
-
-
Method Details
-
parse
public EdiElement parse(XMLStreamReader staxXmlReader) throws XMLStreamException, EdiValidationException, EdiMandatoryElementMissingException, EdiFailedToParseSegmentException Description copied from class:AbstractStaxParser
Main method to parse the input xml document from the given stax reader- Specified by:
parse
in classAbstractStaxParser<GrammarComponentParser>
- Throws:
XMLStreamException
EdiValidationException
EdiMandatoryElementMissingException
EdiFailedToParseSegmentException
-
createContext
-