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


C# XmlDocument.WithRoot方法代码示例

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


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

示例1: Write

        public XmlDocument Write(Test test)
        {
            var document = new XmlDocument();

            var node = new TestXmlNode(document.WithRoot("Test"));
            new WriterVisitor(test, node).Write();

            return document;
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:9,代码来源:TestWriter.cs

示例2: Write

        public static void Write(SettingsData data, string filename)
        {
            var document = new XmlDocument();
            var root = document.WithRoot("Settings");
            root.SetAttribute("category", data.Category.ToString());

            data.AllKeys.Each(
                key => { root.AddElement("add").WithAtt("key", key).WithAtt("value", data[key].ToString()); });

            document.Save(filename);
        }
开发者ID:NTCoding,项目名称:FubuRaven.NTCoding.com,代码行数:11,代码来源:XmlSettingsParser.cs

示例3: WriteSpecRoot

        public static XmlElement WriteSpecRoot(Specification specification, XmlDocument document)
        {
            var root = document.WithRoot(Spec);
            root.SetAttribute(Id, specification.id);
            root.SetAttribute(MaxRetries, specification.MaxRetries.ToString());
            root.SetAttribute(TagsAtt, specification.Tags.Join(", "));
            root.SetAttribute(LifecycleAtt, specification.Lifecycle.ToString());
            root.SetAttribute(Name, specification.name);

            return root;
        }
开发者ID:aabenoja,项目名称:Storyteller,代码行数:11,代码来源:XmlWriter.cs

示例4: XmlFromFileWithRoot

        public static XmlDocument XmlFromFileWithRoot(this string fileName, string root)
        {
            if (File.Exists(fileName))
            {
                return new XmlDocument().FromFile(fileName);
            }

            var document = new XmlDocument();
            document.WithRoot(root);

            return document;
        }
开发者ID:storyteller,项目名称:Storyteller,代码行数:12,代码来源:XmlExtensions.cs

示例5: XmlMediaDocument

        public XmlMediaDocument(XmlMediaOptions options)
        {
            _document = new XmlDocument();
            if (options.Namespace.IsEmpty())
            {
                _document.WithRoot(options.Root);
            }
            else
            {
                var node = _document.CreateNode(XmlNodeType.Element, options.Root, options.Namespace);
                _document.AppendChild(node);
            }

            _topNode = options.NodeStyle == XmlNodeStyle.AttributeCentric
                           ? (IXmlMediaNode) new XmlAttCentricMediaNode(_document.DocumentElement)
                           : new XmlNodeCentricMediaNode(_document.DocumentElement);

            _topNode.LinkWriter = options.LinkWriter;

            _options = options;
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:21,代码来源:XmlMediaDocument.cs

示例6: write_stream

        public void write_stream()
        {
            var document = new XmlDocument();
            document.WithRoot("root");

            theRecordedOutput.Write("text/xml", document.Save);
            theRecordedOutput.Outputs.First().ShouldEqual(new SetContentType("text/xml"));

            var writeStream = theRecordedOutput.Outputs.Last().ShouldBeOfType<WriteStream>();

            writeStream.ReadAll().ShouldEqual(document.OuterXml);
        }
开发者ID:NeilSorensen,项目名称:fubumvc,代码行数:12,代码来源:RecordedOutputTester.cs

示例7: write_stream

        public void write_stream()
        {
            var document = new XmlDocument();
            document.WithRoot("root");

            theRecordedOutput.Write("text/xml", stream =>
            {
                document.Save(stream);
                return Task.CompletedTask;
            });

            theRecordedOutput.Outputs.First().ShouldBe(new SetContentType("text/xml"));

            var writeStream = theRecordedOutput.Outputs.Last().ShouldBeOfType<WriteStream>();

            writeStream.ReadAll().ShouldBe(document.OuterXml);
        }
开发者ID:DarthFubuMVC,项目名称:fubumvc,代码行数:17,代码来源:RecordedOutputTester.cs


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