com.americancoders.ebXML
Class ebXMLErrorParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.americancoders.ebXML.ebXMLErrorParser

public class ebXMLErrorParser
extends org.xml.sax.helpers.DefaultHandler

class to parse an ebXMLHeader.
stores all objects as defined in ebXMLError
requires xerces SAX parser From the apache group

package built from ebXML Messaging Service Specification
ebXML Transport, Routing & Packaging
Version 0.21d
16 October 2000
Note this specification is in development and is subject to change
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.
This program is free software; you can redistribute it and/or modify it under the terms of the Mozilla Public License as published by the Mozilla Software Foundation http://www.mozilla.org/MPL
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License for more details.

See Also:

Field Summary
protected  int _iElement
           
protected  int _iLine
           
private  java.io.CharArrayWriter contents
           
protected  java.lang.Object currentObject
           
protected  Description description
           
protected  ebXMLError ebXMLError
           
protected  java.lang.String errorCode
           
protected  ErrorHeader errorHeader
           
protected  ErrorLocation errorLocation
           
protected  java.lang.String href
           
protected  java.util.Stack objectStack
           
protected  org.apache.xerces.parsers.SAXParser parser
           
protected  java.lang.String refToMessageId
           
protected  java.lang.String severity
           
protected  java.lang.String softwareDetails
           
 
Constructor Summary
ebXMLErrorParser()
          construct the parser object from xerces -exception SAXEception is caught for setting features -exception generic Java exceptions are caught and stack is dumped to System.out
 
Method Summary
 void characters(char[] ch, int start, int length)
          Method declaration
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName)
          Method called by the SAX parser at the
 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
 ebXMLError getebXMLError()
          method to get the ebXMLError that was parsed.
 void ignorableWhitespace(char[] ch, int start, int length)
          override the SAX2 ignorableWhitespace method to keep track of line numbers
static void main(java.lang.String[] args)
          test routine pass one arg - filename of file containing xml document
 void parse(java.io.File xmlFile)
          method parse a file
 void parse(org.xml.sax.InputSource is)
          method parse an InputSource
 void parse(java.lang.String xmlString)
          method parse a XML String
 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 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, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_iElement

protected int _iElement

_iLine

protected int _iLine

objectStack

protected java.util.Stack objectStack

currentObject

protected java.lang.Object currentObject

parser

protected org.apache.xerces.parsers.SAXParser parser

contents

private java.io.CharArrayWriter contents

ebXMLError

protected ebXMLError ebXMLError

errorHeader

protected ErrorHeader errorHeader

errorCode

protected java.lang.String errorCode

severity

protected java.lang.String severity

description

protected Description description

softwareDetails

protected java.lang.String softwareDetails

errorLocation

protected ErrorLocation errorLocation

refToMessageId

protected java.lang.String refToMessageId

href

protected java.lang.String href
Constructor Detail

ebXMLErrorParser

public ebXMLErrorParser()
construct the parser object from xerces -exception SAXEception is caught for setting features -exception generic Java exceptions are caught and stack is dumped to System.out
Method Detail

main

public static void main(java.lang.String[] args)
test routine pass one arg - filename of file containing xml document

parse

public void parse(java.lang.String xmlString)
method parse a XML String
Parameters:
String - contains XML text -exception generic Java exceptions are caught and stack is dumped to System.out

parse

public void parse(java.io.File xmlFile)
method parse a file
Parameters:
Java.io.File - file containing XML text -exception generic Java exceptions are caught and stack is dumped to System.out

parse

public void parse(org.xml.sax.InputSource is)
method parse an InputSource
Parameters:
InputSource - -exception generic Java exceptions are caught and stack is dumped to System.out

getebXMLError

public ebXMLError getebXMLError()
method to get the ebXMLError that was parsed.
you will need to get the ebXMLError to get access to the child objects
Returns:
ebXHMLheader

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
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
String - data element name
AttributeList - attributes associated with data element

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Method declaration
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch -  
start -  
length -  

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
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
String - name of element found
Throws:
org.xml.sax.SAXException -  

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
override the SAX2 ignorableWhitespace method to keep track of line numbers
Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler

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
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
catches error SAXParseExceptions this code causes exception to continue
Overrides:
error in class org.xml.sax.helpers.DefaultHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
catches fatal SAXParseExceptions this code causes exception to continue
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler