© 2002 BEA Systems, Inc.


examples.e2e.common
Class POParser

java.lang.Object
  |
  +--examples.e2e.common.POParser

public class POParser
extends java.lang.Object
implements org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler

This class is used to parse XML that conforms to either the E2E_PO or E2E_POAcknowledgement DTDs and to return a PO object. This parser recognizes only the first LineItem XML element, subsequent elements are ignored. The line item behavior is such due to limitations in the PO class. By default, validation is not performed against the DTD. Set the system property "samples.e2e.b2b.xml.validate" to true if validation is desired during parsing. The validation system property applies to the behavior of this class and also to QuoteParser.

See Also:
PO, POImpl, POElement, QuoteParser

Field Summary
static java.lang.String VALIDATION_PROP
          Setting the system property "samples.e2e.b2b.xml.validate" to true will cause instances of this class to validate.
 
Constructor Summary
POParser(org.xml.sax.InputSource source)
          Constructs an instance of the parser given a org.xml.sax.InputSource.
 
Method Summary
 void characters(char[] chars, int start, int length)
          Implementation of the org.xml.sax.ContentHandler interface.
 void endDocument()
          Implementation of the org.xml.sax.ContentHandler interface.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Implementation of the org.xml.sax.ContentHandler interface.
 void endPrefixMapping(java.lang.String prefix)
          Implementation of the org.xml.sax.ContentHandler interface.
 void error(org.xml.sax.SAXParseException e)
          Implementation of the org.xml.sax.ErrorHandler interface.
 void fatalError(org.xml.sax.SAXParseException e)
          Implementation of the org.xml.sax.ErrorHandler interface.
 void ignorableWhitespace(char[] chars, int start, int length)
          Implementation of the org.xml.sax.ContentHandler interface.
 PO parse()
          Parses the org.xml.sax.InputSource specified in the constructor and returns a PO object to the caller.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Implementation of the org.xml.sax.ContentHandler interface.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Implementation of the org.xml.sax.ContentHandler interface.
 void skippedEntity(java.lang.String name)
          Implementation of the org.xml.sax.ContentHandler interface.
 void startDocument()
          Implementation of the org.xml.sax.ContentHandler interface.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Implementation of the org.xml.sax.ContentHandler interface.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Implementation of the org.xml.sax.ContentHandler interface.
 void warning(org.xml.sax.SAXParseException e)
          Implementation of the org.xml.sax.ErrorHandler interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_PROP

public static final java.lang.String VALIDATION_PROP
Setting the system property "samples.e2e.b2b.xml.validate" to true will cause instances of this class to validate.
Constructor Detail

POParser

public POParser(org.xml.sax.InputSource source)
Constructs an instance of the parser given a org.xml.sax.InputSource.

Parameters:
source - the XML source to parse.
Method Detail

parse

public PO parse()
         throws ParsingException
Parses the org.xml.sax.InputSource specified in the constructor and returns a PO object to the caller. By default XML validation is NOT performed, set the system property VALIDATION_PROP.

Returns:
a PO object constructed from the parsed XML.
Throws:
ParsingExeption - if invalid XML elements or values are encountered.

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
startElement in interface org.xml.sax.ContentHandler


characters

public void characters(char[] chars,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
characters in interface org.xml.sax.ContentHandler


endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
endElement in interface org.xml.sax.ContentHandler


ignorableWhitespace

public void ignorableWhitespace(char[] chars,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler


processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler


skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler


startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
startDocument in interface org.xml.sax.ContentHandler


endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
endDocument in interface org.xml.sax.ContentHandler


startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler


endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ContentHandler interface.
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler


error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ErrorHandler interface.
Specified by:
error in interface org.xml.sax.ErrorHandler


fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ErrorHandler interface.
Specified by:
fatalError in interface org.xml.sax.ErrorHandler


warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Implementation of the org.xml.sax.ErrorHandler interface.
Specified by:
warning in interface org.xml.sax.ErrorHandler


© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved