All rights reserved
American Coders, Ltd
P. O. Box 97462
Raleigh, NC 27624 USA
1-919-846-2014
http://www.americancoders.com
- Version:
- 3.6.0
- Author:
- Joe McVerry - American Coders, Ltd.
|
Field Summary |
protected int |
_iElement
current element number |
protected int |
_iLine
current line number |
protected java.io.CharArrayWriter |
contents
simple string processor |
protected com.americancoders.edi.TemplateComposite |
currentCompositeDE
current composite |
protected com.americancoders.edi.TemplateDE |
currentDataElement
current element |
protected com.americancoders.edi.TemplateEnvelope |
currentEnvelope
current envelope |
protected com.americancoders.edi.TemplateFunctionalGroup |
currentFG
current functionalGroup |
protected java.lang.String |
currentID
current id string |
protected com.americancoders.edi.IDList |
currentIDList
current list of ids |
protected com.americancoders.edi.IDListProcessor |
currentIDListProcessor
idList Processor |
protected java.lang.String |
currentLoopID
loop id - may not be used in future |
protected java.util.Stack |
currentSegContainerStack
stack, since segments can be held by table and segments and
datalements by segments and composites we keep track of container depth through a stack |
protected com.americancoders.edi.TemplateSegment |
currentTemplateSegment
current segment |
protected com.americancoders.edi.TemplateSegmentContainer |
currentTemplateSegmentContainer
current container for segments |
protected java.lang.String |
idCode
idcode value since idcode appears before idvalue save it |
protected com.americancoders.edi.IDList |
idlist
|
protected java.lang.String |
idListFile
current idListFile name |
protected com.americancoders.edi.IDListParser |
idListParser
current IDList parser object |
protected java.util.Hashtable |
idLists
list of IDs |
protected java.lang.String |
knowSystemID
file name being parsed |
protected java.lang.String |
nameOrID
default name |
protected java.lang.String |
xmlDirectoryPath
directory path for xml file |
|
Constructor Summary |
EnvelopeFactory()
construct the factory with a xml parser |
|
Method Summary |
static com.americancoders.edi.TemplateEnvelope |
buildEnvelope(java.lang.String inFileName)
Deprecated. use buildEnvelope(String, String) |
static com.americancoders.edi.TemplateEnvelope |
buildEnvelope(java.lang.String inFileName,
java.lang.String version)
static class method will build a envelope based on input string and OBOE.properties defintion
see OBOE.properties file to define the directory path |
void |
characters(char[] ch,
int start,
int length)
Method handles #PCDATA |
void |
comment(char[] chars,
int start,
int length)
|
void |
endCDATA()
|
void |
endDTD()
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
Method called by the SAX parser at the |
void |
endEntity(java.lang.String arg0)
|
void |
error(org.xml.sax.SAXParseException e)
catches error SAXParseExceptions
this code causes exception to continue |
void |
fatalError(org.xml.sax.SAXParseException e)
catches fatal SAXParseExceptions
this code causes exception to continue |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
I use this to keep track of line #s |
static void |
main(java.lang.String[] args)
static main class used for testing
Class contains a main method to allow it to invoked as an application.
|
void |
parse(org.xml.sax.InputSource is)
method to call parser with an InputSource argument |
void |
parse(java.lang.String is)
method to call parser with a String argument |
org.xml.sax.InputSource |
resolveEntity(java.lang.String publicId,
java.lang.String systemId)
resolves the DTD file name for the xerces parser |
com.americancoders.edi.TemplateDE |
setDataElement(int pos,
org.xml.sax.Attributes attributes)
method to build a template data element
made static in release 2.5.0 |
void |
setDocumentLocator(org.xml.sax.Locator locator)
|
com.americancoders.edi.TemplateComposite |
setTemplateComposite(int pos,
org.xml.sax.Attributes attributes)
method to build a template composite
made static in release 2.5.0 |
void |
startCDATA()
|
void |
startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
method called for each xml element found.
|
void |
startEntity(java.lang.String arg0)
|
void |
warning(org.xml.sax.SAXParseException e)
catches warning SAXParseExceptions
this code sends exception to stdio and allows public classto continue |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xml.sax.ContentHandler |
endDocument, endPrefixMapping, processingInstruction, skippedEntity, startDocument, startPrefixMapping |
_iElement
protected int _iElement
- current element number
_iLine
protected int _iLine
- current line number
currentEnvelope
protected com.americancoders.edi.TemplateEnvelope currentEnvelope
- current envelope
currentFG
protected com.americancoders.edi.TemplateFunctionalGroup currentFG
- current functionalGroup
currentTemplateSegmentContainer
protected com.americancoders.edi.TemplateSegmentContainer currentTemplateSegmentContainer
- current container for segments
currentTemplateSegment
protected com.americancoders.edi.TemplateSegment currentTemplateSegment
- current segment
currentCompositeDE
protected com.americancoders.edi.TemplateComposite currentCompositeDE
- current composite
currentDataElement
protected com.americancoders.edi.TemplateDE currentDataElement
- current element
currentLoopID
protected java.lang.String currentLoopID
- loop id - may not be used in future
currentID
protected java.lang.String currentID
- current id string
contents
protected java.io.CharArrayWriter contents
- simple string processor
idListFile
protected java.lang.String idListFile
- current idListFile name
currentIDListProcessor
protected com.americancoders.edi.IDListProcessor currentIDListProcessor
- idList Processor
idlist
protected com.americancoders.edi.IDList idlist
idCode
protected java.lang.String idCode
- idcode value since idcode appears before idvalue save it
idListParser
protected com.americancoders.edi.IDListParser idListParser
- current IDList parser object
idLists
protected java.util.Hashtable idLists
- list of IDs
currentIDList
protected com.americancoders.edi.IDList currentIDList
- current list of ids
xmlDirectoryPath
protected java.lang.String xmlDirectoryPath
- directory path for xml file
nameOrID
protected java.lang.String nameOrID
- default name
currentSegContainerStack
protected java.util.Stack currentSegContainerStack
- stack, since segments can be held by table and segments and
datalements by segments and composites we keep track of container depth through a stack
knowSystemID
protected java.lang.String knowSystemID
- file name being parsed
EnvelopeFactory
public EnvelopeFactory()
throws java.lang.Exception
- construct the factory with a xml parser
- Throws:
java.lang.Exception - an xml parser exception
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler- Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
parse
public void parse(org.xml.sax.InputSource is)
throws java.lang.Exception
- method to call parser with an InputSource argument
- Parameters:
is - InputSource
- Throws:
java.lang.Exception - an xml parser exception
parse
public void parse(java.lang.String is)
throws java.lang.Exception
- method to call parser with a String argument
- Parameters:
is - String of xml data
- Throws:
java.lang.Exception - an xml parser exception
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
java.lang.String systemId)
throws org.xml.sax.SAXException
- resolves the DTD file name for the xerces parser
- Specified by:
resolveEntity in interface org.xml.sax.EntityResolver- Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
- Parameters:
publicId - - String name of xml public idsystemId - - String name of xml system id
- Returns:
- InputSource the dtd
org.xml.sax.SAXException
startElement
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- method called for each xml element found.
process logic
- test each name found for edi type: Envelope, table, segment, dataelement
- for each type pull appropriate attributes and construct object
- for envelopes
- for functionalgroups
- for segments build a template segment
- for data element build a template datalement
- Specified by:
startElement in interface org.xml.sax.ContentHandler- Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
- Parameters:
uri - URI of incoming filelocalName - String of element's local namerawName - String of element's raw nameattributes - Vector of the elements attributes
- Throws:
org.xml.sax.SAXException - many possible exceptions
endElement
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName)
throws org.xml.sax.SAXException
- Method called by the SAX parser at the
- Specified by:
endElement in interface org.xml.sax.ContentHandler- Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
- Parameters:
uri - URI of incoming filelocalName - String of element's local namerawName - String of element's raw name
- Throws:
org.xml.sax.SAXException - many possible *
characters
public void characters(char[] ch,
int start,
int length)
- Method handles #PCDATA
- Specified by:
characters in interface org.xml.sax.ContentHandler- Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
- Parameters:
ch - arraystart - position in array where next has been placedlength - int
setTemplateComposite
public com.americancoders.edi.TemplateComposite setTemplateComposite(int pos,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- method to build a template composite
made static in release 2.5.0
- Parameters:
pos - int position within segmentattributes - SAX2 attributes
- Returns:
- TemplateComposite template composite
- Throws:
org.xml.sax.SAXException - SAX errors
setDataElement
public com.americancoders.edi.TemplateDE setDataElement(int pos,
org.xml.sax.Attributes attributes)
throws org.xml.sax.SAXException
- method to build a template data element
made static in release 2.5.0
- Parameters:
pos - position within segment or compositeattributes - SAX2 attributes
- Returns:
- TemplateDE template data element
- Throws:
org.xml.sax.SAXException - SAX errors
ignorableWhitespace
public void ignorableWhitespace(char[] ch,
int start,
int length)
- I use this to keep track of line #s
- Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler- Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
- Parameters:
ch - char array of found whitespacesstart - int start position in arraylength - int length of what's been found
warning
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches warning SAXParseExceptions
this code sends exception to stdio and allows public classto continue
- Specified by:
warning in interface org.xml.sax.ErrorHandler- Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SaxException object
- Throws:
org.xml.sax.SAXException - exception
error
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches error SAXParseExceptions
this code causes exception to continue
- Specified by:
error in interface org.xml.sax.ErrorHandler- Overrides:
error in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SaxException object
- Throws:
org.xml.sax.SAXException - thrown
fatalError
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
- catches fatal SAXParseExceptions
this code causes exception to continue
- Specified by:
fatalError in interface org.xml.sax.ErrorHandler- Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
- Parameters:
e - SAXException object
- Throws:
org.xml.sax.SAXException - thrown
startDTD
public void startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
throws org.xml.sax.SAXException
- Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endDTD
public void endDTD()
throws org.xml.sax.SAXException
- Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
startEntity
public void startEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endEntity
public void endEntity(java.lang.String arg0)
throws org.xml.sax.SAXException
- Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
startCDATA
public void startCDATA()
throws org.xml.sax.SAXException
- Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
endCDATA
public void endCDATA()
throws org.xml.sax.SAXException
- Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
comment
public void comment(char[] chars,
int start,
int length)
throws org.xml.sax.SAXException
- Specified by:
comment in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
buildEnvelope
public static com.americancoders.edi.TemplateEnvelope buildEnvelope(java.lang.String inFileName)
throws OBOEException
- Deprecated. use buildEnvelope(String, String)
- static class method will build a envelope based on input string and OBOE.properties defintion
see OBOE.properties file to define the directory path
- Parameters:
inFileName - String without the path or xml file extension
- Returns:
- TemplatesEnvelope
- Throws:
OBOEException - io error most likely
buildEnvelope
public static com.americancoders.edi.TemplateEnvelope buildEnvelope(java.lang.String inFileName,
java.lang.String version)
- static class method will build a envelope based on input string and OBOE.properties defintion
see OBOE.properties file to define the directory path
- Parameters:
inFileName - String without the path or xml file extensionversion - String specifies subpath to find version specific envelope rules files
- Returns:
- TemplateEnvelope
- Throws:
OBOEException - io error most likely
main
public static void main(java.lang.String[] args)
- static main class used for testing
Class contains a main method to allow it to invoked as an application.
format: java com.americancoders.edi.EnvelopeFactory
- Parameters:
args - String array
OBOE is a trademark or registered trademark of American Coders, Ltd. in the US and other countries.
Copyright 1999-2004 American Coders, Ltd.
POB 97462
Raleigh NC 27624 USA
All Rights Reserved.