public class NodePath extends Object
Constructor and Description |
---|
NodePath()
Constructor.
|
NodePath(String path)
Construct a node path from a string representation.
|
Modifier and Type | Method and Description |
---|---|
void |
appendSegment(String value)
Adds a non-index segment to the end of the path.
|
void |
appendSegment(String value,
boolean index)
Adds a segment to the end of the path.
|
boolean |
contains(Node node)
Returns true if this path "contains" the given node.
|
void |
prependSegment(String value)
Adds a non-index segment to the beginning of the path.
|
void |
prependSegment(String value,
boolean index)
Adds a segment to the beginning of the path.
|
Node |
resolve(Document document)
Resolves a path to its target node within the document model.
|
Node |
resolveWithVisitor(Document document,
IVisitor visitor)
Resolves a path to its target node while also visiting all nodes along the way.
|
List<String> |
toSegments() |
String |
toString() |
public NodePath()
public NodePath(String path)
path
- public void prependSegment(String value, boolean index)
value
- index
- public void prependSegment(String value)
value
- public void appendSegment(String value, boolean index)
value
- index
- public void appendSegment(String value)
value
- public Node resolve(Document document)
document
- the document to resolve the path relative topublic Node resolveWithVisitor(Document document, IVisitor visitor)
document
- the document to resolve the path relative tovisitor
- an optional visitor to invoke for each node in the path (can be null)public boolean contains(Node node)
node
- public String toString()
toString
in class Object
Object.toString()
Copyright © 2019 Red Hat. All rights reserved.