org.apache.axiom.om.impl.dom
Class TextImpl

java.lang.Object
  extended byorg.apache.axiom.om.impl.dom.NodeImpl
      extended byorg.apache.axiom.om.impl.dom.ChildNode
          extended byorg.apache.axiom.om.impl.dom.CharacterImpl
              extended byorg.apache.axiom.om.impl.dom.TextImpl
All Implemented Interfaces:
org.w3c.dom.CharacterData, java.lang.Cloneable, org.w3c.dom.Node, org.w3c.dom.NodeList, OMNode, OMNodeEx, OMText, org.w3c.dom.Text

public class TextImpl
extends CharacterImpl
implements org.w3c.dom.Text, OMText


Field Summary
protected  OMAttribute attribute
          Field attribute is used when serializing Binary stuff as MTOM optimized.
protected  java.lang.String localName
          Field localName is used when serializing Binary stuff as MTOM optimized.
protected  OMNamespace ns
          Field nameSpace is used when serializing Binary stuff as MTOM optimized.
 
Fields inherited from class org.apache.axiom.om.impl.dom.CharacterImpl
textValue
 
Fields inherited from class org.apache.axiom.om.impl.dom.ChildNode
nextSibling, parentNode, previousSibling
 
Fields inherited from class org.apache.axiom.om.impl.dom.NodeImpl
builder, done, factory, FIRSTCHILD, flags, nodeType, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from interface org.apache.axiom.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Constructor Summary
TextImpl(DocumentImpl ownerNode, java.lang.Object dataHandler, boolean optimize, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, java.lang.String value, OMFactory factory)
           
TextImpl(DocumentImpl ownerNode, java.lang.String value, java.lang.String mimeType, boolean optimize, OMFactory factory)
           
TextImpl(java.lang.String contentID, OMElement parent, OMXMLParserWrapper builder, OMFactory factory)
           
TextImpl(java.lang.String text, OMFactory factory)
          Creates a text node with the given text required by the OMDOMFactory.
TextImpl(java.lang.String text, java.lang.String mimeType, boolean optimize, boolean isBinary, OMFactory factory)
           
TextImpl(java.lang.String text, java.lang.String mimeType, boolean optimize, OMFactory factory)
           
 
Method Summary
 org.w3c.dom.Node cloneNode(boolean deep)
           
 void discard()
          Discards a node.
 java.lang.String getContentID()
          Gets the content id.
 java.lang.Object getDataHandler()
          Gets the datahandler.
 java.io.InputStream getInputStream()
           
 java.lang.String getNodeName()
           
 short getNodeType()
           
 java.lang.String getNodeValue()
           
 java.lang.String getText()
          Returns the text value of this node.
 javax.xml.namespace.QName getTextAsQName()
           
 char[] getTextCharacters()
           
 int getType()
          Returns the type of node.
 java.lang.String getWholeText()
           
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node with caching.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node without caching.
 boolean isCharacters()
           
 boolean isElementContentWhitespace()
           
 boolean isOptimized()
           
 org.w3c.dom.Text replaceWholeText(java.lang.String arg0)
           
 void setOptimize(boolean value)
          Sets the optimize flag.
 void setType(int nodeType)
           
 org.w3c.dom.Text splitText(int offset)
          Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.axiom.om.impl.dom.CharacterImpl
appendData, deleteData, getData, getLength, insertData, replaceData, setData, substringData
 
Methods inherited from class org.apache.axiom.om.impl.dom.ChildNode
detach, getNextOMSibling, getNextSibling, getParent, getParentNode, getPreviousOMSibling, getPreviousSibling, insertSiblingAfter, insertSiblingBefore, setNextOMSibling, setParent, setPreviousOMSibling
 
Methods inherited from class org.apache.axiom.om.impl.dom.NodeImpl
appendChild, build, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getOMFactory, getOwnerDocument, getPrefix, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, internalSerializeWithCache, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNodeValue, setOwnerDocument, setPrefix, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.CharacterData
appendData, deleteData, getData, getLength, insertData, replaceData, setData, substringData
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface org.apache.axiom.om.OMNode
build, detach, getNextOMSibling, getOMFactory, getParent, getPreviousOMSibling, insertSiblingAfter, insertSiblingBefore, isComplete, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 

Field Detail

ns

protected OMNamespace ns
Field nameSpace is used when serializing Binary stuff as MTOM optimized.


localName

protected java.lang.String localName
Field localName is used when serializing Binary stuff as MTOM optimized.


attribute

protected OMAttribute attribute
Field attribute is used when serializing Binary stuff as MTOM optimized.

Constructor Detail

TextImpl

public TextImpl(java.lang.String text,
                OMFactory factory)
Creates a text node with the given text required by the OMDOMFactory. The owner document should be set properly when appending this to a DOM tree.

Parameters:
text -

TextImpl

