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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding to xml tags (in asp.net)

Status
Not open for further replies.
Aug 1, 2005
25
US
Hi

Any help to add to elements/tags existing already in a file

ex.
xmlList.xml

sample tags
<grub>
<pizza>
<topping>sausage</topping>
<topping>onions</topping>
</pizza>
<hotd>
<topping>ketchup</topping>
<topping>onions</topping>
</hotd>
</grub>

Many thanks!!!!
 
Bit more info needed.

Investigate System.Xml.

There are many ways to manipulate XML, one is:
Code:
      XmlDocument xml = new XmlDocument();
xml.Load(xmlList.xml);

XmlNode node = xml.SelectSingleNode("grub/pizza");
XmlElement elem = xml.CreateElement("topping");
elem.InnerText = "cheese";
node.AppendChild(elem);

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top