Class com.ibm.xml.xpointer.XPointer
java.lang.Object
|
+----com.ibm.xml.xpointer.XPointer
- public class XPointer
- extends java.lang.Object
- implements java.io.Serializable
The XPointer class provides support for addressing into the internal structures of XML documents
as defined by WD-xptr-19980303.
An XPointer consists of a series of location terms, each of which specifies a location,
usually relative to the location specified by the prior location term. Each location term
has a keyword (such as id, child, ancestor, and so on) and can have arguments such as an
instance number, element type, or attribute. For example, the location term child(2,CHAP)
refers to the second child element whose type is CHAP
.
Location terms are classified into absolute terms, relative terms, span terms,
attribute terms, and string data terms. An absolute term selects one or more elements or
locations in an XML document without reference to any other sub-resource location. A
relative or string data term specifies a location in terms of another location, called the
location source . The location source is the entire resource if there are no preceding
location terms; otherwise it is the location specified by the preceding term (which might
be relative to a location term before that).
- Version:
- Revision: 83 1.4 src/com/ibm/xml/xpointer/XPointer.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
- See Also:
- AbsTerm, RelTerm, SpanTerm, AttrTerm, StringTerm
Method Summary
|
void
|
appendOtherTerm(OtherTerm otherTerm)
Appends the specified otherTerm to the end of the other terms
for this XPointer.
|
AbsTerm
|
getAbsTerm()
Returns the absolute location term of this XPointer.
|
java.util.Vector
|
getOtherTermsVector()
Returns a Vector of Relterm, SpanTerm, AttrTerm, and StringTerm items which comprise
the other terms of this XPointer.
|
void
|
insertOtherTerm(OtherTerm otherTerm)
Inserts the specified otherTerm to the beginning of the other terms
for this XPointer.
|
static XPointer
|
makeXPointer(Child targetNode)
Returns an XPointer instance representing the specified targetNode.
|
Pointed
|
point(TXDocument document)
Returns the locations in the specified document that are satisfied by this XPointer.
|
Pointed
|
point(Node originNode)
Returns the locations in the specified originNode that are satisfied by this XPointer.
|
OtherTerm
|
removeLastOtherTerm()
Returns and removes the OtherTerm at the end of this XPointer.
|
void
|
setAbsTerm(AbsTerm absTerm)
Sets the absolute location term of this XPointer.
|
java.lang.String
|
toString()
Returns this XPointer in the form of either:
absoluteTerm
absoluteTerm.otherTerm
absoluteTerm.otherTerm.otherTerm...
otherTerm
otherTerm.otherTerm...
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
S_ALL
public static final java.lang.String S_ALL
S_END
public static final java.lang.String S_END
NT_NONE
public static final int NT_NONE
NT_NAME
public static final int NT_NAME
NT_ELEMENT
public static final int NT_ELEMENT
NT_PI
public static final int NT_PI
NT_COMMENT
public static final int NT_COMMENT
NT_TEXT
public static final int NT_TEXT
NT_CDATA
public static final int NT_CDATA
NT_ALL
public static final int NT_ALL
nodetypes
public static final java.lang.String[] nodetypes
S_ELEMENT
public static final java.lang.String S_ELEMENT
S_PI
public static final java.lang.String S_PI
S_COMMENT
public static final java.lang.String S_COMMENT
S_TEXT
public static final java.lang.String S_TEXT
S_CDATA
public static final java.lang.String S_CDATA
S_NIMPLIED
public static final java.lang.String S_NIMPLIED
S_IMPLIED
public static final java.lang.String S_IMPLIED
literals
public static final java.lang.String[] literals
ST_NONE
public static final int ST_NONE
ST_ROOT
public static final int ST_ROOT
ST_ORIGIN
public static final int ST_ORIGIN
ST_ID
public static final int ST_ID
ST_HTML
public static final int ST_HTML
ST_CHILD
public static final int ST_CHILD
ST_DESCENDANT
public static final int ST_DESCENDANT
ST_ANCESTOR
public static final int ST_ANCESTOR
ST_PRECEDING
public static final int ST_PRECEDING
ST_PSIBLING
public static final int ST_PSIBLING
ST_FOLLOWING
public static final int ST_FOLLOWING
ST_FSIBLING
public static final int ST_FSIBLING
ST_SPAN
public static final int ST_SPAN
ST_ATTR
public static final int ST_ATTR
ST_STRING
public static final int ST_STRING
T_IMPLIED
public static final int T_IMPLIED
T_ANY
public static final int T_ANY
T_NAME
public static final int T_NAME
T_EXACT
public static final int T_EXACT
XPointer
public XPointer(AbsTerm absTerm,
java.util.Vector otherTerms)
- Constructor.
- Parameters:
absTerm
- Absolute term of XPointer. Specification of null
is allowed.
otherTerms
- A vector of OtherTerm instances. Specification of null
is allowed.
- See Also:
- AbsTerm, OtherTerm
getAbsTerm
public AbsTerm getAbsTerm()
- Returns the absolute location term of this XPointer.
- Returns:
- This XPointer's absolute location term, or
null
if no absolute term. - See Also:
- setAbsTerm, AbsTerm
setAbsTerm
public void setAbsTerm(AbsTerm absTerm)
- Sets the absolute location term of this XPointer.
- Parameters:
absTerm
- This XPointer's absolute location term, or null
if no absolute term.
- See Also:
- getAbsTerm, AbsTerm
getOtherTermsVector
public java.util.Vector getOtherTermsVector()
- Returns a Vector of Relterm, SpanTerm, AttrTerm, and StringTerm items which comprise
the other terms of this XPointer.
- Returns:
- This XPointer's other terms, or null if no other terms.
- See Also:
- RelTerm, AttrTerm, StringTerm, SpanTerm, OtherTerm, appendOtherTerm, insertOtherTerm, removeLastOtherTerm
appendOtherTerm
public void appendOtherTerm(OtherTerm otherTerm)
- Appends the specified otherTerm to the end of the other terms
for this XPointer.
- Parameters:
otherTerm
- The RelTerm, AttrTerm, StringTerm, or SpanTerm to be appended.
- See Also:
- RelTerm, AttrTerm, StringTerm, SpanTerm, OtherTerm, getOtherTermsVector, insertOtherTerm, removeLastOtherTerm
insertOtherTerm
public void insertOtherTerm(OtherTerm otherTerm)
- Inserts the specified otherTerm to the beginning of the other terms
for this XPointer.
- Parameters:
otherTerm
- The RelTerm, AttrTerm, StringTerm, or SpanTerm to be inserted.
- See Also:
- RelTerm, AttrTerm, StringTerm, SpanTerm, OtherTerm, getOtherTermsVector, appendOtherTerm, removeLastOtherTerm
removeLastOtherTerm
public OtherTerm removeLastOtherTerm()
- Returns and removes the OtherTerm at the end of this XPointer.
- Returns:
- The RelTerm, AttrTerm, StringTerm, or SpanTerm that was at the end
of this XPointer's other term Vector, or null if there
are no existing other terms.
- See Also:
- RelTerm, AttrTerm, StringTerm, SpanTerm, OtherTerm, getOtherTermsVector, appendOtherTerm, insertOtherTerm
toString
public java.lang.String toString()
- Returns this XPointer in the form of either:
absoluteTerm
absoluteTerm.otherTerm
absoluteTerm.otherTerm.otherTerm...
otherTerm
otherTerm.otherTerm...
- Returns:
- A string represention of this XPointer.
- Overrides:
- toString in class java.lang.Object
- See Also:
- toString, toString, toString, toString, toString
point
public Pointed point(TXDocument document)
- Returns the locations in the specified document that are satisfied by this XPointer.
- The following terms of this XPointer are not currently supported:
origin()
html()
span()
string()
- Parameters:
document
- TXDocument instance to be examined.
- Returns:
- Matched locations (should never be null).
- See Also:
- Pointed, TXDocument
point
public Pointed point(Node originNode)
- Returns the locations in the specified originNode that are satisfied by this XPointer.
- The following terms of this XPointer are not currently supported:
span()
string()
- Parameters:
originNode
- Node instance to be examined.
- Returns:
- Matched locations (should never be null).
- See Also:
- Pointed, Child
makeXPointer
public static XPointer makeXPointer(Child targetNode)
- Returns an XPointer instance representing the specified targetNode.
- Parameters:
targetNode
- Node to be represented as an XPointer.
- Returns:
- XPointer instance, or null if targetNode can not be
represented by an XPointer.
- See Also:
- makeXPointer