Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
xmldata = `<?xml version="1.0"?>` xmldata = xmldata : `<catalog>` xmldata = xmldata : ` <book id="bk101">` xmldata = xmldata : ` <author>Gambardella, Matthew</author>` xmldata = xmldata : ` <title>XML Developer's Guide</title>` xmldata = xmldata : ` <genre>Computer</genre>` xmldata = xmldata : ` <price>44.95</price>` xmldata = xmldata : ` <publish_date>2000-10-01</publish_date>` xmldata = xmldata : ` <description>An in-depth look at creating applications with XML.</description>` xmldata = xmldata : ` </book>` xmldata = xmldata : ` <book id="bk102">` xmldata = xmldata : ` <author>Ralls, Kim</author>` xmldata = xmldata : ` <title>Midnight Rain</title>` xmldata = xmldata : ` <genre>Fantasy</genre>` xmldata = xmldata : ` <price>5.95</price>` xmldata = xmldata : ` <publish_date>2000-12-16</publish_date>` xmldata = xmldata : ` <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>` xmldata = xmldata : ` </book>` xmldata = xmldata : ` <book id="bk103">` xmldata = xmldata : ` <author>Corets, Eva</author>` xmldata = xmldata : ` <title>Maeve Ascendant</title>` xmldata = xmldata : ` <genre>Fantasy</genre>` xmldata = xmldata : ` <price>5.95</price>` xmldata = xmldata : ` <publish_date>2000-11-17</publish_date>` xmldata = xmldata : ` <description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description>` xmldata = xmldata : ` </book>` xmldata = xmldata : `</catalog>` #DefineFunction XMLLoad( xml, type ) ;0 = xml data ;1 = xml file xDoc = ObjectCreate("MSXML2.DOMDocument.6.0") xDoc.validateOnParse = @FALSE If type == 0 Then method = "LoadXML" If type == 1 Then method = "Load" If !xDoc.%method%( xml ) ; The xml failed to load. xDoc = 0 End If Return xDoc #EndFunction #DefineFunction XMLDisplayNodes( objNode ) For i = 0 To objNode.length-1 Item = objNode.item(i) If Item.hasChildNodes XMLDisplayNodes( Item.ChildNodes ) ;Pause( Item.parentNode.NodeName,Item.Text) Pause( Item.parentNode.NodeName,Item.XML) EndIf Next Return #EndFunction ;xmlfile = 'C:\temp\book.xml' ;xmlDoc = XMLLoad( xmlfile, 1 ) xmlDoc = XMLLoad( xmldata, 0 ) currNode = xmlDoc.documentElement.ChildNodes XMLDisplayNodes(currNode) Exit
Other undebugged code sample.
#DefineFunction LoadDocument( xmlfile ) xDoc = ObjectCreate("MSXML.DOMDocument") xDoc.validateOnParse = @FALSE If xDoc.Load( xmlfile ) Then ; The document loaded successfully. ; Now do something intersting. xDoc Else ; The document failed to load. ; See the previous listing for error information. xDoc = 0 End If Return xDoc #EndFunction #DefineFunction DisplayNode(NodeList) ForEach xNode In NodeList Pause(xNode.parentNode.nodeName, xNode.nodeValue) If xNode.hasChildNodes nodelist = xNode.childNodes DisplayNode( nodelist ) EndIf Next Return 0 #EndFunction xmlfile = "D:\temp\xmltest\TEST1.XML" oXMLDoc = LoadDocument( xmlfile ) NodeList = oXMLDoc.ChildNodes DisplayNode(NodeList)
Article ID: W18497
Filename: Display Nodes of XML File.txt
File Created: 2013:01:03:13:38:10
Last Updated: 2013:01:03:13:38:10