Exemplo n.º 1
0
        public void ComplexXmlDocument()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendXmlDeclaration(null, null);

            xmlBuilder.AddAttribute("version", "2.01");
            xmlBuilder.AppendStartTag("rss");
            xmlBuilder.AppendStartTag("channel");
            xmlBuilder.AppendElement("name", "Rss 2.01 Channel");
            xmlBuilder.AppendEndTag();
            xmlBuilder.AppendEndTag();

            Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?><rss version=\"2.01\"><channel><name>Rss 2.01 Channel</name></channel></rss>",
                            xmlBuilder.ToString());
        }
Exemplo n.º 2
0
        public void AppendEndTag2()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendStartTag("ns", "tag");
            xmlBuilder.AppendEndTag();

            Assert.AreEqual("<ns:tag></ns:tag>", xmlBuilder.ToString());
        }
Exemplo n.º 3
0
        public void AppendEndTagWithoutStartTag()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendEndTag();
        }