Open Business Objects for EDI
v3.6.0

com.americancoders.edi
Class IDListParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.americancoders.edi.IDListParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class IDListParser
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ext.LexicalHandler

SAX2 parser handler for IDList xml files

OBOE - Open Business Objects for EDI

Part of the OBOE Basic Extended Package
An EDI and XML Translator Written In Java
Copyright 1998-2009 - American Coders, LTD - Raleigh NC USA
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 count
protected  int _iLine
          current line number
protected  java.util.Vector codes
          vectors of idlist codes and values
protected  javax.xml.parsers.SAXParser parser
          SAX parser
protected  java.util.Vector values
          vectors of idlist codes and values
protected  java.lang.String xmlDirectoryPath
          directory path for xml file
 
Constructor Summary
IDListParser()
          constructor, sets up SAX parser, turns off validation, turns on namespaces, sets up content handler and error handler as this object.
 
Method Summary
 void characters(char[] ch, int start, int length)
          catches the element's value
 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
 java.lang.String getCode(int i)
          gets code as specific location
 int getCount()
          returns number of code/value pairs
 javax.xml.parsers.SAXParser getParser()
          get SAX parser
 java.lang.String getValue(int i)
          returns descriptive value at position
 void ignorableWhitespace(char[] ch, int start, int length)
          I use this to keep track of line #s
 void parse(java.lang.String inXMLFile, java.lang.String inLastDirectoryToLook, java.util.Vector vCodes, java.util.Vector vValues)
          makes the SAX2 parser call
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          resolves the DTD file name for the xerces parser
 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, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_iElement

protected int _iElement
current element count


_iLine

protected int _iLine
current line number


codes

protected java.util.Vector codes
vectors of idlist codes and values


values

protected java.util.Vector values
vectors of idlist codes and values


parser

protected javax.xml.parsers.SAXParser parser
SAX parser


xmlDirectoryPath

protected java.lang.String xmlDirectoryPath
directory path for xml file

Constructor Detail

IDListParser

public IDListParser()
             throws OBOEException
constructor, sets up SAX parser, turns off validation, turns on namespaces, sets up content handler and error handler as this object. sax exceptions go to System.err

Method Detail

parse

public void parse(java.lang.String inXMLFile,
                  java.lang.String inLastDirectoryToLook,
                  java.util.Vector vCodes,
                  java.util.Vector vValues)
makes the SAX2 parser call

Parameters:
inXMLFile - String of filename to parse
inLastDirectoryToLook - - name of the top directory where the IDList file could reside
vCodes - vector of codes
vValues - vector of code descriptive values

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

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - URI of incoming file
localName - String of element's local name
rawName - String of element's raw name
attributes - Vector of the elements attributes
Throws:
org.xml.sax.SAXException - many possible exceptions

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
catches the element's value

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - char array of the current element value contents
start - int start position within the array
length - int of characters found so far
Throws:
org.xml.sax.SAXException - many possible

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 file
localName - String of element's local name
rawName - String of element's raw name
Throws:
org.xml.sax.SAXException - many possible

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 whitespaces
start - int start position in array
length - 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

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 id
systemId - - String name of xml system id
Returns:
InputSource the dtd
org.xml.sax.SAXException

getParser

public javax.xml.parsers.SAXParser getParser()
get SAX parser

Returns:
SAXParser

getCount

public int getCount()
returns number of code/value pairs

Returns:
int

getCode

public java.lang.String getCode(int i)
gets code as specific location

Parameters:
i - int position to look at
Returns:
String

getValue

public java.lang.String getValue(int i)
returns descriptive value at position

Parameters:
i - int position to look at
Returns:
String

Open Business Objects for EDI
v3.6.0


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.