Hi All,
am getting to know the DOM object better!
pulling me hair out today,
want to write an xml file and would like it to look nice and indented etc
i have seen vb.net code like
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>");
// Add a price element.
XmlElement newElem = doc.CreateElement("price");
newElem.InnerText = "10.95";
doc.DocumentElement.AppendChild(newElem);
// Save the document to a file and auto-indent the output.
XmlTextWriter writer = new XmlTextWriter("data.xml",null);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
wnat to do something similar but cnat figure out how to create the XmlTextWriter object.
can anyone help out with this please?
cheers
rich
am getting to know the DOM object better!
pulling me hair out today,
want to write an xml file and would like it to look nice and indented etc
i have seen vb.net code like
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>");
// Add a price element.
XmlElement newElem = doc.CreateElement("price");
newElem.InnerText = "10.95";
doc.DocumentElement.AppendChild(newElem);
// Save the document to a file and auto-indent the output.
XmlTextWriter writer = new XmlTextWriter("data.xml",null);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
wnat to do something similar but cnat figure out how to create the XmlTextWriter object.
can anyone help out with this please?
cheers
rich