Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML DOM in VBA: Moving or copying nodes

Status
Not open for further replies.

534dna

Technical User
Jul 13, 2012
10
DE
Hi folks,

I have an Access application which takes an XML document and converts some attributes to tags ( see my previous topic: ).

I need to expand on this. I have a node called "view" and I need to convert its "name" attribute to a tag. This I do not have a problem with (thanks to oharab for that). But what I need to do is add that new "name" attribute to the "question" node. The "question" node is a child of "view".

In the xml there are multiple view nodes and each one has some "question" child nodes. So in each "view" node I need to create a tag in each "question" child node with a "name" text node.

So, from this...
XML:
<view name = "1st View">
	<question>
		<id>01</id>
		<difficulty>easy</difficulty>
		<name>user1</name>
            	<body>Question blah blah</body>
		<date>
			<date year="2008" month="5" day="17" hour="2" minute="31" second="11"/>
		</date>
	</question> 
	<question>
		<id>02</id>
		<difficulty>hard</difficulty>
		<name>user2</name>
            	<body>Question blah blah</body>
		<date>
			<date year="2008" month="5" day="18" hour="2" minute="31" second="11"/>
		</date>
	</question> 
</view>

...to this...
XML:
<view>
	<question>
		<name>1st View</name>
		<id>01</id>
		<difficulty>easy</difficulty>
		<name>user1</name>
            	<body>Question blah blah</body>
		<date>
			<date year="2008" month="5" day="17" hour="2" minute="31" second="11"/>
		</date>
	</question> 
	<question>
		<name>1st View</name>
		<id>02</id>
		<difficulty>hard</difficulty>
		<name>user2</name>
            	<body>Question blah blah</body>
		<date>
			<date year="2008" month="5" day="18" hour="2" minute="31" second="11"/>
		</date>
	</question> 
</view>

Hope somebody can help im really struggling with the XML DOM!

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top