I am trying to get data from XML file but can\'t get. I don\'t know what I am missing here.
XML File:
Since Sites
, Names
and URLs
are Object
, you need to use theSet
keyword.
Set Sites = oXMLFile.SelectNodes("TestClass/TestObject/Site/text()")
Set Names = oXMLFile.SelectNodes("TestClass/TestObject/Name/text()")
Set URLs = oXMLFile.SelectNodes("TestClass/TestObject/URL/text()")
I'm surprised you didn't get an error, but it may be because Object
are specials.
Since SelectNodes
returns a IXMLDOMNodeList
, you might want to replace your definitions by:
Dim oXMLFile as DOMDocument
Dim Sites As IXMLDOMNodeList
Dim Names As IXMLDOMNodeList
Dim URLs As IXMLDOMNodeList