Пример #1
0
        public void AppendElementEmptyText()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendElement("tag", string.Empty);

            Assert.AreEqual("<tag></tag>", xmlBuilder.ToString());
        }
Пример #2
0
        public void AppendElementNullText()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendElement("tag", null);

            Assert.AreEqual("<tag />", xmlBuilder.ToString());
        }
Пример #3
0
        public void AppendElement()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendElement("tag", "inner text");

            Assert.AreEqual("<tag>inner text</tag>", xmlBuilder.ToString());
        }
Пример #4
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());
        }
Пример #5
0
        public void AppendElementEmptyName()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendElement(string.Empty, string.Empty);
        }
Пример #6
0
        public void AppendElementNullName()
        {
            XmlBuilder xmlBuilder = new XmlBuilder();

            xmlBuilder.AppendElement(null, string.Empty);
        }