Results 1 to 3 of 3

retrieving node names

Threaded View

  1. #1
    Registered User
    Join Date
    05-15-2016
    Location
    Sydney
    MS-Off Ver
    excel 2013
    Posts
    21

    retrieving node names

    hi i have been struggling with get node names extracted from an xml file

    i want the vba code below to return all nodes as following
    e.g
    ParentNodeName/ChildNodeName
    ParentNodeName
    ParentNodeName
    ParentNodeName/ChildNodeName/ChildNodeName

    the xml has tuples and there are tuples within tuples. I just need the code to return all elements with parentnode name in front of it.

    Tried playing around with the following code but with no luck. Can someone please advise?

    xmlExportDoc = "c:\myDoc.xml"
    
    Dim xmldoc As MSXML2.DOMDocument
    Dim xmlNode As MSXML2.IXMLDOMNode
    Dim xmlNodeList As MSXML2.IXMLDOMNodeList
    Dim myNode As MSXML2.IXMLDOMNode
    
    Set xmldoc = New MSXML2.DOMDocument
    xmldoc.async = False
    xmldoc.Load (xmlExportDoc)
    Set xmlNodeList = xmldoc.getElementsByTagName("*")
    On Error Resume Next
    For Each xmlNode In xmlNodeList
        For Each myNode In xmlNode.ChildNodes
            Debug.Print myNode.ParentNode.nodeName & "/" & mynode.nodeName
        Next myNode
    Debug.Print mynode.nodeName
    Next xmlNode
    Set xmldoc = Nothing
    Last edited by jeffreybrown; 08-20-2016 at 09:52 AM. Reason: Please use code tags when posting code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Get Node Key from selected Node in TreeView
    By mile990 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2016, 04:55 PM
  2. [SOLVED] Retrieving top-5 names
    By versuswhat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-16-2015, 02:02 PM
  3. Finding and Retrieving Numbers and Names from a Large Workbook
    By disfunctional in forum Excel General
    Replies: 4
    Last Post: 01-02-2015, 04:52 PM
  4. Excel macro for retrieving file names
    By Toadums in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-17-2008, 07:54 PM
  5. [SOLVED] Retrieving Values Saved in Names
    By Steve Drenker in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-03-2006, 11:55 PM
  6. Retrieving Names of Worksheets
    By Brad Sumner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2005, 02:05 PM
  7. Retrieving Values Using Range Names as References
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-25-2005, 02:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1