473,761 Members | 9,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xml appending child nodes

Hi All,

If I have the following xml:

<Response>
<AddressDetails >
<Address>
</Address>
</AddressDetails>
</Response>

and I need to insert multiple address records like this:

<Response>
<AddressDetails >
<Address>
<City></City>
<State></State>
</Address>
<Address>
<City></City>
<State></State>
</Address>
</AddressDetails>
</Response>

I have used the xmlnode.appendc hild method to do this, but I can only
add one address, the original address is replaced so i end up with only
1 address like this:

<Response>
<AddressDetails >
<Address>
<City></City>
<State></State>
</Address>
</AddressDetails>
</Response>

Thanks in advance

Nov 21 '05 #1
3 1627
Hi,
You'll need to also append another Address node to AddressDetails.

Marcie

On 11 Apr 2005 10:52:54 -0700, "hharry" <pa*********@ny c.com> wrote:
Hi All,

If I have the following xml:

<Response>
<AddressDetails >
<Address>
</Address>
</AddressDetails>
</Response>

and I need to insert multiple address records like this:

<Response>
<AddressDetails >
<Address>
<City></City>
<State></State>
</Address>
<Address>
<City></City>
<State></State>
</Address>
</AddressDetails>
</Response>

I have used the xmlnode.appendc hild method to do this, but I can only
add one address, the original address is replaced so i end up with only
1 address like this:

<Response>
<AddressDetails >
<Address>
<City></City>
<State></State>
</Address>
</AddressDetails>
</Response>

Thanks in advance


Nov 21 '05 #2
I'm not sure what you're project is doing, but one alternative is to
create a class that models your entire XML structure and add the
Serializable attribute to it. Then you can just serialize and
deserialize directly to XML without having to deal with the xml
yourself.

Nov 21 '05 #3

Chris Dunaway wrote:
I'm not sure what you're project is doing, but one alternative is to
create a class that models your entire XML structure and add the
Serializable attribute to it. Then you can just serialize and
deserialize directly to XML without having to deal with the xml
yourself.


Thanks for the pointers. I needed to declare a new set of xml nodes for
each child group!

Nov 21 '05 #4

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

Similar topics

13
4161
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I get *9*. In the example table, there are 4 rows with 4 columns each in the tbody. I'd expect 4 child nodes for the table body with 4 children each. I get those 4 plus 5 alerts in Mozilla/Netscape. I get only those 4 in IE and Opera. Note that...
1
3077
by: Hazz | last post by:
I have 5 tables in SQL Server. Each with the following design and a sample chain of the relationships from the root (WRL - World) UUS is the 'Code' of the first table and it is the 'Parent' value of the second table, etc. Parent varchar 3 Name varchar 60 Code varchar 3 WRL United States UUS <- UUS California UCA <- UCA North Coast UNC <- UNC
12
20532
by: Dino L. | last post by:
I am putting data from DataTable to treeView foreach( DataRow aRow in aTable.Rows) { TreeNode tnode = new TreeNode(aRow.ToString() + aRow.ToString() + " " + aRow.ToString()); treeView1.Nodes.Add(tnode); //till here code works fine //now I wanna add child nodes for last inserted node foreach( DataRow GrupaRow in TabelaGrupe.Rows)
7
3770
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
2
22048
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. Thanks in advance for any help, Jack
1
2329
by: Daniel Rucareanu | last post by:
Hello, Does anybody knows how can you delete, in just one step, not using a loop, a subset of the child nodes of a given DOM parent node? The subset will be continous, so for example, if the parent node has 100 nodes, I want to delete nodes 10 through 75, and not nodes 5, 10, 25 etc. I have a reference to the first and the last node in the list that has to be removed. Also it's position in the list, if that helps.
2
21982
by: GreggaR0und | last post by:
Hello; I'm trying to iterate through the sub nodes of a child node, but I'm getting a compile error on the nested For...Next expression saying it is invalid. Using the below code, the HasChild() statement is "true" when the 3rd item is reached so I know there are child elements below it. A debug watch on the "SET oNodeList2 statement" shows that there is a list present at run-time. What is wrong with the code on the FOR..NEXT statement?
1
1572
by: luthriaajay | last post by:
I have a tricky question here. 1).I have an XML that is generated on the fly. XML Generated ------------- Document genereatedDoc =
0
3311
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
9345
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
10115
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...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6609
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
5229
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
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.