![]() XmlDoc.SetProperty "SelectionLanguage", "XPath" Set xmlDoc = CreateObject("Microsoft.XMLDOM") Try this - you can modify the below code to fetch any child node ![]() Set xmlNodeList = lectNodes("/r:ResultsOfListOfEvent/r:Data/r:APIEvent/r:ID")Įnd Sub Excel VBA getting specific node from XML - Stack Overflow xml excel vba ixmldomnode XmlDoc.Load "C:\Users\colin\Desktop\yoz1234.xml" tProperty "SelectionNamespaces", "xmlns:r=''" Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0") That's a complicated way of saying that rather than looking for /ID, we'll look for /r:ID Uses that new namespace in XPath as the prefix for any element which has an unprefixed name. We create a namespace called r (any name would do though) that has the same URI reference as the default namesepace in the document ( in this case) Uses the "SelectionNamespaces" property to fix the problem which MSXML2 has with XPath when a document has a default namespace - see here. Uses the MSXML2 namespace as the old Microsoft.XMLDOM one is only maintained for legacy support - see here ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |