Hi folks,

Long time lurker, about 7 years now? This site has been a great amount of help over the years, but I can't find any answers for this one...

Basically, I have a bunch of XML files I have to open, read, parse and assign variables from that XML file to variables in my application.

Each script, for each XML file basically looks like this:

Code:
    Dim objNodeList As IXMLDOMNodeList
    Dim objNode As IXMLDOMNode
    Dim objAttrib As IXMLDOMAttribute
    Dim theDoc As MSXML2.DOMDocument
    Set theDoc = New MSXML2.DOMDocument
    theDoc.Load activeDirectory & "\file1.xml"
        
    location1name = theDoc.selectSingleNode("//location/neighborhood").Text

    set theDoc = Nothing
I have to do this for about 5-10 XML files, the amount of XML files changes depending on availability external to the app. Right now I have a logic in place that says if the file exists open it. If the file exists, it sets a flag that says xml1Present = 1

I then have to take another statement that says if xml1Present = 1, open xml 1

THEN once all the variables are assigned I have to use them with the application by individually calling them... To open the variable in the above code I would have to call:
Code:
MsgBox location1Name
Correct me if I'm wrong, but would it not be easier to have all of the load into an array?

ONE XML loading script that basically cycles though all 1 to maybe 15 XML files, then loads the variables (theDoc.selectSingleNode("//location/neighborhood").Text) into an array so that if I wanted to call that data, I'd just have to call:

Code:
MsgBox locationName(0)
MsgBox locationName(0)
' etc?
Thanks again for everyone help over the years.