XML parsing in VBA

I have an XML object ResponseXML. I would like to skip all the nodes called "XYZ". How to do it?

+3
source share
2 answers

Here are some functions you can use to parse XML :

Private xml As MSXML.DOMDocument

Private Sub loadXMLFile(xmlFile)    
    Set xml = New DOMDocument
    xml.async = False
    xml.Load (xmlFile) 
End Sub

Private Sub loadXMLString(xmlString)    
    Set xml = New DOMDocument
    xml.LoadXml (xmlString) 
End Sub

Public Function getNodeValue(xpath As String) As String    
    getNodeValue = xml.SelectSingleNode(strXPath).Text    
End Function

Public Function getNodes(xpath as string) As IXMLDOMNodeList            
    Set getNodes = xml.SelectNodes(xpath)
End Function

Public Function getNode(xpath as string) As IXMLDOMNode
    Set getNode = xml.SelectSingleNode(xpath)
End Function

See MSDN for more information on MSXML: http://msdn.microsoft.com/en-us/library/aa468547.aspx

+10
source

You may find it useful to be able to parse an XML object in VBA.

See this question: How to parse XML with vba

NTN!

In particular, this answer covers your problem.

+1

Source: https://habr.com/ru/post/1782515/


All Articles