Results 1 to 5 of 5

Thread: How to reference duplicate Node Names

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2012
    Posts
    37

    How to reference duplicate Node Names

    I have an XML file that literally has hundreds of child nodes that have the same name.
    I am need to update a few of them with values.
    The child nodes look like this:
    Code:
    <GA>
    	<GASM>
    		<GASMT>Single Family</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    	<GASM>
    		<GASMT>1956</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    	<GASM>
    		<GASMT>Standard Home Inspection</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    	<GASM>
    		<GASMT>Occupied</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    	<GASM>
    		<GASMT>Overcast</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    	<GASM>
    		<GASMT>Wood-Destroying Insect</GASMT>
    		<GSSMEx>0</GSSMEx>
    		<GASMf>0</GASMf>
    	</GASM>
    </GA>
    I figured out that I need to get a node list. There are 8 in the node list. I am using:
    Set objNodeList = DOM.documentElement.SelectNodes("//Report/templatehma/genInfo/GA/GASM/GASMT")

    This produces the typed value for each node"
    MsgBox objNodeList.Item(0 through 7).nodeTypedValue

    However, when I try to create a single node to update the nodes, the first node is updated, EG
    Set Node = DOM.SelectSingleNode("//" & objNodeList.Item(1 through 7).nodeName) references the first node, which is item(0)

    How do I reference each node other than the first node?

    Thanks for your help
    Last edited by mhnvb; Nov 6th, 2014 at 01:52 AM. Reason: Additonal information

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width