Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; this will read an XML recordset object, row by row, based ; on a name space string supplied by the user... ; Winbatch 2003J, MSXML 4.0 SDK must be installed... #DefineFunction CountNodeSet(xfile, str, namespacestr) Doc = ObjectOpen("Msxml2.DOMDocument.4.0") Doc.async = @FALSE Doc.load(xfile) If namespacestr <> "" Then Doc.setProperty("SelectionNamespaces", namespacestr) nodepath = StrCat("//", str) dNode = Doc.selectNodes(nodepath) retnum = dNode.length ObjectClose(dNode) ObjectClose(Doc) Return(retnum) #EndFunction #DefineFunction ReadNodeSet(xfile, str, record, namespacestr) Doc = ObjectOpen("Msxml2.DOMDocument.4.0") Doc.async = @FALSE Doc.load(xfile) If namespacestr <> "" Then Doc.setProperty("SelectionNamespaces", namespacestr) ; message("Debug", Doc.getProperty("SelectionNamespaces")) nodepath = StrCat("//", str) dNode = Doc.selectNodes(nodepath) thisnode = dNode.item(record-1) retstr = "" data = thisnode.attributes For x = 0 To data.length-1 thisdata = data.item(x) retstr = StrCat(retstr, thisdata.name, " = ", thisdata.value, @CRLF) ObjectClose(thisdata) Next ObjectClose(data) ObjectClose(thisnode) ObjectClose(dNode) ObjectClose(Doc) Return(retstr) #EndFunction namespacestr = "xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'" str = "rs:data/z:row" xfile = "c:\test\stan\chgcode.xml" NumberOfRows = CountNodeSet(xfile, str, namespacestr) ;message("Debug", NumberOfRows) If NumberOfRows == 0 Then Exit For x = 1 To 5 ;NumberOfRows Message("Row# %x% of %NumberOfRows%", ReadNodeSet(xfile, str, x, namespacestr)) Next Exit
Article ID: W16153
File Created: 2004:03:30:15:43:00
Last Updated: 2004:03:30:15:43:00