org.apache.axiom.om.impl.builder
Class StAXBuilder

java.lang.Object
  extended byorg.apache.axiom.om.impl.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 be 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  boolean isDataHandlerAware
           
protected  OMNode lastNode
          Field lastNode
protected  OMFactory omfactory
          Field omfactory
protected  javax.xml.stream.XMLStreamReader parser
          Field parser
protected  boolean parserAccessed
          Field parserAccessed
 
Constructor Summary
protected StAXBuilder(OMFactory ombuilderFactory, javax.xml.stream.XMLStreamReader parser)
          Constructor StAXBuilder.
protected StAXBuilder(javax.xml.stream.XMLStreamReader parser)
          Constructor StAXBuilder.
 
Method Summary
protected abstract  OMNode createOMElement()
          This method is 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()
          Forwards the parser one step further, if parser is not completed yet.
protected  void processAttributes(OMElement node)
          Method processAttributes.
protected abstract  void processNamespaceData(OMElement node)
          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.axiom.om.OMXMLParserWrapper
getDocumentElement
 

Field Detail

parser

protected javax.xml.stream.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

isDataHandlerAware

protected boolean isDataHandlerAware
Constructor Detail

StAXBuilder

protected StAXBuilder(OMFactory ombuilderFactory,
                      javax.xml.stream.XMLStreamReader parser)
Constructor StAXBuilder.

Parameters:
ombuilderFactory -
parser -

StAXBuilder

protected StAXBuilder(javax.xml.stream.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)
Method processNamespaceData.

Parameters:
node -

processAttributes

protected void processAttributes(OMElement node)
Method processAttributes.

Parameters:
node -

createOMText

protected OMNode createOMText(int textType)
                       throws OMException
Method createOMText.

Returns:
Returns OMNode.
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:
Returns String.
Throws:
OMException

getNamespace

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

Returns:
Returns String.
Throws:
OMException

getNamespaceCount

public int getNamespaceCount()
                      throws OMException
Method getNamespaceCount.

Returns:
Returns int.
Throws:
OMException

getNamespacePrefix

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

Parameters:
index -
Returns:
Returns String.
Throws:
OMException

getNamespaceUri

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

Parameters:
index -
Returns:
Returns String.
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:
Returns String.
Throws:
OMException

getPrefix

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

Returns:
Returns String.
Throws:
OMException

getAttributeCount

public int getAttributeCount()
                      throws OMException
Method getAttributeCount.

Returns:
Returns int.
Throws:
OMException

getAttributeNamespace

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

Parameters:
arg -
Returns:
Returns String.
Throws:
OMException

getAttributeName

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

Parameters:
arg -
Returns:
Returns String.
Throws:
OMException

getAttributePrefix

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

Parameters:
arg -
Returns:
Returns String.
Throws:
OMException

getParser

public java.lang.Object getParser()
Method getParser.

Specified by:
getParser in interface OMXMLParserWrapper
Returns:
Returns Object.

isCompleted

public boolean isCompleted()
Method isCompleted.

Specified by:
isCompleted in interface OMXMLParserWrapper
Returns:
Returns boolean.

createOMElement

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

Returns:
Returns OMNode.
Throws:
OMException

next

public abstract int next()
                  throws OMException
Forwards the parser one step further, if parser is not completed yet. If this is called after parser is done, then throw an OMException. If the cache is set to false, then returns the event, *without* building the OM tree. If the cache is set to true, then handles all the events within this, and builds the object structure appropriately and returns the event.

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

getBuilderType

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

Specified by:
getBuilderType in interface OMXMLParserWrapper
Returns:
Returns short.

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:
Returns Object.

getDocument

public OMDocument getDocument()