XML Nodes (with VB6)

Ok, I'm having problems with trying to retrieve the nodes from an XML string.  For some reason I am not getting anything assigned to the nodes object.  The loadXML works without failure.

Below is my code, and at the bottom is an example (as best I could) of the XML string.

----- Code -----
    cXML.loadXML sXML
    Set objXMLNodeList = cXML.documentElement.selectNodes("opt")
    'I have also tried the following:
    'Set objXMLNodeList = cXML.documentElement.selectNodes("\\FVR\AO\opt\*")

    For Each objNode In objXMLNodeList
        Debug.Print objNode.Text

----- End of Code -----

----- XML String -----
<?xml version="1.0" encoding="UTF-8" ?>
<p784:FVR xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p784="http://xx.xxxxxxxx.xxx/xxxx/xxxxxxxx/1111111">
<p537:AO xmlns:p537="http://xx.xxxxxxxx.xxx/xxxx/xxxxx/2222222">
<p537:attribute xsi:nil="true" />
<ns2:vvvvvvv xmlns:ns2="http://xx.xxxxxxxx.xxx/xxxx/xxxxx/3333333" xmlns:ns1="http://xx.xxxxxxxx.xxx/xxxx/xxxxxxxx/444444444444444">
----- End of XML String -----
LVL 10
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ClifAuthor Commented:
Oh, I guess I should add the declarations for the XML objects...

    Dim cXML As New MSXML2.DOMDocument40

    Dim objXMLNodeList As MSXML2.IXMLDOMNodeList
    Dim objNode As MSXML2.IXMLDOMNode
Weiping DuSenior Web DeveloperCommented:
Try this:
Set objXMLNodeList = cXML.getElementsByTagName("opt")
Set objXMLNodeList = cXML.documentElement.selectNodes("//FVR/AO/opt")
ClifAuthor Commented:
Sorry for taking so long to reply.

Neither of the two suggestions worked.

I must say that I have never seen tags (with colons) like this:


I'm wondering if that's part (or a source) of my problems.
Weiping DuSenior Web DeveloperCommented:
It is also my first time see this. You need  to set SelectionNamespaces Property,. It should be somethings like this:

cXML.async= false;
set ns = "xmlns:na='http://xx.xxxxxxxx.xxx/xxxx/xxxxxxxx/1111111' xmlns:nb='http://xx.xxxxxxxx.xxx/xxxx/xxxxx/2222222'";
cXML.setProperty("SelectionNamespaces", ns);
Set objXMLNodeList = cXML.selectNodes("//FVR/AO/opt")

- To check example in detail:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ClifAuthor Commented:
That was perfect!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.