Login | |
|
 |
RE: Parse XML Using Wildcards - 5/3/2006 3:21:21 AM
|
|
 |
|
| |
ebgreen
Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
|
quote:
s there is no "ends-with" function - how can I do the equivalence of VBcript's Right()? Not tested, but: Set objNodeList = objDoc.selectNodes( "//ContentElement[""ABC"" = substring( IdNumber, 9)]" )
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Parse XML Using Wildcards - 5/4/2006 9:06:28 AM
|
|
 |
|
| |
who10
Posts: 33
Score: 0
Joined: 4/29/2006
Status: offline
|
Ok, one more question... Say I have 3 xml files just like the ones I described before in a folder and I want to loop through the files to get the results based on the example you provided. I made an attempt to do this, but I got errors saying Invalid procedure call or argument: 'Load'. I suspect I'm loading the document the wrong way or there's a problem with my For each statement when I start the loop. Can you help? Here's my code Option Explicit '***Define Variables*** Dim ipdlFolder, ipdlFiles, file Dim objDoc, objNodeList, objNode, objSubNode Dim objFSO, strFoundIrm, strIrmData, objOutputFile '***Set Objects*** Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create an XML Document Object Set objDoc = CreateObject( "Msxml2.DOMDocument.4.0" ) objDoc.async = False '***Loop through files in folder*** Set ipdlFolder = objFSO.GetFolder("C:\Temp\TestData\") Set ipdlFiles = ipdlFolder.files For each file in ipdlFiles If "Test" = left(file.name, 4) Then 'LoadXML for input objDoc.Load file 'Return a nodelist with all the ContentElement 'records' Set objNodeList = objDoc.GetElementsByTagName("ContentElement") 'Loop through the nodelist to get the fields needed For Each objNode In objNodeList If "-ABC" = Right( objNode.firstChild.Text, 4 ) Then wscript.echo "found " & objNode.firstChild.Text For Each objSubNode In objNode.childNodes wscript.echo " " + objSubNode.tagName + ": " + objSubNode.text Next End If Next End If Next set objDoc = nothing set objNodeList = nothing set objFSO = nothing WScript.Quit()
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|