hi,
i have the code
so it generates the xml code belowCode:XmlTextWriter tr = new XmlTextWriter("Items.xml",null); tr.Formatting = Formatting.Indented; tr.WriteStartDocument(); tr.WriteStartElement("Items"); tr.WriteStartElement("books"); tr.WriteElementString("book1","harry"); tr.WriteElementString("book2","lotr"); tr.WriteEndElement(); tr.Flush(); tr.Close();
Now i want to delete the tag <book1> and its text harry from the file. How can i do it? (after the deletion the xml file will look like this: )Code:<?xml version="1.0" ?> - <Items> - <books> <book1>harry</book1> <book2>lotr</book2> </books> </Items>
Code:<?xml version="1.0" ?> - <Items> - <books> <book2>lotr</book2> </books> </Items>




Reply With Quote