keimpe
asked on
SelectNodes strange problem
Dear everyone,
I'm trying to import Goldmine data into MS Access. Goldmine has an XML export feature, so I'm trying to import those XML files using VBA code.
When I use the following code, it works on the one file and doesn't on the other. The XML files are exported using identical settings. One file contains Goldmine Email messages for the month of May en the other for the month of July. May gets imported and July doesn't (and yes, I have tried to recreate these files a number of times).
Here's my code (please correct any mistakes - I am an XML amateur):
[code begin]
Dim xmlDoc As MSXML2.DOMDocument30
Dim objListOfNodes As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Set xmlDoc = New DOMDocument30
xmlDoc.async = False
xmlDoc.validateOnParse = False
xmlDoc.Load ("E:\Goldmine\Import\July. xml")
Set objListOfNodes = xmlDoc.selectNodes("//gmda ta/account s/*")
For Each objNode In objListOfNodes
----- rest of code -----
Next
[code end]
With the one file, all goes well. With the other file, no objNode is found so the code skips to the end without errors.
I've opened the XML files in a text editor and they look just fine to me. The nodes I want are present.
(BTW I have this problem with other files as well, I've just restricted it to May.xml and July.xml to keep it simple here).
I'm trying to import Goldmine data into MS Access. Goldmine has an XML export feature, so I'm trying to import those XML files using VBA code.
When I use the following code, it works on the one file and doesn't on the other. The XML files are exported using identical settings. One file contains Goldmine Email messages for the month of May en the other for the month of July. May gets imported and July doesn't (and yes, I have tried to recreate these files a number of times).
Here's my code (please correct any mistakes - I am an XML amateur):
[code begin]
Dim xmlDoc As MSXML2.DOMDocument30
Dim objListOfNodes As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Set xmlDoc = New DOMDocument30
xmlDoc.async = False
xmlDoc.validateOnParse = False
xmlDoc.Load ("E:\Goldmine\Import\July.
Set objListOfNodes = xmlDoc.selectNodes("//gmda
For Each objNode In objListOfNodes
----- rest of code -----
Next
[code end]
With the one file, all goes well. With the other file, no objNode is found so the code skips to the end without errors.
I've opened the XML files in a text editor and they look just fine to me. The nodes I want are present.
(BTW I have this problem with other files as well, I've just restricted it to May.xml and July.xml to keep it simple here).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Now all I have to do is find out how to get rid of invalid unicode characters ;-)
I'll post that as a new question, so you can score some more points.
Thanks a lot!