|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.edisax.EDIParser
public class EDIParser
EDI Parser.
Generates a stream of SAX events from an EDI message stream based on the suppliedmapping model.
InputStream ediInputStream = ....
InputStream edi2SaxMappingConfig = ....
ContentHandler contentHandler = ....
EDIParser parser = new EDIParser();
parser.setContentHandler(contentHandler);
parser.setMappingModel(EDIParser.parseMappingModel(edi2SaxMappingConfig));
parser.parse(new InputSource(ediInputStream));
etc...
So the above illustration attempts to highlight the following:
regex pattern match on the full segment, where the segcode attribute defines the
regex pattern (e.g. segcode="1A\*a.*").
| Field Summary | |
|---|---|
static java.lang.String |
FEATURE_IGNORE_NEWLINES
|
static java.lang.String |
FEATURE_VALIDATE
|
| Constructor Summary | |
|---|---|
EDIParser()
|
|
| Method Summary | |
|---|---|
void |
endElement(java.lang.String elementName,
boolean indent)
|
org.xml.sax.ContentHandler |
getContentHandler()
|
org.xml.sax.DTDHandler |
getDTDHandler()
|
org.xml.sax.EntityResolver |
getEntityResolver()
|
org.xml.sax.ErrorHandler |
getErrorHandler()
|
boolean |
getFeature(java.lang.String name)
|
MutableInt |
getIndentDepth()
Get the indent depth counter |
java.lang.Object |
getProperty(java.lang.String name)
|
void |
mapFields(java.lang.String[] currentSegmentFields,
Segment segment)
Map the individual field values based on the supplied expected field configs. |
void |
parse()
Parse an EDI message, using a supplied segment reader. |
void |
parse(org.xml.sax.InputSource ediInputSource)
Parse an EDI InputSource. |
void |
parse(java.lang.String systemId)
The following methods are currently unimplemnted... |
static EdifactModel |
parseMappingModel(java.io.InputStream mappingConfigStream)
Parse the supplied mapping model config stream and return the generated EdiMap. |
static EdifactModel |
parseMappingModel(java.io.InputStream mappingConfigStream,
Description mappingDescription,
java.net.URI resourceURI,
java.net.URI importBaseURI)
Parse the supplied mapping model config stream and return the generated EdiMap. |
static EdifactModel |
parseMappingModel(java.io.Reader mappingConfigStream)
Parse the supplied mapping model config stream and return the generated EdiMap. |
static EdifactModel |
parseMappingModel(java.io.Reader mappingConfigStream,
Description mappingDescription,
java.net.URI resourceURI,
java.net.URI importBaseURI)
Parse the supplied mapping model config stream and return the generated EdiMap. |
static EdifactModel |
parseMappingModel(java.lang.String mappingConfig,
java.net.URI baseURI)
Parse the supplied mapping model config path and return the generated EdiMap. |
EDIParser |
setBufferedSegmentReader(BufferedSegmentReader segmentReader)
|
void |
setContentHandler(org.xml.sax.ContentHandler contentHandler)
|
void |
setDTDHandler(org.xml.sax.DTDHandler arg0)
|
void |
setEntityResolver(org.xml.sax.EntityResolver arg0)
|
void |
setErrorHandler(org.xml.sax.ErrorHandler arg0)
|
void |
setFeature(java.lang.String name,
boolean value)
|
void |
setIndentDepth(MutableInt indentDepth)
Set the indent depth counter |
void |
setMappingModel(EdifactModel mappingModel)
Set the EDI mapping model to be used in all subsequent parse operations. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
|
void |
startElement(java.lang.String elementName,
boolean indent)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FEATURE_VALIDATE
public static final java.lang.String FEATURE_IGNORE_NEWLINES
| Constructor Detail |
|---|
public EDIParser()
| Method Detail |
|---|
public static EdifactModel parseMappingModel(java.lang.String mappingConfig,
java.net.URI baseURI)
throws java.io.IOException,
org.xml.sax.SAXException,
EDIConfigurationException
setMappingModel(EdifactModel).
mappingConfig - Config path. Must conform with the
edi-message-mapping-1.0.xsd
schema.baseURI - The base URI against which the config path is to be resolved. This works on down
and helps in resolving imported model.
java.io.IOException - Error reading the model stream.
org.xml.sax.SAXException - Invalid model.
EDIConfigurationException - when edi-mapping-configuration is incorrect.
public static EdifactModel parseMappingModel(java.io.InputStream mappingConfigStream)
throws java.io.IOException,
org.xml.sax.SAXException,
EDIConfigurationException
setMappingModel(EdifactModel).
mappingConfigStream - Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.
java.io.IOException - Error reading the model stream.
org.xml.sax.SAXException - Invalid model.
EDIConfigurationException - when edi-mapping-configuration is incorrect.
public static EdifactModel parseMappingModel(java.io.InputStream mappingConfigStream,
Description mappingDescription,
java.net.URI resourceURI,
java.net.URI importBaseURI)
throws java.io.IOException,
org.xml.sax.SAXException,
EDIConfigurationException
setMappingModel(EdifactModel).
mappingConfigStream - Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.mappingDescription - Mapping Model Description.resourceURI - The resource URI.importBaseURI - The base URI for loading imports.
java.io.IOException - Error reading the model stream.
org.xml.sax.SAXException - Invalid model.
EDIConfigurationException - when edi-mapping-configuration is incorrect.
public static EdifactModel parseMappingModel(java.io.Reader mappingConfigStream)
throws java.io.IOException,
org.xml.sax.SAXException,
EDIConfigurationException
setMappingModel(org.milyn.edisax.model.EdifactModel).
mappingConfigStream - Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.
java.io.IOException - Error reading the model stream.
org.xml.sax.SAXException - Invalid model.
EDIConfigurationException - when edi-mapping-configuration is incorrect.
public static EdifactModel parseMappingModel(java.io.Reader mappingConfigStream,
Description mappingDescription,
java.net.URI resourceURI,
java.net.URI importBaseURI)
throws java.io.IOException,
org.xml.sax.SAXException,
EDIConfigurationException
setMappingModel(org.milyn.edisax.model.EdifactModel).
mappingConfigStream - Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.mappingDescription - Mapping Model Description.resourceURI - The resource URI.importBaseURI - The base URI for loading imports.
java.io.IOException - Error reading the model stream.
org.xml.sax.SAXException - Invalid model.
EDIConfigurationException - when edi-mapping-configuration is incorrect.public void setMappingModel(EdifactModel mappingModel)
EDIParser.
mappingModel - The mapping model.public MutableInt getIndentDepth()
public void setIndentDepth(MutableInt indentDepth)
indentDepth - Indent depth counter.
public void parse(org.xml.sax.InputSource ediInputSource)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReaderjava.io.IOException
org.xml.sax.SAXException
public void parse()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXExceptionpublic EDIParser setBufferedSegmentReader(BufferedSegmentReader segmentReader)
public void mapFields(java.lang.String[] currentSegmentFields,
Segment segment)
throws org.xml.sax.SAXException
currentSegmentFields - Segment fields from the input message.segment - List of expected field mapping configurations that the currentSegmentFields
are expected to map to.
org.xml.sax.SAXException - EDI processing exception.
public void startElement(java.lang.String elementName,
boolean indent)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void endElement(java.lang.String elementName,
boolean indent)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic void setContentHandler(org.xml.sax.ContentHandler contentHandler)
setContentHandler in interface org.xml.sax.XMLReaderpublic org.xml.sax.ContentHandler getContentHandler()
getContentHandler in interface org.xml.sax.XMLReader
public void parse(java.lang.String systemId)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReaderjava.io.IOException
org.xml.sax.SAXException
public boolean getFeature(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
getFeature in interface org.xml.sax.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setFeature(java.lang.String name,
boolean value)
setFeature in interface org.xml.sax.XMLReaderpublic org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler in interface org.xml.sax.XMLReaderpublic void setDTDHandler(org.xml.sax.DTDHandler arg0)
setDTDHandler in interface org.xml.sax.XMLReaderpublic org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver in interface org.xml.sax.XMLReaderpublic void setEntityResolver(org.xml.sax.EntityResolver arg0)
setEntityResolver in interface org.xml.sax.XMLReaderpublic org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler in interface org.xml.sax.XMLReaderpublic void setErrorHandler(org.xml.sax.ErrorHandler arg0)
setErrorHandler in interface org.xml.sax.XMLReader
public java.lang.Object getProperty(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
getProperty in interface org.xml.sax.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setProperty(java.lang.String name,
java.lang.Object value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
setProperty in interface org.xml.sax.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||