当前位置: 首页>>代码示例>>C#>>正文


C# XmlDocument.CreateCDataSection方法代码示例

本文整理汇总了C#中XmlDocument.CreateCDataSection方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument.CreateCDataSection方法的具体用法?C# XmlDocument.CreateCDataSection怎么用?C# XmlDocument.CreateCDataSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XmlDocument的用法示例。


在下文中一共展示了XmlDocument.CreateCDataSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertDataBeyondEndOfCdataNodeBigNumber

        public static void InsertDataBeyondEndOfCdataNodeBigNumber()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("hello");

            Assert.Throws<ArgumentOutOfRangeException>(() => cdataNode.InsertData(10, "hello "));
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:7,代码来源:InsertDataTests.cs

示例2: CreateEmptyCdata

        public static void CreateEmptyCdata()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection(String.Empty);

            Assert.Equal(0, cdataNode.Length);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:LengthTests.cs

示例3: CreateCdata

        public static void CreateCdata()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcde");

            Assert.Equal(5, cdataNode.Length);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:LengthTests.cs

示例4: SubstringBeforeBeginning

        public static void SubstringBeforeBeginning()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcde");

            Assert.Throws<ArgumentOutOfRangeException>(() => cdataNode.Substring(-1, 1));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:SubstringTests.cs

示例5: NameOfAllTypes

        public static void NameOfAllTypes()
        {
            var xmlDocument = new XmlDocument();

            var element = xmlDocument.CreateElement("newElem");
            Assert.Equal("newElem", element.Name);

            var attribute = xmlDocument.CreateAttribute("newAttr");
            Assert.Equal("newAttr", attribute.Name);

            var text = xmlDocument.CreateTextNode("");
            Assert.Equal("#text", text.Name);

            var cdata = xmlDocument.CreateCDataSection("");
            Assert.Equal("#cdata-section", cdata.Name);

            var pi = xmlDocument.CreateProcessingInstruction("PI", "");
            Assert.Equal("PI", pi.Name);

            var comment = xmlDocument.CreateComment("some text");
            Assert.Equal("#comment", comment.Name);

            var fragment = xmlDocument.CreateDocumentFragment();
            Assert.Equal("#document-fragment", fragment.Name);
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:25,代码来源:NameTests.cs

示例6: LengthOfCdataAfterDelete

        public static void LengthOfCdataAfterDelete()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcde");

            cdataNode.DeleteData(0, 1);
            Assert.Equal(4, cdataNode.Length);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:LengthTests.cs

示例7: InsertCDataNodeToDocumentNode

        public static void InsertCDataNodeToDocumentNode()
        {
            var xmlDocument = new XmlDocument();
            xmlDocument.LoadXml("<a/>");
            var cDataSection = xmlDocument.CreateCDataSection("data");

            Assert.Throws<InvalidOperationException>(() => xmlDocument.InsertBefore(cDataSection, null));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:InsertBeforeTests.cs

示例8: EmptyString

        public static void EmptyString()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection(String.Empty);

            var subString = cdataNode.Substring(0, 10);

            Assert.Equal(String.Empty, subString);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:SubstringTests.cs

示例9: CDataNodeNode

        public static void CDataNodeNode()
        {
            var xmlDocument = new XmlDocument();
            var node = xmlDocument.CreateCDataSection("cdata section");

            Assert.Equal("cdata section", node.Value);
            node.Value = "new cdata";
            Assert.Equal("new cdata", node.Value);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:ValueTests.cs

示例10: ReplaceAllCharactersFromCdataNodeBeginning

        public static void ReplaceAllCharactersFromCdataNodeBeginning()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcdefgh");

            cdataNode.ReplaceData(0, cdataNode.Length, "new string");

            Assert.Equal("new string", cdataNode.Data);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:ReplaceTests.cs

示例11: Replace4CharactersFromCdataNode

        public static void Replace4CharactersFromCdataNode()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcde");

            cdataNode.ReplaceData(1, 4, "test");

            Assert.Equal("atest", cdataNode.Data);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:ReplaceTests.cs

示例12: Replace1CharactersFromCdataNodeBeginning

        public static void Replace1CharactersFromCdataNodeBeginning()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("abcde");

            cdataNode.ReplaceData(0, 1, "&");

            Assert.Equal("&bcde", cdataNode.Data);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:9,代码来源:ReplaceTests.cs

示例13: InsertDataInEmptyCdataNode

        public static void InsertDataInEmptyCdataNode()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection(null);

            cdataNode.InsertData(0, "hello");

            Assert.Equal("hello", cdataNode.Data);
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:9,代码来源:InsertDataTests.cs

示例14: InsertDataAtMiddleOfCdataNode

        public static void InsertDataAtMiddleOfCdataNode()
        {
            var xmlDocument = new XmlDocument();
            var cdataNode = (XmlCharacterData)xmlDocument.CreateCDataSection("comment");

            cdataNode.InsertData(3, " hello ");

            Assert.Equal("com hello ment", cdataNode.Data);
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:9,代码来源:InsertDataTests.cs

示例15: CreateCDataTest2

        public static void CreateCDataTest2()
        {
            var xmlDocument = new XmlDocument();
            var cdata = xmlDocument.CreateCDataSection("test data");

            Assert.Equal("<![CDATA[test data]]>", cdata.OuterXml);
            Assert.Equal(String.Empty, cdata.InnerXml);
            Assert.Equal("test data", cdata.InnerText);
            Assert.Equal(XmlNodeType.CDATA, cdata.NodeType);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:10,代码来源:CreateCDataSectionTests.cs


注:本文中的XmlDocument.CreateCDataSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。