WebLogic Server 7.0 Code Examples, BEA Systems, Inc.

examples.xml.orderParser
Class StreamParser

java.lang.Object
  |
  +--examples.xml.orderParser.StreamParser

public class StreamParser
extends java.lang.Object

Demonstrates the parsing of an XML document into business objects using the XMLInputStream API.

Author:
Copyright (c) 2002 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
StreamParser()
           
 
Method Summary
 java.lang.String getAttribute(weblogic.xml.stream.StartElement pStartElement, java.lang.String pStr)
          Extract known attribute value by name from a start element.
 weblogic.xml.stream.XMLInputStream getInputStream(java.lang.String pName)
          Creates a new XMLInputStream.
 OrderBO getOrderBO()
          Returns created order business object.
 void parse(weblogic.xml.stream.XMLInputStream pStream)
          Controls the flow of the XML document's overall parsing.
 void processCustomer(weblogic.xml.stream.XMLInputStream pStream)
          Controls the flow of the customer parsing resulting in a customer business object.
 void processItem(weblogic.xml.stream.XMLInputStream pStream)
          Parses item data creating item business objects.
 void processItemList(weblogic.xml.stream.XMLInputStream pStream)
          Controls the flow of items in an item list element.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamParser

public StreamParser()
Method Detail

getAttribute

public java.lang.String getAttribute(weblogic.xml.stream.StartElement pStartElement,
                                     java.lang.String pStr)
                              throws weblogic.xml.stream.XMLStreamException

Extract known attribute value by name from a start element.

Parameters:
pStream - XML input stream.
Returns:
String Value of attribute.
Throws:
weblogic.xml.stream.XMLStreamException -  

getInputStream

public weblogic.xml.stream.XMLInputStream getInputStream(java.lang.String pName)
                                                  throws weblogic.xml.stream.XMLStreamException,
                                                         java.io.FileNotFoundException

Creates a new XMLInputStream.

Parameters:
pName - Name of XML document.
Returns:
XMLInputStream
Throws:
weblogic.xml.stream.XMLStreamException -  
java.io.FileNotFoundException -  

getOrderBO

public OrderBO getOrderBO()

Returns created order business object.

Returns:
OrderBO

parse

public void parse(weblogic.xml.stream.XMLInputStream pStream)
           throws java.lang.Exception,
                  weblogic.xml.stream.XMLStreamException

Controls the flow of the XML document's overall parsing.

Parameters:
pStream - XML input stream.
Throws:
java.lang.Exception -  
weblogic.xml.stream.XMLStreamException -  

processCustomer

public void processCustomer(weblogic.xml.stream.XMLInputStream pStream)
                     throws weblogic.xml.stream.XMLStreamException

Controls the flow of the customer parsing resulting in a customer business object.

Parameters:
pStream - XML input stream.
Throws:
weblogic.xml.stream.XMLStreamException -  

processItem

public void processItem(weblogic.xml.stream.XMLInputStream pStream)
                 throws weblogic.xml.stream.XMLStreamException

Parses item data creating item business objects.

Parameters:
pStream - XML input stream.
Throws:
weblogic.xml.stream.XMLStreamException -  

processItemList

public void processItemList(weblogic.xml.stream.XMLInputStream pStream)
                     throws weblogic.xml.stream.XMLStreamException

Controls the flow of items in an item list element.

Parameters:
pStream - XML input stream.
Throws:
weblogic.xml.stream.XMLStreamException -  

Documentation is available at
http://e-docs.bea.com/wls/docs70

Copyright © 2002 BEA Systems, Inc. All Rights Reserved.