XmlCreateDocumentFromXml Function

Action

Loads an XML document from a string that contains a valid XML content.

Include file

XmlAPI.bdh

Syntax

XmlCreateDocumentFromXml( in sXmlString : string ): number;

Return value

  • document handle if successful

  • 0 otherwise

Parameter Description
sXmlString String containing a valid XML document

Example

dcltrans
  transaction TMain
  var 
 hDocument, hResult     : number;
 sAttrValue, sXmlString : string;
  begin
    hDocument := XmlCreateDocumentFromXml( "<root><child1 attr1='avalue1'>childvalue1</child1>"
                 "<child2 attr1='avalue2'>childvalue2</child2></root>");
    hResult := XmlSelectSingleNode(hDocument, "/root/child2");
    XmlGetAttributeByName(hResult, "attr1", sAttrValue);
    XmlSetNodeAttribute(hResult, "attr1",  "new avalue");
    XmlGetXml(hDocument, sXmlString);
  end TMain;