|
|
|
|
|
- Syntax 2: Executing an XPATH query on an XML document: Reading the query result
- Limitations
- XML functions and threads
XMLExecuteXPath (Function) Executes an XPATH query: - in a variable of type xmlDocument.
 Not available. - in an XML document.
 Not available.
clDoc is xmlDocument = XMLOpen(n, fromString)
c is xpathResult = XMLExecuteXPath(clDoc, "/root/text()")
IF c.IsValue THEN
Trace(c.Value)
ELSE
FOR EACH ANode OF c.Node
Trace("Node: " + UnNode..Text)
END
FOR EACH attrib OF c.Attribute
Trace("Node: " + attrib.Name)
END
END
MyDoc is string
MyDoc = fLoadText("example.xml")
XPATHQuery is string = "Help/Function/Index"
XMLDocument("Example", MyDoc)
IF ErrorOccurred = True THEN
Error("The file is not in XML format.")
RETURN
END
b is boolean
b = XMLExecuteXPath("Example", XPATHQuery)
IF b = True AND XMLOut("Example") = True THEN
Trace("XMLResult=" + XMLResult("Example"))
END
IF XMLFound("Example") = True THEN
WHILE XMLFound("Example") = True
Trace(XMLPath("Example"))
XMLNext("Example")
END
XMLCancelSearch("Example")
END
Sintaxis
Executing an XPATH query on an xmlDocument variable Ocultar los detalles
<Result> = XMLExecuteXPath(<XML document> , <Text of XPath query>)
<Result>: xpathResult variable xpathResult variable containing the result of the XPATH query. Reading the result: - The IsValue property allows you to know if the result is a value.
- For a selection query (the result is not a value), the xpathResult variable must be browsed.
- For a calculation query (the result is a value), the Value property reads the result.
<XML document>: xmlDocument variable Name of the xmlDocument variable containing the XML code to analyze. <Text of XPath query>: Character string Text of the XPath query to execute.
Executing an XPATH query on an XML document (syntax kept for backward compatibility) Ocultar los detalles
<Result> = XMLExecuteXPath(<Name of the XML document> , <Text of XPath query>)
<Result>: Boolean - True if the query was executed,
- False otherwise or if no element corresponds to the query.
Reading the result: - For a selection query, if the XPATH query has been executed, the XML search functions are used to browse the result of the XPATH query.
- For a calculation query, XMLResult is used to read the result.
<Name of the XML document>: Character string Name of the XML document used. This document contains the XML code to study and it was created by XMLDocument. <Text of XPath query>: Character string Text of the XPath query to execute. Observaciones Limitations - Several XPath browse queries cannot be nested.
- Syntax 1: Execute an XPATH request on a variable of type xmlDocument:
- The list of nodes is not sorted.
- The standard used for the XPath query is XPath 1.0.
- Syntax 2: Executing an XPATH query on an XML document:
XMLSavePosition and XMLRestorePosition cannot be used to save/restore a position when browsing the result of a select XPath query.
XML functions and threads If your application uses threads, the XML document is shared between all these threads. For more details on threads, see Managing threads. If the current position in an XML document is modified in a thread, the current position in this XML document is modified for all the threads. Clasificación Lógica de negocio / UI: Lógica de negocio
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|