The example for creating (writing) the XML file is not available here. It is also possible to use the methods over the Microsoft.XMLDOM object, but in most cases it is much easier to create the XML file as a text fule by using the Pm.FileTextWrite method (the whole XML text is first created in a variable of the String type) or Pm.FileTextReplace (the template of the XML file is overwritten with the keywords replaced).
<?xml version="1.0" encoding="utf-8"?>
<pm>
<data>
<item>
<name ID="B">d0</name>
<value>9.381083</value>
</item>
<item>
<name ID="P">d1</name>
<value>20.34651</value>
</item>
<item>
<name ID="K">d2</name>
<value>31.1635</value>
</item>
<item>
<name ID="P">d3</name>
<value>39.94775</value>
</item>
<item>
<name ID="D">d4</name>
<value>48.76433</value>
</item>
</data>
</pm>
Dim oXml, b, arrNodes, i, lastNode, oAttr
Set oXml = CreateObject("Microsoft.XMLDOM")
oXml.async = false 'set synchronize load file
b = oXml.load("c:\XmlData.xml") 'connect/load XML file
'Pm.Debug "ActiveX = " & b ' create ActiveX object
'Pm.Debug oXml, true ' displaying the appropriate method
'Pm.Debug oXml.readyState ' view connect state: 0=uninitialized, 1=loading, 2=loaded, 3=interactive, 4=complete
'MsgBox oXml.xml ' view list page
Set arrNodes = oXml.selectNodes("//pm/data/item") 'array tags
lastNode = arrNodes.length -1 'total tag count
'write values array "arrNodes"
For i = i To lastNode
Pm.Debug i & " tag name = " & arrNodes.Item(i).selectSingleNode("name").Text
Pm.Debug i & " tag value = " & arrNodes.Item(i).selectSingleNode("value").Text
Next
Set arrNodes = oXml.getElementsByTagName("item") 'array tags
lastNode = arrNodes.length -1 'total tag count
'write values array "arrNodes"
For i = i To lastNode
Pm.Debug i & " tag name = " & arrNodes.Item(i).childNodes(0).Text
Pm.Debug i & " tag value = " & arrNodes.Item(i).childNodes(1).Text
Next
Set arrNodes = oXml.selectNodes("//pm/data/item/name") 'array tags
lastNode = arrNodes.length -1 'total tag count
'write values array "arrNodes"
For i = i To lastNode
Set oAttr = arrNodes.Item(i).Attributes.Item(0) 'the oAttr object contains all attributes of the "name" tag
Pm.Debug oAttr.baseName 'attribute name
Pm.Debug oAttr.nodeValue 'attribute value
Next
'value of the first "name" tag having the ID="P" attribute
Dim oNode
Set oNode = oXml.selectSingleNode("//pm/data/item/name[@ID='P']")
Pm.Debug oNode.Text