Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java
PREV | NEXT | SHOW LISTS | HIDE LISTS |

# Class com.ibm.xml.parser.TXText

    java.lang.Object
        |
        +----com.ibm.xml.parser.Child
                |
                +----com.ibm.xml.parser.TXText

Subclasses:
  TreeFactory.TreeText, TXCDATASection

public class TXText
extends Child
implements Text

The TXText class implements the Text interface as defined by the Document Object Model (DOM).

The Text object contains the non-markup content of an Element. If there is no markup inside an Element's content, the text will be contained in a single Text object that is the child of the Element. Any markup will parse into Child Elements that are siblings of the Text Nodes on either side of it, and whose content will be represented as Text Node children of the markup Element.

Version:
  1.1
See Also:
  Text, TXCDATASection

Fields inherited from class com.ibm.xml.parser.Child
ATTDEF, ATTLIST, DOCUMENTTYPE, ELEMENTDEFINITION, ENTITY, GENERALREFERENCE, NOTATION, PSEUDONODE

Constructor Summary
TXText(java.lang.String data) Constructor.

Method Summary
void | append(java.lang.String data) Append data to the end of the character data in this Text Node.
java.lang.Object | clone() Clone this Text Node using the appropriate factory.
void | delete(int offset, int count) Delete characters at the specified character offset.
java.lang.String | getData() Returns the actual content of the Text Node.
boolean | getIsIgnorableWhitespace() Returns, at the Text level, whether space is to be preserved.
java.lang.String | getLanguage() Returns the XML language ID (the value of the `xml:lang` attribute) in use for this Text Node.
int | getNodeType() Returns that this object is a Text Node.
java.lang.String | getText() Returns all text associated with this Node without considering entities.
void | insert(int offset, java.lang.String data) Insert data at the specified character offset.
static java.lang.String | makePrintable(java.lang.String string) Translate escape sequences in the specified string into printable characters.
void | replace(int offset, int count, java.lang.String data) Replace the characters starting at the specified character offset with the specified string.
void | setData(java.lang.String data) Sets the actual content of the Text Node.
void | setIsIgnorableWhitespace(boolean isIgnorableWhitespace) Sets, at the Text level, whether space is to be preserved.
void | splice(Element element, int offset, int count) Insert the specified Element as a sibling of this Text Node.
static java.lang.String | trim(java.lang.String string) Trim all leading and trailing whitespace in the specified String.
static java.lang.String | trim(java.lang.String string, boolean trimHead, boolean trimTail) Conditionally trim all leading and trailing whitespace in the specified String.

Methods inherited from class com.ibm.xml.parser.Child
clearDigest, clone, getChildNodes, getDigest, getFactory, getFirstChild, getNextSibling, getParentNode, getPreviousSibling, getText, hasChildNodes, insertBefore, makeXPointer, print, print, removeChild, replaceChild, searchAncestors, searchAncestors, setFactory, toString, toString

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

### TXText

    public TXText(java.lang.String data)

  Constructor.
  Parameters:
    `data` - The actual content of the Text Node.

Method Detail

### clone

    public java.lang.Object clone()

  Clone this Text Node using the appropriate factory.

  This method is defined by Child.

  Returns:
    Cloned Text Node.
  Overrides:
    clone in class Child
  See Also:
    clone

### getNodeType

    public int getNodeType()

  Returns that this object is a Text Node.

  This method is defined by DOM.

  Returns:
    Text Node indicator.

### getData

    public java.lang.String getData()

  Returns the actual content of the Text Node.
  Implements:
    getData in interface Text
  Returns:
    The actual content of the Text Node, or "" if no content.
  See Also:
    setData

### setData

    public void setData(java.lang.String data)

  Sets the actual content of the Text Node.
  Implements:
    setData in interface Text
  Parameters:
    `data` - The actual content of the Text Node.
  See Also:
    getData

### getText

    public java.lang.String getText()

  Returns all text associated with this Node without considering entities.

  This method is defined by Child.

  Returns:
    Text associated with this object, or "" if no Text.
  Overrides:
    getText in class Child
  See Also:
    toString, getData

