Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Xpath in VBA problem 1

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Cant see where I am going wrong with this,

here is a example of my XML File

Code:
<?xml version="1.0"?>
 <TAXPACKS>
 <CLIENT CLIENTNO='37509'>
  <CLIENTTYPE>1</CLIENTTYPE> 
  <CLIENTWRAPNO>200037</CLIENTWRAPNO> 
  <CLIENTSALUTATION>MR</CLIENTSALUTATION> 
  <CLIENTFORENAMES>Joseph Herald</CLIENTFORENAMES> 
  <CLIENTSURNAME>Bloggs</CLIENTSURNAME> 
</CLIENT>
</TAXPACKS>

And here is the code I am trying to get to work

Code:
Sub testingFORctc()
Dim xml_doc As New DOMDocument
Dim nde_Client As IXMLDOMNode
Dim ndE_item As IXMLDOMElement
Dim x As Variant

xml_doc.Load str_XMLPath & "TaxPackBatch.xml"
Set nde_Client = xml_doc.documentElement
For Each ndE_item In nde_Client.selectNodes("//CLIENT [CLIENTNO='37509']")

       
            x_WrapNo = ndE_item.selectSingleNode("CLIENTWRAPNO").Text
            x_ClientSalutation = ndE_item.selectSingleNode("CLIENTSALUTATION").Text
            x_ClientForenames = ndE_item.selectSingleNode("CLIENTFORENAMES").Text
            x_ClientSurname = ndE_item.selectSingleNode("CLIENTSURNAME").Text
next


Can anyone point us in what I am doing wrong

Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
should read

For Each ndE_item In nde_Client.selectNodes("//CLIENT [@CLIENTNO='37509']")
 
thanks had a feeling i was missing something obvious!

Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top