|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectelectric.xml.XPath
XPath provides a set of methods for selecting nodes from an element based on an XPath. The XPath tokens that are currently supported are ".", "..", "...", "/", "*", "@*", "[n]", "name[n]", "[@key='value']", "name[@key='value']", "[text='value']", "name[text='value']" and "@key". To prevent special characters from being treated as XPath directives, enclose the path in single quotes.
Constructor Summary | |
XPath(java.lang.String xpath)
Construct an XPath with the specified expression and no namespace context. |
|
XPath(java.lang.String xpath,
boolean cache)
Construct an XPath with the specified expression and no namespace context. |
|
XPath(java.lang.String xpath,
INamespaceContext namespaceContext)
Construct an XPath with the specified expression and namespace context. |
|
XPath(java.lang.String xpath,
INamespaceContext namespaceContext,
boolean cache)
Construct an XPath with the specified expression and namespace context. |
Method Summary | |
static void |
addFactory(IXPathFactory factory)
Add an XPath defaultFactory. |
Attribute |
getAttribute(Element element)
|
Attributes |
getAttributes(Element element)
|
boolean |
getBoolean(Node node)
|
static boolean |
getCacheByDefault()
|
Element |
getElement(Parent parent)
|
Elements |
getElements(Parent parent)
|
static IXPathFactory |
getFactory()
Get the default xpath defaultFactory. |
static IXPathFactory |
getFactory(int implementationLevel)
Return the first XPath defaultFactory that matches the given implementation level. |
Node |
getNode(Node node)
|
Nodes |
getNodes(Node node)
|
static void |
setCacheByDefault(boolean flag)
|
static void |
setFactory(IXPathFactory factory)
Set the primary default defaultFactory. |
void |
setNamespace(java.lang.String prefix,
java.lang.String namespace)
|
java.lang.String |
toString()
Return the xpath expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XPath(java.lang.String xpath) throws XPathException
xpath
- The xpath expression.
XPathException
- If the path is malformed.public XPath(java.lang.String xpath, boolean cache) throws XPathException
xpath
- The xpath expression.
XPathException
- If the path is malformed.public XPath(java.lang.String xpath, INamespaceContext namespaceContext) throws XPathException
xpath
- The xpath expression.namespaceContext
- The namespace context.
XPathException
- If the path is malformed.public XPath(java.lang.String xpath, INamespaceContext namespaceContext, boolean cache) throws XPathException
xpath
- The xpath expression.namespaceContext
- The namespace context.
XPathException
- If the path is malformed.Method Detail |
public java.lang.String toString()
public static IXPathFactory getFactory()
public static void setFactory(IXPathFactory factory)
factory
- public static void addFactory(IXPathFactory factory)
factory
- public static IXPathFactory getFactory(int implementationLevel)
implementationLevel
- XPATH_FULL or XPATH_PARTIAL
public static void setCacheByDefault(boolean flag)
flag
- public static boolean getCacheByDefault()
public Nodes getNodes(Node node) throws XPathException
getNodes
in interface IXPath
node
-
XPathException
public Node getNode(Node node) throws XPathException
getNode
in interface IXPath
node
-
XPathException
public Attribute getAttribute(Element element) throws XPathException
getAttribute
in interface IXPath
element
-
XPathException
public Attributes getAttributes(Element element) throws XPathException
getAttributes
in interface IXPath
element
-
XPathException
public Element getElement(Parent parent) throws XPathException
getElement
in interface IXPath
parent
-
XPathException
public Elements getElements(Parent parent) throws XPathException
getElements
in interface IXPath
parent
-
XPathException
public void setNamespace(java.lang.String prefix, java.lang.String namespace) throws XPathException
setNamespace
in interface IXPath
prefix
- namespace
-
XPathException
public boolean getBoolean(Node node)
getBoolean
in interface IXPath
node
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |