org.apache.axiom.om.impl.llom
Class OMDocumentImpl

java.lang.Object
  extended byorg.apache.axiom.om.impl.llom.OMDocumentImpl
All Implemented Interfaces:
OMContainer, OMContainerEx, OMDocument
Direct Known Subclasses:
SOAPMessageImpl

public class OMDocumentImpl
extends java.lang.Object
implements OMDocument, OMContainerEx

Class OMDocumentImpl


Field Summary
protected  java.lang.String charSetEncoding
          Field charSetEncoding Default : UTF-8
protected  OMElement documentElement
          Field documentElement
protected  boolean done
          Field done
protected  OMFactory factory
           
protected  OMNode firstChild
          Field firstChild
protected  java.lang.String isStandalone
           
protected  OMNode lastChild
          Field lastChild
protected  OMXMLParserWrapper parserWrapper
          Field parserWrapper
protected  java.lang.String xmlVersion
          Field xmlVersion
 
Fields inherited from interface org.apache.axiom.om.OMDocument
XML_10, XML_11
 
Constructor Summary
OMDocumentImpl()
          Default constructor
OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper)
           
OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper, OMFactory factory)
          Create the OMDoucment with the factory and set the given OMElement as the document element
OMDocumentImpl(OMFactory factory)
          Create a OMDocument given the OMFactory
OMDocumentImpl(OMXMLParserWrapper parserWrapper)
           
OMDocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
          Create the OMDocument with the factory
 
Method Summary
 void addChild(OMNode child)
          Adds child to the element.
 void buildNext()
          Forces the parser to proceed, if parser has not yet finished with the XML input.
 java.lang.String getCharsetEncoding()
          Returns the character set encoding scheme to be used.
 java.util.Iterator getChildren()
          Returns a collection of this element.
 java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
          Searches for children with a given QName and returns an iterator to traverse through the OMNodes.
 OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
          Method getFirstChildWithName.
 OMNode getFirstOMChild()
          Method getFirstOMChild.
 OMElement getOMDocumentElement()
          Method getDocumentElement.
 OMFactory getOMFactory()
          Returns the OMFactory that created this object
 java.lang.String getXMLVersion()
          Returns the XML version.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the document with cache.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean includeXMLDeclaration)
          Serializes the document with cache.
protected  void internalSerialize(javax.xml.stream.XMLStreamWriter writer2, boolean cache, boolean includeXMLDeclaration)
           
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the document with the XML declaration.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer, boolean includeXMLDeclaration)
          Serialize the docuement with/without the XML declaration
 boolean isComplete()
          Indicates whether parser has parsed this information item completely or not.
 java.lang.String isStandalone()
          XML standalone value.
 void serialize(java.io.OutputStream output)
          Serializes the document directly to the output stream with caching enabled.
 void serialize(java.io.OutputStream output, OMOutputFormat format)
          Serializes the document directly to the output stream with caching enabled.
 void serializeAndConsume(java.io.OutputStream output)
          Serializes the document directly to the output stream with caching disabled.
 void serializeAndConsume(java.io.OutputStream output, OMOutputFormat format)
          Serializes the document directly to the output stream with caching disabled.
 void setCharsetEncoding(java.lang.String charEncoding)
          Sets the character set encoding scheme.
 void setComplete(boolean state)
          Method setComplete.
 void setFirstChild(OMNode firstChild)
          Method setFirstChild.
 void setOMDocumentElement(OMElement documentElement)
          Method setDocumentElement.
 void setStandalone(java.lang.String isStandalone)
           
 void setXMLVersion(java.lang.String xmlVersion)
          Sets the XML version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentElement

protected OMElement documentElement
Field documentElement


firstChild

protected OMNode firstChild
Field firstChild


lastChild

protected OMNode lastChild
Field lastChild


done

protected boolean done
Field done


parserWrapper

protected OMXMLParserWrapper parserWrapper
Field parserWrapper


charSetEncoding

protected java.lang.String charSetEncoding
Field charSetEncoding Default : UTF-8


xmlVersion

protected java.lang.String xmlVersion
Field xmlVersion


isStandalone

protected java.lang.String isStandalone

factory

protected OMFactory factory
Constructor Detail

OMDocumentImpl

public OMDocumentImpl()
Default constructor


OMDocumentImpl

public OMDocumentImpl(OMElement documentElement,
                      OMXMLParserWrapper parserWrapper)
Parameters:
documentElement -
parserWrapper -

OMDocumentImpl

public OMDocumentImpl(OMXMLParserWrapper parserWrapper)
Parameters:
parserWrapper -

OMDocumentImpl

public OMDocumentImpl(OMFactory factory)
Create a OMDocument given the OMFactory

Parameters:
factory - The OMFactory that created this instace

OMDocumentImpl

public OMDocumentImpl(OMXMLParserWrapper parserWrapper,
                      OMFactory factory)
Create the OMDocument with the factory

Parameters:
parserWrapper -
factory -

OMDocumentImpl

public OMDocumentImpl(OMElement documentElement,
                      OMXMLParserWrapper parserWrapper,
                      OMFactory factory)
Create the OMDoucment with the factory and set the given OMElement as the document element

Parameters:
documentElement -
parserWrapper -
factory -
Method Detail

getOMDocumentElement

public OMElement getOMDocumentElement()
Method getDocumentElement.

Specified by:
getOMDocumentElement in interface OMDocument
Returns:
Returns OMElement.

setOMDocumentElement

public void setOMDocumentElement(OMElement documentElement)
Method setDocumentElement.

Specified by:
setOMDocumentElement in interface OMDocument
Parameters:
documentElement -

isComplete

public boolean isComplete()
Indicates whether parser has parsed this information item completely or not. If some information is not available in the item, one has to check this attribute to make sure that, this item has been parsed completely or not.

Specified by:
isComplete in interface OMContainer
Returns:
Returns boolean.

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface OMContainerEx
Parameters:
state -

buildNext

public void buildNext()
Forces the parser to proceed, if parser has not yet finished with the XML input.

Specified by:
buildNext in interface OMContainer

addChild

public void addChild(OMNode child)
Adds child to the element. One can decide whether to append the child or to add to the front of the children list.

Specified by:
addChild in interface OMContainer
Parameters:
child -

getChildren

public java.util.Iterator getChildren()
Returns a collection of this element. Children can be of types OMElement, OMText.

Specified by:
getChildren in interface OMContainer
Returns:
Returns iterator.
See Also:
OMContainer.getFirstChildWithName(javax.xml.namespace.QName), OMContainer.getChildrenWithName(javax.xml.namespace.QName)

getChildrenWithName

public java.util.Iterator getChildrenWithName(javax.xml.namespace.QName elementQName)
Searches for children with a given QName and returns an iterator to traverse through the OMNodes. The QName can contain any combination of prefix, localname and URI.

Specified by:
getChildrenWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Returns Iterator.
Throws:
OMException

getFirstOMChild

public OMNode getFirstOMChild()
Method getFirstOMChild.

Specified by:
getFirstOMChild in interface OMContainer
Returns:
Returns first om child.

getFirstChildWithName

public OMElement getFirstChildWithName(javax.xml.namespace.QName elementQName)
                                throws OMException
Method getFirstChildWithName.

Specified by:
getFirstChildWithName in interface OMContainer
Parameters:
elementQName -
Returns:
Returns OMElement.
Throws:
OMException
See Also:
OMContainer.getChildrenWithName(javax.xml.namespace.QName)

setFirstChild

public void setFirstChild(OMNode firstChild)
Method setFirstChild.

Specified by:
setFirstChild in interface OMContainerEx
Parameters:
firstChild -

getCharsetEncoding

public java.lang.String getCharsetEncoding()
Returns the character set encoding scheme to be used.

Specified by:
getCharsetEncoding in interface OMDocument
Returns:
Returns charset.

setCharsetEncoding

public void setCharsetEncoding(java.lang.String charEncoding)
Sets the character set encoding scheme.

Specified by:
setCharsetEncoding in interface OMDocument
Parameters:
charEncoding -

isStandalone

public java.lang.String isStandalone()
Description copied from interface: OMDocument
XML standalone value. This will be yes, no or null (if not available)

Specified by:
isStandalone in interface OMDocument
Returns:
Returns boolean.

setStandalone

public void setStandalone(java.lang.String isStandalone)
Specified by:
setStandalone in interface OMDocument

getXMLVersion

public java.lang.String getXMLVersion()
Description copied from interface: OMDocument
Returns the XML version.

Specified by:
getXMLVersion in interface OMDocument
Returns:
Returns String.

setXMLVersion

public void setXMLVersion(java.lang.String xmlVersion)
Description copied from interface: OMDocument
Sets the XML version.

Specified by:
setXMLVersion in interface OMDocument
Parameters:
xmlVersion -
See Also:
XML 1.0, XML 1.1

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer,
                                        boolean includeXMLDeclaration)
                                 throws javax.xml.stream.XMLStreamException
Serialize the docuement with/without the XML declaration

Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Serializes the document with the XML declaration.

Throws:
javax.xml.stream.XMLStreamException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Serializes the document with cache.

Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching disabled.

Specified by:
serializeAndConsume in interface OMDocument
Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output)
               throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching enabled.

Specified by:
serialize in interface OMDocument
Parameters:
output -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching disabled.

Specified by:
serializeAndConsume in interface OMDocument
Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Serializes the document directly to the output stream with caching enabled.

Specified by:
serialize in interface OMDocument
Parameters:
output -
format -
Throws:
javax.xml.stream.XMLStreamException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
                              boolean includeXMLDeclaration)
                       throws javax.xml.stream.XMLStreamException
Serializes the document with cache.

Throws:
javax.xml.stream.XMLStreamException

internalSerialize

protected void internalSerialize(javax.xml.stream.XMLStreamWriter writer2,
                                 boolean cache,
                                 boolean includeXMLDeclaration)
                          throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getOMFactory

public OMFactory getOMFactory()
Description copied from interface: OMDocument
Returns the OMFactory that created this object

Specified by:
getOMFactory in interface OMDocument
Returns: