xpointer
Class TextTree
java.lang.Object
|
+--xpointer.TextTree
- public class TextTree
- extends java.lang.Object
This class represents the text nodes which are descendant of a given node.
It provides some useful operations on text nodes.
Constructor Summary |
TextTree(org.w3c.dom.Node rootNode)
Creates new TextTree |
TextTree(org.w3c.dom.ranges.Range range)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TextTree
public TextTree(org.w3c.dom.Node rootNode)
- Creates new TextTree
- Parameters:
rootNode
- the root of the tree
TextTree
public TextTree(org.w3c.dom.ranges.Range range)
getTextNodeFragments
public TextNodeFragment[] getTextNodeFragments()
retrievePointAfter
public TextPoint retrievePointAfter(int numcar,
boolean beginning)
- Returns the object TextPoint which points after the specified number of charactes
in the document fragment.
If the specified number is greater than the number of characters contained in the fragment, null
is returned.
- Parameters:
numcar
- the number of charatres,it must be non-negativebeginning
- if true, when the point is between two text nodes, it is positioned at the beginnig
of the second one; if false, it is positioned at the end of the first one.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
importTextPoint
public TextPoint importTextPoint(TextPoint textPoint)
- Imports a TextPoint object which belongs to another tree.
- Parameters:
textPoint
- the textPoint to be imported- Returns:
- the imported TextPoint
getLast
public org.w3c.dom.Node getLast()
- Returns the last text node in the tree.
If the rooto of the tree is a range, the returned node may not be completely contained in
the range.
retrieveRangeAfter
public org.w3c.dom.ranges.Range[] retrieveRangeAfter(TextPoint textPoint,
int numcar)
- Returns the points (collapsed ranges) found after a certain
amount of characters starting from a given point.
For example, a word of five characters returns six points.
It is useful when string-range is called with an empty string.
- Parameters:
textPoint
- the starting text pointnumcar
- the number of examined characters- Returns:
- an array of points (collapsed ranges)