
![]() |
Note |
|---|---|
Always try to use Data::get() before resorting to Data::xpath() or Data::xpathString(). Data::get() is easier to use, and it tends to be more robust if the underlying XML structure happens to change. You should only use the XPath functions if you have a problem that requires the full power of the DOM. |
string xpathString ( string $query [, DOMNode $contextnode ] )
The function Data::xpathString() executes an
arbitrary XPath query on Data's XML, returning the value of
the first node as a string. If you are using Data::xpath() to execute arbitrary
XPath expressions, you will often find yourself A) retrieving only the
first node, and then B) converting that node value to a string.
Data::xpathString() is a convenience function that performs
all of this work in one step.
query — Specifies a string XPath query to
execute on the source DataRSS.
contextNode — (Optional) Specifies a
DOMNode for conducting a relative XPath query. By
default, queries are relative to the root element.
A string representing the value of the first node to match
the specified query. If the expression fails to match any nodes,
the function returns FALSE.
query — Specifies a string XPath query to
execute on the source DataRSS.
contextNode — (Optional) Specifies a DOMNode
for conducting a relative XPath query. By default, queries are
relative to the root element.