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

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

public class OMDocumentImpl
extends OMSerializableImpl
implements OMDocument, OMContainerEx

Class OMDocumentImpl


Field Summary
protected  String charSetEncoding
          Field charSetEncoding Default : UTF-8
protected  OMElement documentElement
          Field documentElement
protected  OMNode firstChild
          Field firstChild
protected  String isStandalone
           
protected  OMNode lastChild
          Field lastChild
protected  String xmlVersion
          Field xmlVersion
 
Fields inherited from class org.apache.axiom.om.impl.llom.OMSerializableImpl
builder, done, factory
 
Fields inherited from interface org.apache.axiom.om.OMDocument
XML_10, XML_11
 
Constructor Summary
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, 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.
 String getCharsetEncoding()
          Returns the character set encoding scheme to be used.
 Iterator getChildren()
          Returns a collection of this element.
 Iterator getChildrenWithLocalName(String localName)
          Returns an iterator for child nodes matching the local name.
 Iterator getChildrenWithName(QName elementQName)
          Searches for children with a given QName and returns an iterator to traverse through the OMNodes.
 Iterator getChildrenWithNamespaceURI(String uri)
          Returns an iterator for child nodes matching the namespace uri.
 OMElement getFirstChildWithName(QName elementQName)
          Method getFirstChildWithName.
 OMNode getFirstOMChild()
          Method getFirstOMChild.
 OMNode getFirstOMChildIfAvailable()
          Get the first child if it is available.
 OMElement getOMDocumentElement()
          Method getDocumentElement.
 String getXMLVersion()
          Returns the XML version.
 void internalSerialize(XMLStreamWriter writer)
          Serializes the document with cache.
 void internalSerialize(XMLStreamWriter writer, boolean cache)
          Serializes the node.
protected  void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration)
           
 void internalSerializeAndConsume(XMLStreamWriter writer)
          Serializes the document with the XML declaration.
 String isStandalone()
          XML standalone value.
 void setCharsetEncoding(String charEncoding)
          Sets the character set encoding scheme.
 void setComplete(boolean state)
          Method setComplete.
 void setFirstChild(OMNode firstChild)
          Method setFirstChild.
 void setLastChild(OMNode omNode)
          Forcefully set the last child
 void setOMDocumentElement(OMElement documentElement)
          Method setDocumentElement.
 void setStandalone(String isStandalone)
           
 void setXMLVersion(String xmlVersion)
          Sets the XML version.
 
Methods inherited from class org.apache.axiom.om.impl.llom.OMSerializableImpl
build, close, getOMFactory, isComplete, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
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.OMContainer
serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.OMContainer
serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
 

Field Detail

documentElement

protected OMElement documentElement
Field documentElement


firstChild

protected OMNode firstChild
Field firstChild


lastChild

protected OMNode lastChild
Field lastChild


charSetEncoding

protected String charSetEncoding
Field charSetEncoding Default : UTF-8


xmlVersion

protected String xmlVersion
Field xmlVersion


isStandalone

protected String isStandalone
Constructor Detail

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 -

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface OMContainerEx
Specified by:
setComplete in class OMSerializableImpl
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 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 Iterator getChildrenWithName(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

getChildrenWithLocalName

public Iterator getChildrenWithLocalName(String localName)
Description copied from interface: OMContainer
Returns an iterator for child nodes matching the local name.

Specified by:
getChildrenWithLocalName in interface OMContainer
Returns:
Returns an iterator of OMElement items that match the given localName

getChildrenWithNamespaceURI

public Iterator getChildrenWithNamespaceURI(String uri)
Description copied from interface: OMContainer
Returns an iterator for child nodes matching the namespace uri.

Specified by:
getChildrenWithNamespaceURI in interface OMContainer
Returns:
Returns an iterator of OMElement items that match the given uri

getFirstOMChild

public OMNode getFirstOMChild()
Method getFirstOMChild.

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

getFirstOMChildIfAvailable

public OMNode getFirstOMChildIfAvailable()
Description copied from interface: OMContainerEx
Get the first child if it is available. The child is available if it is complete or if the builder has started building the node. In the latter case, OMSerializable.isComplete() may return false when called on the child. In contrast to OMContainer.getFirstOMChild(), this method will never modify the state of the underlying parser.

Specified by:
getFirstOMChildIfAvailable in interface OMContainerEx
Returns:
the first child or null if the container has no children or the builder has not yet started to build the first child

getFirstChildWithName

public OMElement getFirstChildWithName(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 -

setLastChild

public void setLastChild(OMNode omNode)
Forcefully set the last child

Specified by:
setLastChild in interface OMContainerEx
Parameters:
omNode -

getCharsetEncoding

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

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

setCharsetEncoding

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

Specified by:
setCharsetEncoding in interface OMDocument
Parameters:
charEncoding -

isStandalone

public 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(String isStandalone)
Specified by:
setStandalone in interface OMDocument

getXMLVersion

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

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

setXMLVersion

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

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

internalSerialize

public void internalSerialize(XMLStreamWriter writer,
                              boolean cache)
                       throws XMLStreamException
Description copied from class: OMSerializableImpl
Serializes the node.

Specified by:
internalSerialize in class OMSerializableImpl
Throws:
XMLStreamException

internalSerialize

protected void internalSerialize(XMLStreamWriter writer,
                                 boolean cache,
                                 boolean includeXMLDeclaration)
                          throws XMLStreamException
Throws:
XMLStreamException

internalSerializeAndConsume

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

Throws:
XMLStreamException

internalSerialize

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

Throws:
XMLStreamException


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.