Skip to content

Instantly share code, notes, and snippets.

@fresky
Created August 24, 2012 05:57
Show Gist options
  • Save fresky/3446193 to your computer and use it in GitHub Desktop.
Save fresky/3446193 to your computer and use it in GitHub Desktop.
WriteXML
XmlWriterSettings xws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true
};
XDocument doc;
using (XmlWriter xw = XmlWriter.Create(new StreamWriter(@"D: est.xml"), xws))
{
doc = new XDocument(
new XElement("GarbageCanList",
new XElement("GarbageCan",
new XElement("Name", "name1"),
new XElement("Regex", "reg1"),
new XElement("Include", "Include1"),
new XElement("Exclude", "Exclude1"),
new XElement("File", true),
new XElement("Directory", false)
)
)
);
doc.Save(xw);
}
XmlWriterSettings xws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true
};
XDocument doc;
using (XmlWriter xw = XmlWriter.Create(new StreamWriter(@"D: est.xml"), xws))
{
doc = new XDocument(
new XElement("GarbageCanList",
new XElement("GarbageCan",
new XElement("Name", "name1"),
new XElement("Regex", "reg1"),
new XElement("Include", "Include1"),
new XElement("Exclude", "Exclude1"),
new XElement("File", true),
new XElement("Directory", false)
)
)
);
doc.Save(xw);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment