getvalue
getvalue |
Purpose
Synopsis
function getvalue(doc:xmldoc, n:integer):text
function getboolvalue(doc:xmldoc, n:integer):boolean
function getintvalue(doc:xmldoc, n:integer):integer
function getrealvalue(doc:xmldoc, n:integer):real
function getstrvalue(doc:xmldoc, n:integer):string
Arguments
doc
|
Document to use
|
n
|
Node number
|
Return value
The value of the node.
Example
This code prints out the name of the employee with attribute id="T345".
declarations DB: xmldoc end-declarations writeln("Person with id='T345': ", getvalue(DB, getnode(DB, "personnelList/region/employee[@id='T345']/name") ))
Further information
1. Values of nodes are stored as
text objects: the first version of the routine returns a reference to the object containing the value. Modifying this text will also alter the node value. Using one of the alternative versions of this routine allows to avoid having to perform a type conversion. Note however that no validation is performed and a conversion error will result in a
0 for a number and
false for a Boolean without raising any error.
2. Element nodes have no value: the returned value corresponds to the value of the first child of type text of this element (or an empty string if no such child can be found).
Related topics
Module