org.apache.axis2.om.impl.llom.builder
Class StAXBuilder

java.lang.Object
  extended byorg.apache.axis2.om.impl.llom.builder.StAXBuilder
All Implemented Interfaces:
OMXMLParserWrapper
Direct Known Subclasses:
StAXOMBuilder

public abstract class StAXBuilder
extends java.lang.Object
implements OMXMLParserWrapper

OM should be able to built from any data source. And the model it builds may be a SOAP specific one or just an XML model. This class will give some common functionality of OM Building from StAX.


Field Summary
protected  boolean cache
          Field cache
protected  OMDocument document
           
protected  boolean done
          Field done
protected  OMNode lastNode
          Field lastNode
protected  OMFactory omfactory
          Field omfactory
protected  XMLStreamReader parser
          Field parser
protected  boolean parserAccessed
          Field parserAccessed
 
Constructor Summary
protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser)
          Constructor StAXBuilder
protected StAXBuilder(XMLStreamReader parser)
          Constructor StAXBuilder
 
Method Summary
protected abstract  OMNode createOMElement()
          This method will be called with the XMLStreamConstants.START_ELEMENT event
protected  OMNode createOMText(int textType)
          Method createOMText
 void discard(OMElement el)
          Method discard
 int getAttributeCount()
          Method getAttributeCount
 java.lang.String getAttributeName(int arg)
          Method getAttributeName
 java.lang.String getAttributeNamespace(int arg)
          Method getAttributeNamespace
 java.lang.String getAttributePrefix(int arg)
          Method getAttributePrefix
 short getBuilderType()
          Returns the type of the builder.
 OMDocument getDocument()
           
 java.lang.String getName()
          Method getName
 java.lang.String getNamespace()
          Method getNamespace
 int getNamespaceCount()
          Method getNamespaceCount
 java.lang.String getNamespacePrefix(int index)
          Method getNamespacePrefix
 java.lang.String getNamespaceUri(int index)
          Method getNamespaceUri
 java.lang.Object getParser()
          Method getParser
 java.lang.String getPrefix()
          Method getPrefix
 java.lang.Object getRegisteredContentHandler()
          Method getRegisteredContentHandler
 java.lang.String getText()
          Method getText
 boolean isCompleted()
          Method isCompleted
abstract  int next()
          This should proceed the parser one step further, if parser is not completed yet.
protected  void processAttributes(OMElement node)
          Method processAttributes
protected abstract  void processNamespaceData(OMElement node, boolean isSOAPElement)
          Method processNamespaceData
 void registerExternalContentHandler(java.lang.Object obj)
          Method registerExternalContentHandler
 void reset(OMNode node)
          Method reset
 void setCache(boolean b)
          Method setCache
 void setOmbuilderFactory(OMFactory ombuilderFactory)
          Method setOmbuilderFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.axis2.om.OMXMLParserWrapper
getDocumentElement
 

Field Detail

parser

protected XMLStreamReader parser
Field parser


omfactory

protected OMFactory omfactory
Field omfactory


lastNode

protected OMNode lastNode
Field lastNode


done

protected boolean done
Field done


cache

protected boolean cache
Field cache


parserAccessed

protected boolean parserAccessed
Field parserAccessed


document

protected OMDocument document
Constructor Detail

StAXBuilder

protected StAXBuilder(OMFactory ombuilderFactory,
                      XMLStreamReader parser)
Constructor StAXBuilder

Parameters:
ombuilderFactory -
parser -

StAXBuilder

protected StAXBuilder(XMLStreamReader parser)
Constructor StAXBuilder

Parameters:
parser -
Method Detail

setOmbuilderFactory

public void setOmbuilderFactory(OMFactory ombuilderFactory)
Method setOmbuilderFactory

Parameters:
ombuilderFactory -

processNamespaceData

protected abstract void processNamespaceData(OMElement node,
                                             boolean isSOAPElement)
Method processNamespaceData

