cursor.selectPath("./purchase-order/line-item");Note that this method does not support top-level XPath functions. @param path The path expression to execute. @throws XmlRuntimeException If the query expression is invalid.
import org.openuri.sample.Person; import org.apache.xmlbeans.*; [...] XmlObject xobj = XmlObject.Factory.parse(myFile); Person[] results; results = (Person[])xobj.selectPath( "declare namespace s='http://www.openuri.org/sample' " + ".//s:owner");Notice the way in which namespace declarations are done in XPath 2.0. Since XPath can only navigate within an XML document - it cannot construct new XML - the resulting XmlObjects all reside in the same XML document as this XmlObject itself.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|