com.gargoylesoftware.htmlunit.html
Class DomText

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.html.DomCharacterData
          extended by com.gargoylesoftware.htmlunit.html.DomText
All Implemented Interfaces:
Serializable, Cloneable

public class DomText
extends DomCharacterData

representation of a text node in the Html DOM

Version:
$Revision: 2132 $
Author:
David K. Taylor, Christian Sell, Rodney Gitzel, Ahmed Ashour
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator
 
Field Summary
static String NODE_NAME
          the symbolic node name
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
ATTRIBUTE_NODE, COMMENT_NODE, DOCUMENT_NODE, ELEMENT_NODE, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED, TEXT_NODE
 
Constructor Summary
DomText(Page page, String data)
          Create an instance of DomText
 
Method Summary
 String asText()
          Returns a text representation of this element that represents what would be visible to the user if this page was shown in a web browser.
 String getNodeName()
          Get the name for the current node.
 short getNodeType()
          Get the type of the current node.
protected  boolean isTrimmedText()
          Returns a flag indicating whether or not this node should have any leading and trailing whitespace removed when asText() is called; mostly this should be true, but must be false for such things as text formatting tags
protected  void printXml(String indent, PrintWriter printWriter)
          recursively write the XML data for the node tree starting at node
 DomText splitDomText(int offset)
          Split a DomText node in two.
 DomText splitText(int offset)
          Deprecated. This method conflicts with the W3C DOM API since the return values are different. Use splitDomText instead.
 String toString()
          Gives a simple representation to facilitate debugging
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomCharacterData
appendData, deleteData, getData, getLength, getNodeValue, insertData, replaceData, setData, setNodeValue, substringData
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, addPropertyChangeListener, appendChild, appendDomChild, asXml, cloneDomNode, cloneNode, fireNodeAdded, fireNodeDeleted, firePropertyChange, getAllHtmlChildElements, getByXPath, getChildIterator, getChildrenAsText, getEndColumnNumber, getEndLineNumber, getEventHandler, getFirstByXPath, getFirstChild, getFirstDomChild, getLastChild, getLastDomChild, getLocalName, getLog, getNamespaceURI, getNativePage, getNextDomSibling, getNextSibling, getPage, getParentDomNode, getParentNode, getPrefix, getPreviousDomSibling, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, hasAttributes, insertBefore, isAncestorOf, isRenderedVisible, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, reduceWhitespace, remove, removeAllChildren, removeDomChangeListener, removeEventHandler, removePropertyChangeListener, replace, setEventHandler, setEventHandler, setNextSibling, setParentNode, setPrefix, setPreviousSibling, setReadyState, setScriptObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NODE_NAME

public static final String NODE_NAME
the symbolic node name

See Also:
Constant Field Values
Constructor Detail

DomText

public DomText(Page page,
               String data)
Create an instance of DomText

Parameters:
page - The Page that contains this element.
data - the string data held by this node
Method Detail

splitText

public DomText splitText(int offset)
Deprecated. This method conflicts with the W3C DOM API since the return values are different. Use splitDomText instead.

Split a Text node in two.

Parameters:
offset - The character position at which to split the Text node.
Returns:
The Text node that was split from this node.

splitDomText

public DomText splitDomText(int offset)
Split a DomText node in two.

Parameters:
offset - The character position at which to split the DomText node.
Returns:
The DomText node that was split from this node.

asText

public String asText()
Returns a text representation of this element that represents what would be visible to the user if this page was shown in a web browser. For example, a single-selection select element would return the currently selected value as text.

Overrides:
asText in class DomNode
Returns:
The element as text.

getNodeType

public short getNodeType()
Description copied from class: DomNode
Get the type of the current node.

Specified by:
getNodeType in class DomNode
Returns:
the node type constant, in this case Node.TEXT_NODE

getNodeName

public String getNodeName()
Description copied from class: DomNode
Get the name for the current node.

Specified by:
getNodeName in class DomNode
Returns:
the node name, in this case NODE_NAME

printXml

protected void printXml(String indent,
                        PrintWriter printWriter)
recursively write the XML data for the node tree starting at node

Overrides:
printXml in class DomNode
Parameters:
indent - white space to indent child nodes
printWriter - writer where child nodes are written

toString

public String toString()
Gives a simple representation to facilitate debugging

Overrides:
toString in class Object
Returns:
a simple representation

isTrimmedText

protected boolean isTrimmedText()
Returns a flag indicating whether or not this node should have any leading and trailing whitespace removed when asText() is called; mostly this should be true, but must be false for such things as text formatting tags

Overrides:
isTrimmedText in class DomNode
Returns:
The flag


Copyright © 2002-2010 Gargoyle Software Inc.. All Rights Reserved.