Loading an XML Document

The BDL API provides two ways to load an XML file - it can be loaded from a file or from a string buffer.

XmlCreateDocumentFromFile

This function loads a document from a file and returns a handle to the document. Use functions for browsing the document to get values of nodes and attributes.

dcltrans
  transaction TMain
  var
    hDoc : number;
    sXmlFile : string;
  begin
    GetDataFilePath("order.xml", sXmlFile);
    hDoc := XmlCreateDocumentFromFile(sXmlFile);
    ...
    XmlFreeHandle(hDoc);
  end TMain;

XmlCreateDocumentFromXml

This functions loads a document from a string buffer and returns a handle to the document. Use functions for browsing the document to get values of nodes and attributes.

dcltrans
  transaction TMain
  var
    hDoc : number;
  begin
    hDoc := XmlCreateDocumentFromXml("<root><child>value1</child><child>value2</child></root>");
    ...
    XmlFreeHandle(hDoc);
  end TMain;