### getIsIgnorableWhitespace

    public boolean getIsIgnorableWhitespace()

  Returns, at the Text level, whether space is to be preserved. This value is used, for example, to determine if space is to be preserved in Text Nodes during print() operations.
  Returns:
    `=true` space is to be preserved; `=false` space is to be ignored.
  See Also:
    setIsIgnorableWhitespace, setPreserveSpace, setPreserveSpace

### setIsIgnorableWhitespace

    public void setIsIgnorableWhitespace(boolean isIgnorableWhitespace)

  Sets, at the Text level, whether space is to be preserved. This value is used, for example, to determine if space is to be preserved in Text Nodes during print() operations.
  Returns:
    isIgnorableWhitespace `=true` space is to be preserved; `=false` space is to be ignored.
  See Also:
    getIsIgnorableWhitespace, setPreserveSpace, setPreserveSpace

### getLanguage

    public java.lang.String getLanguage()

  Returns the XML language ID (the value of the `xml:lang` attribute) in use for this Text Node. If this Text Node has no explicitly defined language attribute, Parent Nodes will be recursively checked.
  Returns:
    The XML language ID, or null if all Parents have no language ID.

### append

    public void append(java.lang.String data)

  Append data to the end of the character data in this Text Node.

  This method is defined by DOM.

  Implements:
    append in interface Text
  Parameters:
    `data` - Data to append to existing character data in this Text Node.
  See Also:
    insert, replace

### insert

    public void insert(int offset,
                       java.lang.String data)

  Insert data at the specified character offset.

  This method is defined by DOM.

  Implements:
    insert in interface Text
  Parameters:
    `offset` - 0-based offset into existing character data in this Text Node.
    `data` - Data to insert into existing character data in this Text Node.
  See Also:
    append, replace

### delete

    public void delete(int offset,
                       int count)

  Delete characters at the specified character offset.

  This method is defined by DOM.

  Implements:
    delete in interface Text
  Parameters:
    `offset` - 0-based offset into existing character data in this Text Node.
    `count` - Number of characters to delete.
  See Also:
    append, replace

### replace

    public void replace(int offset,
                        int count,
                        java.lang.String data)

  Replace the characters starting at the specified character offset with the specified string.

  This method is defined by DOM.

  Implements:
    replace in interface Text
  Parameters:
    `offset` - 0-based offset into existing character data in this Text Node.
    `count` - Number of existing characters to replace.
    `data` - Data to insert into existing character data in this Text Node.
  See Also:
    append, insert, delete

### splice

    public void splice(Element element,
                       int offset,
                       int count) throws java.lang.IllegalArgumentException, java.lang.RuntimeException

  Insert the specified Element as a sibling of this Text Node. The result of this operation may be the creation of up to 2 new Text Nodes: the character data specified by the offset and count will form one Text Node that will become the Child of the inserted Element, and the remainder of the character data (after the offset and count) will form another Text Node, becoming a sibling of this Text Node.

  This method is defined by DOM.

  Implements:
    splice in interface Text
  Parameters:
    `element` - The Element to insert in the tree; this instance must be an instance of TXElement.
    `offset` - 0-based offset into existing character data in this Text Node.
    `count` - Number of characters to copy to Child Text Node of Element.
  Throws:
    java.lang.IllegalArgumentException - Thrown if element is not a TXElement.
    java.lang.RuntimeException - Thrown if this Text Node has no Parent.

### trim

    public static java.lang.String trim(java.lang.String string)

  Trim all leading and trailing whitespace in the specified String. All strings of white space are replaced by a single space character (#x20).
  Parameters:
    `string` - String to be trimmed.
  Returns:
    The trimmed string.

### trim

    public static java.lang.String trim(java.lang.String string,
                              boolean trimHead,
                              boolean trimTail)

  Conditionally trim all leading and trailing whitespace in the specified String. All strings of white space are replaced by a single space character (#x20).
  Parameters:
    `string` - String to be trimmed.
    `trimHead` - Trim leading whitespace?
    `trimTail` - Trim trailing whitespace?
  Returns:
    The trimmed string.

### makePrintable

    public static java.lang.String makePrintable(java.lang.String string)

  Translate escape sequences in the specified string into printable characters. For example, \r is translated into \\r.
  Parameters:
    `string` - String to translate.
  Returns:
    The translated string.

Contents | Package | Class | Tree | Deprecated | Index | Help |
PREV | NEXT | SHOW LISTS | HIDE LISTS |