getnext
getnext |
Purpose
Synopsis
function getnext(doc:xmldoc, n:integer):integer
Arguments
|
doc
|
Document to use
|
|
n
|
Node number
|
Return value
The node number of the following node or
-1 if the current node is the last of the list.
Example
This example enumerates all child nodes within a specific region and displays the 'id' for all 'employee' nodes on a single line, adding a line break after the last name:
declarations
DB: xmldoc
APAC, Pers: integer
end-declarations
APAC:= getnode(DB, "personnelList/region[@id='APAC']")
Pers:= getfirstchild(DB, APAC)
LastPers:= getlastchild(DB, APAC)
while(Pers>-1) do
if getname(DB, Pers)="employee" then
write(" ", getattr(DB,Pers,"id"))
end-if
if Pers=LastPers then writeln; end-if
Pers:= getnext(DB, Pers)
end-do
Further information
Node numbers returned by Mosel are not directly related to the order of nodes within the XML document (
i.e. a larger node number does not imply that a node succeeds a node with a smaller number).
Related topics
Module
