Class Text

All Implemented Interfaces:
DeepPassByCopy, Iteratable, Marker, PassByConstruction, Persistent, Selfless, Serializable

Deprecated. Use Term trees instead.

public class Text
extends Node

Untamed: This represents text that appears between a start-tag and end-tag, after all escapes and whitespace have been processed.

This is a substantial revision by of the file as released by the w3c, as is allowed by the license. See the package comment. For this dom, the only kind of character-data is text, so we folded together the original superclass CharacterData into its subclass Text.

Original comment from CharacterData:

The CharacterData interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to CharacterData , though Text and others do inherit the interface from it. All offsets in this interface start from 0.

As explained in the DOMString interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term 16-bit units is used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

Original comment of Text:

The Text interface inherits from CharacterData and represents the textual content (termed character data in XML) of an Element or Attr . If there is no markup inside an element's content, the text is contained in a single object implementing the Text interface that is the only child of the element. If there is markup, it is parsed into the information items (elements, comments, etc.) and Text nodes that form the list of children of the element.

When a document is first made available via the DOM, there is only one Text node for each block of text. Users may create adjacent Text nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The normalize() method on Element merges any such adjacent Text objects into a single node for each block of text.

See Also:
Serialized Form

Field Summary
private  String myData
private static Node[] NO_NODES
(package private) static long serialVersionUID
static StaticMaker TextMaker
          Deprecated. Enabled:
Fields inherited from class org.capml.dom.Node
Fields inherited from interface org.erights.e.elib.serial.Persistent
Fields inherited from interface org.erights.e.elib.serial.DeepPassByCopy
Constructor Summary
Text(String data)
          Deprecated. Enabled:
Method Summary
 Astro build(AstroBuilder builder)
          Deprecated. Enabled: Returns an Astro (eg, AstroToken or Term) consisting of this literal text (as a leaf) and zero arguments.
 ConstList getChildNodes()
          Deprecated. Enabled: An empty list, since Text has no children
 String getData()
          Deprecated. Enabled: The character data of the node that implements this interface.
 short getNodeType()
          Deprecated. Enabled:
 Object[] getSpreadUncall()
          Deprecated. Enabled: Uses 'TextMaker(myData)'
(package private)  Node[] minimize(Node optLeft)
          Deprecated. Asks this Node to return a minimal form of the optional node to the left of itself and itself.
 void prettyPrintOn(TextWriter out, boolean quasiFlag)
          Deprecated. Enabled:
 Object welcome(Object visitor)
          Deprecated. Enabled: Does 'visitor viewText(myData)'.
Methods inherited from class org.capml.dom.Node
__printOn, iterate, minimize, supports
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


static final long serialVersionUID


public static final StaticMaker TextMaker


private static final Node[] NO_NODES


private final String myData
Constructor Detail


public Text(String data)

Method Detail


public Object[] getSpreadUncall()
Enabled: Uses 'TextMaker(myData)'


public short getNodeType()

Specified by:
getNodeType in class Node


public ConstList getChildNodes()
Enabled: An empty list, since Text has no children

Specified by:
getChildNodes in class Node


public String getData()
Enabled: The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString . In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.


public Object welcome(Object visitor)
Enabled: Does 'visitor viewText(myData)'.

Called "view" rather than "visit" to keep it distinct from Element-tag-based visitation.

Specified by:
welcome in class Node


public void prettyPrintOn(TextWriter out,
                          boolean quasiFlag)
                   throws IOException

Specified by:
prettyPrintOn in class Node


public Astro build(AstroBuilder builder)
Enabled: Returns an Astro (eg, AstroToken or Term) consisting of this literal text (as a leaf) and zero arguments.

Specified by:
build in class Node


Node[] minimize(Node optLeft)
Description copied from class: Node
Asks this Node to return a minimal form of the optional node to the left of itself and itself.

If the node to the left is provided (ie, if 'optLeft' isn't null), then this node may safely assume that this provided sibling has already been minimized.

The minimization is much like XML canonicalization, but depends on an assumption specific to Minimal-XML: That for an Element that contains sub-Elements, all pure-whitespace Texts that it also contains may be gotten rid of.

The number of nodes returned cannot exceed the number examined. In other words, if 'optLeft' is null, only zero or one node may be returned. If 'optLeft' isn't null, the number returned may only be zero, one, or two.

Specified by:
minimize in class Node
A list of nodes to replace 'optLeft' and itself.