Here is my XML doc:
<FileScan>
<Sites>
<Site>
<Name>Joe</Name>
<Dir>\\webserver\ftp\Joe</Dir>
<Email>[email protected]</Email>
<Subject>Hi Joe!</Subject>
</Site>
<Site>
<Name>Ben</Name>
<Dir>\\webserver\ftp\ben</Dir>
<Email>[email protected], [email protected]</Email>
<Subject>Hi Ben!</Subject>
</Site>
<Site>
<Name>Ian</Name>
<Dir>\\webserver\ftp\Ian</Dir>
<Email>[email protected]</Email>
<Subject>You are fired!</Subject>
</Site>
<Site>
<Name>Mark</Name>
<Dir>\\webserver\ftp\Mark</Dir>
<Email>[email protected]</Email>
<Subject>Hi Mark</Subject>
</Site>
</Sites>
</FileScan>
What I want to do is:
Open xmlDoc
Do while xmlDoc.eof <> true
store <Name> to varNAME
store <Dir> to varDIR
store <Email> to varEMAIL
store <Subject> to varSUBJECT
Then run an already designed function
Move to next XML <Site> tag
Loop
Currently this is what I have:
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load("FileScan.xml")
Set colNodes = xmlDoc.selectNodes ("//Site/ (Name|Dir)")
For Each objNode in colNodes
WScript.Echo objNode.nodeName & ": " & objNode.text
Next
I am getting the Name and Dir in the popup, but I cant seem to store them into variables by element name. How can I refer to an element by its particular name and be sure it is the right element. Then do that over and over as the number of sites may change over time?
Sitenodes?