public TextImpl(java.lang.String contentID,
                OMElement parent,
                OMXMLParserWrapper builder,
                OMFactory factory)
Parameters:
contentID -
parent -
builder - Used when the builder is encountered with a XOP:Include tag Stores a reference to the builder and the content-id. Supports deffered parsing of MIME messages

TextImpl

public TextImpl(java.lang.String text,
                java.lang.String mimeType,
                boolean optimize,
                OMFactory factory)

TextImpl

public TextImpl(java.lang.String text,
                java.lang.String mimeType,
                boolean optimize,
                boolean isBinary,
                OMFactory factory)

TextImpl

public TextImpl(DocumentImpl ownerNode,
                java.lang.Object dataHandler,
                boolean optimize,
                OMFactory factory)
Parameters:
dataHandler -
optimize - To send binary content. Created progrmatically.

TextImpl

public TextImpl(DocumentImpl ownerNode,
                OMFactory factory)
Parameters:
ownerNode -

TextImpl

public TextImpl(DocumentImpl ownerNode,
                java.lang.String value,
                OMFactory factory)
Parameters:
ownerNode -
value -

TextImpl

public TextImpl(DocumentImpl ownerNode,
                java.lang.String value,
                java.lang.String mimeType,
                boolean optimize,
                OMFactory factory)
Parameters:
ownerNode -
value -
Method Detail

splitText

public org.w3c.dom.Text splitText(int offset)
                           throws org.w3c.dom.DOMException
Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the offset point. A new node of the same type, which contains all the content at and after the offset point, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the offset is equal to the length of this node, the new node has no data.

Specified by:
splitText in interface org.w3c.dom.Text
Throws:
org.w3c.dom.DOMException

getNodeName

public java.lang.String getNodeName()
Specified by:
getNodeName in interface org.w3c.dom.Node

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface org.w3c.dom.Node

getType

public int getType()
            throws OMException
Description copied from interface: OMNode
Returns the type of node.

Specified by:
getType in interface OMNode
Returns:
Returns one of OMNode.ELEMENT_NODE, OMNode.TEXT_NODE, OMNode.CDATA_SECTION_NODE, OMNode.COMMENT_NODE, OMNode.DTD_NODE, OMNode.PI_NODE, OMNode.ENTITY_REFERENCE_NODE, OMNode.SPACE_NODE, or OMNode.TEXT_NODE.
Throws:
OMException

setType

public void setType(int nodeType)
             throws OMException
Specified by:
setType in interface OMNodeEx
Throws:
OMException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNodeEx
Serializes the node with caching.

Specified by:
internalSerialize in interface OMNodeEx
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNodeEx
Serializes the node without caching.

Specified by:
internalSerializeAndConsume in interface OMNodeEx
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

isOptimized

public boolean isOptimized()
Specified by:
isOptimized in interface OMText
Returns:
Returns boolean flag saying whether the node contains an optimized text or not.

setOptimize

public void setOptimize(boolean value)
Description copied from interface: OMText
Sets the optimize flag.

Specified by:
setOptimize in interface OMText
Parameters:
value -

discard

public void discard()
             throws OMException
Description copied from interface: OMNode
Discards a node.

Discard goes to the parser level and if the element is not completely built, then it will be completely skipped at the parser level.

Specified by:
discard in interface OMNode
Overrides:
discard in class ChildNode
Throws:
OMException

getText

public java.lang.String getText()
Description copied from interface: OMText
Returns the text value of this node.

Specified by:
getText in interface OMText
Returns:
Returns String.

getTextCharacters

public char[] getTextCharacters()
Specified by:
getTextCharacters in interface OMText

isCharacters

public boolean isCharacters()
Specified by:
isCharacters in interface OMText

getTextAsQName

public javax.xml.namespace.QName getTextAsQName()
Specified by:
getTextAsQName in interface OMText

getNodeValue

public java.lang.String getNodeValue()
                              throws org.w3c.dom.DOMException
Specified by:
getNodeValue in interface org.w3c.dom.Node
Overrides:
getNodeValue in class NodeImpl
Throws:
org.w3c.dom.DOMException

getContentID

public java.lang.String getContentID()
Description copied from interface: OMText
Gets the content id.

Specified by:
getContentID in interface OMText
Returns:
Returns String.

getDataHandler

public java.lang.Object getDataHandler()
Description copied from interface: OMText
Gets the datahandler.

Specified by:
getDataHandler in interface OMText
Returns:
Returns datahandler.

getInputStream

public java.io.InputStream getInputStream()
                                   throws OMException
Throws:
OMException

cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Specified by:
cloneNode in interface org.w3c.dom.Node
Overrides:
cloneNode in class ChildNode

getWholeText

public java.lang.String getWholeText()

isElementContentWhitespace

public boolean isElementContentWhitespace()

replaceWholeText

public org.w3c.dom.Text replaceWholeText(java.lang.String arg0)
                                  throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

toString

public java.lang.String toString()