You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

xpath()

Usage

xpath(xmlDocument, xpathExpression)

Description
Evaluates the given xpath expression on the given XML document, returning the evaluation result. This method can be used in conjunction with xml() and read() to read an XML file from the Structr exchange/ directory. Alternatively a file from the virtual filesystem can be read using the get_content() function.
See Anatomy of a Structr application for more information.

Example

${xpath(xml(read('test.xml')), '//value')}

results in

Test

Search results for "xpath()"

xpath()

Returns the value of the given XPath expression from the given XML DOM. The optional third parameter defines the return type, possible values are: NUMBER, STRING, BOOLEAN, NODESET, NODE, default is STRING. This method can be used in conjunction with xml() and read() to read an XML file from the Structr exchange/ directory. Alternatively a file from the virtual filesystem can be read using the get_content() function. See Anatomy of a Structr application for more information.

xpath(xmlDocument, xpathExpression[, returnType])