|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Xml appending child nodesIf 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.appendchild 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 Hi,
You'll need to also append another Address node to AddressDetails. Marcie Show quoteHide quote On 11 Apr 2005 10:52:54 -0700, "hharry" <paulquig***@nyc.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.appendchild 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 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. Chris Dunaway wrote:
> I'm not sure what you're project is doing, but one alternative is to Thanks for the pointers. I needed to declare a new set of xml nodes for> 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. each child group! |
|||||||||||||||||||||||