public final class Path extends Object implements Serializable
A XPath being the union of Paths (that is, Path|Path|...Path), the API of Path is similar to the API of XPath.
XPath
,
Serialized FormModifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
static Path |
fromString(String s,
PrefixToNamespace prefixToNS)
Equivalent to
fromString(s, prefixToNS, false) . |
static Path |
fromString(String s,
PrefixToNamespace prefixToNS,
boolean allowDefaultNS)
Parses specified string as a Path.
|
Step[] |
getSteps()
Returns the sequence of location steps composing this path.
|
boolean |
isAbsolute()
Returns true if this path is absolute (that is, it begins with /).
|
boolean |
isSelectingAttributes()
Returns true if this path can be used to select attributes (that is, it
ends with /@attribute-name).
|
boolean |
match(XNode xnode) |
XNode[] |
select(Tree tree) |
XNode[] |
select(Tree tree,
boolean attributePlaceholder) |
String |
toString(NamespaceToPrefixes nsToPrefixes)
Returns this Path converted to a parsable string.
|
void |
toString(StringBuilder buffer,
NamespaceToPrefixes nsToPrefixes)
Formats this Path as a parsable string.
|
public static Path fromString(String s, PrefixToNamespace prefixToNS)
fromString(s, prefixToNS, false)
.public static Path fromString(String s, PrefixToNamespace prefixToNS, boolean allowDefaultNS)
s
- string to be parsedprefixToNS
- map used to get namespaces corresponding to
prefixes found in string; may be null
allowDefaultNS
- when parsing an element name having no prefix,
use the default namespace if anyName.parse(java.lang.String, boolean, com.xmlmind.xml.name.PrefixToNamespace)
public Step[] getSteps()
public boolean isAbsolute()
public boolean isSelectingAttributes()
public String toString(NamespaceToPrefixes nsToPrefixes)
nsToPrefixes
- map used to get prefixes corresponding to
namespaces referenced in this Path; may be null
Name.format(boolean, com.xmlmind.xml.name.NamespaceToPrefixes)
public void toString(StringBuilder buffer, NamespaceToPrefixes nsToPrefixes)
nsToPrefixes
- map used to get prefix corresponding to namespace
referenced in this Path; may be null
buffer
- buffer where formatted string is to be addedName.format(boolean, com.xmlmind.xml.name.NamespaceToPrefixes)
public boolean match(XNode xnode)