XmlGetNodeValue Function

Action

Returns the text value of the node. If the node is of type text the value of this node will be returned. If the node is an element node - the values of the direct child text nodes will be returned. If the node has no value or just other child nodes, the method returns an empty string.

Include file

XmlAPI.bdh

Syntax

XmlGetNodeValue( in     hNode        : number,
                 inout  sValue       : string,
                 in     nMaxValueLen : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hNode Handle to an XML node.
sValue String variable that receives the value of the node.
nMaxValueLen Maximum length of the string to return (optional). If this parameter is omitted or set to STRING_COMPLETE all available data is stored in sValue.

Example

dcltrans
  transaction TMain
  var
    hDocument, hResult : number;
  sValue             : string;
  begin
    hDocument := XmlCreateDocumentFromXml( "<root><child1 attr1='avalue1'>childvalue1</child1>"
               "<child2 attr1= 'avalue2'>childvalue2</child2></root>");
    hResult := XmlSelectSingleNode(hDocument, "/root/child2");
    XmlGetNodeValue(hResult, sValue);
  end TMain;