public string FastXml() { var root = new XmlNode("root"); var current = root; for (var i = 0; i < 10; i++) { var newElement = new XmlNode("child"); current.Childs.Add(newElement); current = newElement; } var doc = FastXmlDocument.FromRoot(root); return(XmlWriter.ToText(doc)); }
public string FastXml() { var subChilds = new List <XmlNode> { new XmlNode("subChild1"), new XmlNode("subChild2") }; subChilds[0].Attributes["attr2"] = "value2"; subChilds[0].Attributes["attr3"] = "value3"; var child = new XmlNode("child0", subChilds); child.Attributes["attr1"] = "value1"; var root = new XmlNode("root", new List <XmlNode> { child }); var doc = FastXmlDocument.FromRoot(root); return(XmlWriter.ToText(doc)); }