getnode
getnode |
Purpose
Synopsis
function getnode(doc:xmldoc, n:integer, p:string|text):integer
function getnode(doc:xmldoc, n:integer):integer
function getnode(doc:xmldoc, p:string):integer
Arguments
doc
|
Document to use
|
n
|
Base node number (
0 when not provided)
|
p
|
Path to the node (
"*" when not provided)
|
Return value
The node number of the first node selected by the path
p;
-1 if no node can be found.
Example
The following example shows different forms of the
getnode function.
declarations DB: xmldoc Root, EMEA: integer end-declarations ! Get the first element that is not a comment or a processing instruction Root:= getnode(DB,"*") ! Same as: getnode(DB,0,"*") ! Get the 'region' node with id=EMEA EMEA:= getnode(DB, "personnelList/region[@id='EMEA']") ! Check for employee record (node) for 'Sam' under 'EMEA' if getnode(DB, EMEA, "employee/name[string()='Sam']/..")<0 then writeln("No employee called 'Sam' in EMEA") end-if
Further information
1. Refer to section
Paths in a document for a detailed description of the syntax and semantic of XML paths.
2. This function is the same as
getfirstchild when used without path specification.
Related topics
Module