473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

looking for example of inserting child node using a for each on a nodelist

Hi,

I'm looking for an example (preferably vb) using xmlDocument class
that once an XmlNodeList has been set (e.g., select all <House>
elements), that would add an empty <Rooms> child element to each
<House>.

Thanks in advance for any help.

Kathy
Nov 11 '05 #1
1 1398
Imports System
Imports System.Xml
Public Class Sample
Public Shared Sub Main()

Dim doc As New XmlDocument()
doc.LoadXml("<r oot><house id='1'/><house id='2' /></root>")

Console.WriteLi ne(doc.OuterXml ) 'BEFORE
Dim node As XmlNode
For Each node In doc.SelectNodes ("/root/house")
node.AppendChil d(doc.CreateEle ment("rooms"))
Next node

Console.WriteLi ne(doc.OuterXml ) 'AFTER
End Sub 'Main
End Class 'Sample
--
This posting is provided "AS IS" with no warranties, and confers no rights.

"KathyB" <Ka**********@a ttbi.com> wrote in message
news:75******** *************** ***@posting.goo gle.com...
Hi,

I'm looking for an example (preferably vb) using xmlDocument class
that once an XmlNodeList has been set (e.g., select all <House>
elements), that would add an empty <Rooms> child element to each
<House>.

Thanks in advance for any help.

Kathy

Nov 11 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1487
by: indo3 | last post by:
Hello, I program an xml editor with xerces for the university of Braunschweig, the user dont see any xml tags, it is represented in a JTree. Now the user shall be able to insert nodes, which conforms to the schema file (the user need not know what that is, its transparent to him). I found two approaches for doing that: 1. When xerces validates the source or the DOM tree (this is a new
2
2078
by: Lutz Ißler | last post by:
Hi all! I dymically replace the child nodes of a DIV element by image nodes. In IE and Firefox this works properly. In Safari it works properly, too - but only if the site is called locally, eg. with file://. Uploading to a server and viewing the site in Safari with http:// results in an error. The problematic code is the following: var node = document.createElement("img");
3
1210
by: chris yoker via DotNetMonster.com | last post by:
hi, I have an xmlFile <code> <rows> <row> <PRODUCT-TYPE>bike</PRODUCT-TYPE> <PRODUCT-DATE>01/01/2004</PRODUCT-DATE> <ADDED-NODE>"blah"<ADDED-NODE /> </row>
2
2417
by: William | last post by:
Have somebody a brilliant idea how to remove a nodelist in a XML document? (With C#) I have this xml file,I want delete the stock nodelist when an user don't have permissions to see stocklist of that location. <Respo1> <From>Test</From> <To>Test</To> <MsgType>RESPO1</MsgType>
6
1993
by: vbmark | last post by:
I have the follwing XML string: <RecordSet> <Row RowNumber="1"> <UserID>111</UserID> <Phone>1234567890</Phone> </Row> <Row RowNumber="2"> <UserID>747</UserID> <Phone>9876543210</Phone>
2
7446
by: Christian Rühl | last post by:
heyho, guys! here's another question for you now: i built an iterator to get all the nodes with a certain attribute in an xml dom. it all looks like this (i'm using .NET framework 1.1) string xpath;
11
4382
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so many parameters need to be passed into store procedure(assume there are many columns in the table). I need to insert data into two separate tables, the relation between these two tables is 1 row of data in table1 could have multiple rows in table2 related to table1, but if the data insertion into...
14
2048
by: marfi95 | last post by:
I'm trying to iterate through a list of child nodes. It seems like to get the text value of the node, you have to do a node->getFirstChild()->getNodeValue. This being said, there is a hasChildNodes method, but if I use that, it includes the "text" nodes also, which I don't want ot include. if this is my xml: <A> <B></B>
0
3315
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. Provide following view properties to listview, through View menu a. Tile b. Icon
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.