My xml tree contains this in the structure
<foo name="bar">
    <location order="1">data1</location>
    <location order="2">data2</location>
</foo>
I'm trying to refer to anywhere in the tree where location order ="2" (there could be 1000s of them) to manipulate all data2 texts. I cannot get vba to recognize it with an xpath string assignment.
I've tried many things but the thing that makes the makes the most sense to me is
xPath = "//prefix:foo[@name='bar']/location[@order='2']" 
It does however recognize the xPath assignment to foo if I remove.
"/location[@order='2']"
Am I doing something wrong in the xpath syntax? Or is there more to assigning a path to a node containing several attributes to be selected in the tree structure?
Maybe I'm trying to use the wrong methods to access the variable?
Dim list as IXMLDOMNodeList
Set list = xDoc.SelectNodes(xPath)
Debug.Print list.length
Gives me a 0 but there are two instances of those specific nodes in my xml
Edit: Still giving me zero after doing some things with yours. Here's an example xml so you can see namespace. I can still get it to print a length if I leave out the "/location[@order='2']". Also to clarify, I only am interested in the path that is , there could be many other foo nodes with the child . These I do not care about for now.
    <?xml version="1.0" encoding="utf-8"?>
    <IPSGDatas xsi:schemaLocation="uri:mybikes:wheels MYBIKES%20WHEELS%202012.xsd" 
      xmlns="uri:mybikes:wheels" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <header>
            <language_id>120</language_id>
        </header>
        <datas>
            <good>
                <signature/>
                <bike>
                    <foos>
                        <marker>
                            <location order="1">data1</location>
                            <location order="2">data2</location>
                        </marker>
                        <foo name="bar">
                            <location order="1">data1</location>
                            <location order="2">data2</location>
                        </foo>
                    </foos>
                    <profile_id>MyName1</profile_id>
                </bike>
                <action_id>New</action_id>
                <index_id>1</index_id>
                <agency/>
                <agency_reference/>
                <accreditation_id>U</accreditation_id>
            </good>
            <good>
                <signature/>
                <bike>
                    <foos>
                        <marker>
                            <location order="1">data1</location>
                            <location order="2">data2</location>
                        </marker>
                        <foo name="bar">
                            <location order="1">data1</location>
                            <location order="2">data2</location>
                        </foo>
                    </foos>
                    <profile_id>MyName2</profile_id>
                </bike>
                <action_id>New</action_id>
                <index_id>1</index_id>
                <agency/>
                <agency_reference/>
                <accreditation_id>U</accreditation_id>
            </good>
        </datas>
    </IPSGDatas>