Parameters:
node -
isSOAPElement -

processAttributes

protected void processAttributes(OMElement node)
Method processAttributes

Parameters:
node -

createOMText

protected OMNode createOMText(int textType)
                       throws OMException
Method createOMText

Returns:
Throws:
OMException

reset

public void reset(OMNode node)
           throws OMException
Method reset

Parameters:
node -
Throws:
OMException

discard

public void discard(OMElement el)
             throws OMException
Method discard

Specified by:
discard in interface OMXMLParserWrapper
Parameters:
el -
Throws:
OMException

getText

public java.lang.String getText()
                         throws OMException
Method getText

Returns:
Throws:
OMException

getNamespace

public java.lang.String getNamespace()
                              throws OMException
Method getNamespace

Returns:
Throws:
OMException

getNamespaceCount

public int getNamespaceCount()
                      throws OMException
Method getNamespaceCount

Returns:
Throws:
OMException

getNamespacePrefix

public java.lang.String getNamespacePrefix(int index)
                                    throws OMException
Method getNamespacePrefix

Parameters:
index -
Returns:
Throws:
OMException

getNamespaceUri

public java.lang.String getNamespaceUri(int index)
                                 throws OMException
Method getNamespaceUri

Parameters:
index -
Returns:
Throws:
OMException

setCache

public void setCache(boolean b)
Method setCache

Specified by:
setCache in interface OMXMLParserWrapper
Parameters:
b -

getName

public java.lang.String getName()
                         throws OMException
Method getName

Returns:
Throws:
OMException

getPrefix

public java.lang.String getPrefix()
                           throws OMException
Method getPrefix

Returns:
Throws:
OMException

getAttributeCount

public int getAttributeCount()
                      throws OMException
Method getAttributeCount

Returns:
Throws:
OMException

getAttributeNamespace

public java.lang.String getAttributeNamespace(int arg)
                                       throws OMException
Method getAttributeNamespace

Parameters:
arg -
Returns:
Throws:
OMException

getAttributeName

public java.lang.String getAttributeName(int arg)
                                  throws OMException
Method getAttributeName

Parameters:
arg -
Returns:
Throws:
OMException

getAttributePrefix

public java.lang.String getAttributePrefix(int arg)
                                    throws OMException
Method getAttributePrefix

Parameters:
arg -
Returns:
Throws:
OMException

getParser

public java.lang.Object getParser()
Method getParser

Specified by:
getParser in interface OMXMLParserWrapper
Returns:

isCompleted

public boolean isCompleted()
Method isCompleted

Specified by:
isCompleted in interface OMXMLParserWrapper
Returns:

createOMElement

protected abstract OMNode createOMElement()
                                   throws OMException
This method will be called with the XMLStreamConstants.START_ELEMENT event

Returns:
Throws:
OMException

next

public abstract int next()
                  throws OMException
This should proceed the parser one step further, if parser is not completed yet. If this has been called whist parser is done, then throw an OMException. If the cache is set to false, then should be return the event, *without* building the OM tree. If the cache is set to true, then this should handle all the events within this, and should build the object structure appropriately and return the event.

Specified by:
next in interface OMXMLParserWrapper
Returns:
Throws:
OMException

getBuilderType

public short getBuilderType()
Description copied from interface: OMXMLParserWrapper
Returns the type of the builder. Can be either the PUSH_TYPE_BUILDER or PULL_TYPE_BUILDER

Specified by:
getBuilderType in interface OMXMLParserWrapper
Returns:

registerExternalContentHandler

public void registerExternalContentHandler(java.lang.Object obj)
Method registerExternalContentHandler

Specified by:
registerExternalContentHandler in interface OMXMLParserWrapper
Parameters:
obj -

getRegisteredContentHandler

public java.lang.Object getRegisteredContentHandler()
Method getRegisteredContentHandler

Specified by:
getRegisteredContentHandler in interface OMXMLParserWrapper
Returns:

getDocument

public OMDocument getDocument()