Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var b = new ComplexSampleParseBenchmark();

            FastXml.XmlDocument result = null;
            for (var i = 0; i < 1000; i++)
            {
                result = b.FastXml();
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }