XmlSetNodeAttribute Function

Action

Sets the value of an attribute of the passed node. The method either overwrites the value of an existing attribute or creates a new attribute with the specified name.

Include file

XmlAPI.bdh

Syntax

XmlSetNodeAttribute( in  hNode      : number,
                     in  sAttrName  : string,
                     in  sAttrValue : string ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hNode Handle to an XML node
sAttrName Attribute name thats value should be set.
sAttrValue New value for the attribute

Example

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