public class EDIParser extends Object implements XMLReader
mapping 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...
regex pattern match
on the full segment, where the segcode attribute defines the
regex pattern (e.g. segcode="1A\*a.*").Modifier and Type | Field and Description |
---|---|
static String |
FEATURE_IGNORE_EMPTY_NODES |
static String |
FEATURE_IGNORE_NEWLINES |
static String |
FEATURE_VALIDATE |
Constructor and Description |
---|
EDIParser() |
Modifier and Type | Method and Description |
---|---|
void |
endElement(MappingNode node,
boolean indent) |
void |
endElement(String elementName,
String namespace,
boolean indent) |
ContentHandler |
getContentHandler() |
DTDHandler |
getDTDHandler() |
EntityResolver |
getEntityResolver() |
ErrorHandler |
getErrorHandler() |
boolean |
getFeature(String name) |
Map<String,Boolean> |
getFeatures() |
MutableInt |
getIndentDepth()
Get the indent depth counter
|
Object |
getProperty(String name) |
void |
mapFields(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(InputSource ediInputSource)
Parse an EDI InputSource.
|
void |
parse(String systemId)
The following methods are currently unimplemnted...
|
static EdifactModel |
parseMappingModel(InputStream mappingConfigStream)
Parse the supplied mapping model config stream and return the generated EdiMap.
|
static EdifactModel |
parseMappingModel(InputStream mappingConfigStream,
Description mappingDescription,
URI resourceURI,
URI importBaseURI)
Parse the supplied mapping model config stream and return the generated EdiMap.
|
static EdifactModel |
parseMappingModel(Reader mappingConfigStream)
Parse the supplied mapping model config stream and return the generated EdiMap.
|
static EdifactModel |
parseMappingModel(Reader mappingConfigStream,
Description mappingDescription,
URI resourceURI,
URI importBaseURI)
Parse the supplied mapping model config stream and return the generated EdiMap.
|
static EdifactModel |
parseMappingModel(String mappingConfig,
URI baseURI)
Parse the supplied mapping model config path and return the generated EdiMap.
|
EDIParser |
setBufferedSegmentReader(BufferedSegmentReader segmentReader) |
void |
setContentHandler(ContentHandler contentHandler) |
void |
setDTDHandler(DTDHandler arg0) |
void |
setEntityResolver(EntityResolver arg0) |
void |
setErrorHandler(ErrorHandler arg0) |
void |
setFeature(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 |
setNamespaceDeclarationStack(NamespaceDeclarationStack nsStack)
Set the
NamespaceDeclarationStack to be used by the reader instance. |
void |
setProperty(String name,
Object value) |
void |
startElement(MappingNode node,
boolean indent) |
void |
startElement(String elementName,
String namespace,
boolean indent) |
void |
startElement(String elementName,
String namespace,
boolean indent,
Attributes attributes) |
public static final String FEATURE_VALIDATE
public static final String FEATURE_IGNORE_NEWLINES
public static final String FEATURE_IGNORE_EMPTY_NODES
public void setNamespaceDeclarationStack(NamespaceDeclarationStack nsStack)
NamespaceDeclarationStack
to be used by the reader instance.nsStack
- The NamespaceDeclarationStack
to be used by the reader instance.public static EdifactModel parseMappingModel(String mappingConfig, URI baseURI) throws IOException, 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.IOException
- Error reading the model stream.SAXException
- Invalid model.EDIConfigurationException
- when edi-mapping-configuration is incorrect.public static EdifactModel parseMappingModel(InputStream mappingConfigStream) throws IOException, SAXException, EDIConfigurationException
setMappingModel(EdifactModel)
.mappingConfigStream
- Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.IOException
- Error reading the model stream.SAXException
- Invalid model.EDIConfigurationException
- when edi-mapping-configuration is incorrect.public static EdifactModel parseMappingModel(InputStream mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, 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.IOException
- Error reading the model stream.SAXException
- Invalid model.EDIConfigurationException
- when edi-mapping-configuration is incorrect.public static EdifactModel parseMappingModel(Reader mappingConfigStream) throws IOException, SAXException, EDIConfigurationException
setMappingModel(org.milyn.edisax.model.EdifactModel)
.mappingConfigStream
- Config stream. Must conform with the
edi-message-mapping-1.0.xsd
schema.IOException
- Error reading the model stream.SAXException
- Invalid model.EDIConfigurationException
- when edi-mapping-configuration is incorrect.public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, 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.IOException
- Error reading the model stream.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(InputSource ediInputSource) throws IOException, SAXException
parse
in interface XMLReader
IOException
SAXException
public void parse() throws IOException, SAXException
IOException
SAXException
public EDIParser setBufferedSegmentReader(BufferedSegmentReader segmentReader)
public void mapFields(String[] currentSegmentFields, Segment segment) throws SAXException
currentSegmentFields
- Segment fields from the input message.segment
- List of expected field mapping configurations that the currentSegmentFields
are expected to map to.SAXException
- EDI processing exception.public void startElement(MappingNode node, boolean indent) throws SAXException
SAXException
public void startElement(String elementName, String namespace, boolean indent) throws SAXException
SAXException
public void startElement(String elementName, String namespace, boolean indent, Attributes attributes) throws SAXException
SAXException
public void endElement(MappingNode node, boolean indent) throws SAXException
SAXException
public void endElement(String elementName, String namespace, boolean indent) throws SAXException
SAXException
public void setContentHandler(ContentHandler contentHandler)
setContentHandler
in interface XMLReader
public ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
public void parse(String systemId) throws IOException, SAXException
parse
in interface XMLReader
IOException
SAXException
public boolean getFeature(String name)
getFeature
in interface XMLReader
public void setFeature(String name, boolean value)
setFeature
in interface XMLReader
public DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
public void setDTDHandler(DTDHandler arg0)
setDTDHandler
in interface XMLReader
public EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
public void setEntityResolver(EntityResolver arg0)
setEntityResolver
in interface XMLReader
public ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
public void setErrorHandler(ErrorHandler arg0)
setErrorHandler
in interface XMLReader
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
Copyright © 2020. All rights reserved.