The XML file I'm trying to parse uses colons in certain node names. I need to get the text out of some of those nodes and the direct method always fails with error 0x80004005 (Unspecified error) in msxml6.dll stating Reference to undeclared namespace prefix: 'xxx'.
Node names are in the form of xxx.nodename and error pops out when I'm trying
outVar := doc.selectSingleNode(parentNode "/xxx:nodename").text
However, if I use a loop like this, it works without error:
Code: Select all
doc := ComObjCreate("MSXML2.DOMDocument.6.0"), doc.async := false, doc.Load(testfile)
n := doc.selectSingleNode(parentNode)
Loop
{
if !a := n.childNodes.item(A_Index-1)
break
if (a.nodeName = "someNode")
var1 := a.text
if (a.nodeName = "otherNode")
var2 := a.text
if (a.nodeName = "xxx:nodename")
outVar := a.text
}
I wonder where the bug or limitation is: in my script, in AHK or in Windows' XML parser? I'm working with XP-SP3 for this script.
Thanks for any help you can offer.
P.S. Just remembered one other snag: there's no way to make use of such node names in a statement like if a.nodeName in xxx:nodename,someNode,otherNode because AHK throws another error.

P.P.S. A friend of mine tried to use the script (which works fairly well on my XP) under Ubuntu/WINE and it failed with a 10MB XML file but worked correctly with a 1MB file. Is there an ErrorLevel or any kind of error trapping when an object cannot be created or a file cannot be loaded as an object?