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


C# XmlWriter.WriteElement方法代码示例

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


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

示例1: SerializeContent

 /// <summary>
 /// Write the contents of this element to the given <see cref="XmlWriter"/>.
 /// </summary>
 /// <remarks>The caller of this method has already written the start element tag before
 /// calling this method, so deriving classes only need to write the element content, not
 /// the start or end tags.</remarks>
 /// <param name="writer">Writer to send XML content to.</param>
 public override void SerializeContent(XmlWriter writer)
 {
     foreach(var interceptorElement in Interceptors)
     {
         writer.WriteElement("interceptor", interceptorElement.SerializeContent);
     }
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:14,代码来源:InterceptorsElement.cs

示例2: SerializeContent

 /// <summary>
 /// Write the contents of this element to the given <see cref="XmlWriter"/>.
 /// </summary>
 /// <remarks>The caller of this method has already written the start element tag before
 /// calling this method, so deriving classes only need to write the element content, not
 /// the start or end tags.</remarks>
 /// <param name="writer">Writer to send XML content to.</param>
 public override void SerializeContent(XmlWriter writer)
 {
     foreach(var policy in Policies)
     {
         writer.WriteElement("policy", policy.SerializeContent);
     }
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:14,代码来源:InterceptionElement.cs

示例3: SerializeContent

 /// <summary>
 /// Write the contents of this element to the given <see cref="XmlWriter"/>.
 /// </summary>
 /// <remarks>The caller of this method has already written the start element tag before
 /// calling this method, so deriving classes only need to write the element content, not
 /// the start or end tags.</remarks>
 /// <param name="writer">Writer to send XML content to.</param>
 public override void SerializeContent(XmlWriter writer)
 {
     foreach(var param in Parameters)
     {
         writer.WriteElement("param", param.SerializeContent);
     }
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:14,代码来源:ConstructorElement.cs

示例4: SerializeContainerConfiguringElements

 private void SerializeContainerConfiguringElements(XmlWriter writer)
 {
     foreach(var element in ConfiguringElements)
     {
         string tag = ExtensionElementMap.GetTagForExtensionElement(element);
         writer.WriteElement(tag, element.SerializeContent);
     }
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:8,代码来源:ContainerElement.cs

示例5: WriteXml

 public override void WriteXml(XmlWriter writer)
 {
     // Write tag attributes
     base.WriteXml(writer);
     writer.WriteElement(PeptideSettings);
     writer.WriteElement(TransitionSettings);
     writer.WriteElement(DataSettings);
     if (MeasuredResults != null)
         writer.WriteElement(MeasuredResults);
     if (!DocumentRetentionTimes.IsEmpty)
         writer.WriteElement(DocumentRetentionTimes);
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:12,代码来源:SrmSettings.cs

示例6: SerializeContent

        public override void SerializeContent(XmlWriter writer)
        {
            Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");

            writer.WriteAttributeString(NamePropertyName, this.Name);
            foreach (var matchingRuleElement in this.MatchingRules)
            {
                writer.WriteElement("matchingRule", matchingRuleElement.SerializeContent);
            }
            foreach (var callHandlerElement in this.CallHandlers)
            {
                writer.WriteElement("callHandler", callHandlerElement.SerializeContent);
            }
        }
开发者ID:kangkot,项目名称:unity,代码行数:14,代码来源:PolicyElement.cs

示例7: SerializeContent

 /// <summary>
 /// Write the contents of this element to the given <see cref="XmlWriter"/>.
 /// </summary>
 /// <remarks>The caller of this method has already written the start element tag before
 /// calling this method, so deriving classes only need to write the element content, not
 /// the start or end tags.</remarks>
 /// <param name="writer">Writer to send XML content to.</param>
 public override void SerializeContent(XmlWriter writer)
 {
     writer.WriteAttributeString(NamePropertyName, Name);
     foreach(var matchingRuleElement in MatchingRules)
     {
         writer.WriteElement("matchingRule", matchingRuleElement.SerializeContent);
     }
     foreach(var callHandlerElement in CallHandlers)
     {
         writer.WriteElement("callHandler", callHandlerElement.SerializeContent);
     }
 }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:19,代码来源:PolicyElement.cs

示例8: SerializeInjectionMembers

 private void SerializeInjectionMembers(XmlWriter writer)
 {
     foreach(var member in InjectionMembers)
     {
         writer.WriteElement(member.ElementName, member.SerializeContent);
     }
 }
开发者ID:theoju,项目名称:CleanCode,代码行数:7,代码来源:RegisterElement.cs

示例9: SerializeContent

        public override void SerializeContent(XmlWriter writer)
        {
            Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");

            writer.WriteAttributeString(TypePropertyName, TypeName);
            writer.WriteAttributeIfNotEmpty(MapToPropertyName, MapToName)
                .WriteAttributeIfNotEmpty(NamePropertyName, Name);

            if(!string.IsNullOrEmpty(Lifetime.TypeName))
            {
                writer.WriteElement("lifetime", Lifetime.SerializeContent);
            }

            SerializeInjectionMembers(writer);
        }
开发者ID:theoju,项目名称:CleanCode,代码行数:15,代码来源:RegisterElement.cs

示例10: WriteXml

        public void WriteXml(XmlWriter writer)
        {
            // Write attributes
            writer.WriteAttribute(ATTR.pick, Pick);
            if (RankId != null || _rankIdName != null)
            {
                // If libraries were never connected properly, then _rankIdName may still contain
                // the rank ID.
                writer.WriteAttribute(ATTR.rank_type, RankId != null ? RankId.Value : _rankIdName);
                writer.WriteAttributeNullable(ATTR.peptide_count, PeptideCount);
            }
            writer.WriteAttribute(ATTR.document_library, HasDocumentLibrary);

            // Write child elements
            var libraries = (_libraries.Count > 0 || _disconnectedLibraries == null ?
                _libraries : _disconnectedLibraries);

            if (libraries.Count > 0)
            {
                // writer.WriteElements(_libraries, LIBRARY_HELPERS);
                for (int i = 0; i < libraries.Count; i++)
                {
                    // First make sure it's not the document library
                    var spec = (!ReferenceEquals(libraries, _disconnectedLibraries) ? _librarySpecs[i] : null);
                    if (spec == null || !spec.IsDocumentLibrary)
                    {
                        // If there is a library, write it.  Otherwise, write the
                        // library spec.
                        var item = libraries[i];
                        if (item == null)
                        {
                            if (spec != null && !spec.IsDocumentLocal)
                            {
                                IXmlElementHelper<LibrarySpec> helper = XmlUtil.FindHelper(spec, LIBRARY_SPEC_HELPERS);
                                if (helper == null)
                                    throw new InvalidOperationException(
                                        Resources.
                                            PeptideLibraries_WriteXml_Attempt_to_serialize_list_containing_invalid_type);
                                writer.WriteElement(helper.ElementNames[0], spec);
                            }
                        }
                        else
                        {
                            IXmlElementHelper<Library> helper = XmlUtil.FindHelper(item, LIBRARY_HELPERS);
                            if (helper == null)
                                throw new InvalidOperationException(
                                    Resources.
                                        PeptideLibraries_WriteXml_Attempt_to_serialize_list_containing_invalid_type);
                            writer.WriteElement(helper.ElementNames[0], item);
                        }
                    }
                }
            }
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:54,代码来源:PeptideSettings.cs

示例11: ExportCollada_NodeSub

        private void ExportCollada_NodeSub(XmlWriter xml, IReadOnlyList<string> boneNames, Kn5Node node) {
            xml.WriteStartElement("node");
            xml.WriteAttributeStringSafe("id", node.Name);
            xml.WriteAttributeStringSafe("sid", node.Name);
            xml.WriteAttributeStringSafe("name", node.Name);

            xml.WriteAttributeString("layer", node.Active ? "Visible" : "Hidden");
            xml.WriteAttributeString("type", node.NodeClass == Kn5NodeClass.Base && boneNames.Contains(node.Name) ? "JOINT" : "NODE");

            if (node.Children?.FirstOrDefault()?.NodeClass != Kn5NodeClass.SkinnedMesh) {
                xml.WriteElement("matrix",
                        "sid", "transform",
                        node.NodeClass == Kn5NodeClass.Base ? XmlWriterExtension.MatrixToCollada(node.Transform) : "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0");
            }

            if (IsMultiMaterial(node) && node.Children != null) {
                xml.WriteStartElement("instance_geometry");
                xml.WriteAttributeStringSafe("url", $"#{node.Name}-mesh");
                ExportCollada_NodeSub_BindMaterial(xml, node.Children.Select(x => x.MaterialId).ToArray());
                xml.WriteEndElement();
            } else {
                ExportCollada_NodeSub_Inner(xml, boneNames, node);
            }

            xml.WriteEndElement(); // node
        }
开发者ID:gro-ove,项目名称:actools,代码行数:26,代码来源:Kn5_ExportCollada.cs

示例12: ExportCollada_Mesh

        private void ExportCollada_Mesh(XmlWriter xml, string name, IReadOnlyList<Kn5Node> unsorted) {
            xml.WriteStartElement("geometry");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh");
            xml.WriteAttributeStringSafe("name", name);

            xml.WriteStartElement("mesh");

            var nodes = unsorted.Count == 1 ? unsorted :
                    unsorted.OrderBy(x => int.Parse(x.Name.Split(new[] { "_SUB" }, StringSplitOptions.None).Last())).ToList();

            /* coordinates */
            var vertexCount = nodes.Sum(x => x.Vertices.Length);
            xml.WriteStartElement("source");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-positions");
            xml.WriteStartElement("float_array");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-positions-array");
            xml.WriteAttributeString("count", vertexCount * 3);
            xml.WriteString(nodes.SelectMany(x => x.Vertices).SelectMany(x => x.Co).JoinToString(" "));
            xml.WriteEndElement(); // float_array

            xml.WriteStartElement("technique_common");
            xml.WriteStartElement("accessor");
            xml.WriteAttributeStringSafe("source", $"#{name}-mesh-positions-array");
            xml.WriteAttributeString("count", vertexCount);
            xml.WriteAttributeString("stride", 3);

            xml.WriteElement("param",
                    "name", "X",
                    "type", "float");
            xml.WriteElement("param",
                    "name", "Y",
                    "type", "float");
            xml.WriteElement("param",
                    "name", "Z",
                    "type", "float");

            xml.WriteEndElement(); // accessor
            xml.WriteEndElement(); // technique_common
            xml.WriteEndElement(); // source

            /* normals */
            xml.WriteStartElement("source");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-normals");
            xml.WriteStartElement("float_array");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-normals-array");
            xml.WriteAttributeString("count", vertexCount * 3);
            xml.WriteString(nodes.SelectMany(x => x.Vertices).SelectMany(x => x.Normal).JoinToString(" "));
            xml.WriteEndElement(); // float_array

            xml.WriteStartElement("technique_common");
            xml.WriteStartElement("accessor");
            xml.WriteAttributeStringSafe("source", $"#{name}-mesh-normals-array");
            xml.WriteAttributeString("count", vertexCount);
            xml.WriteAttributeString("stride", "3");
            
            xml.WriteElement("param",
                    "name", "X",
                    "type", "float");
            xml.WriteElement("param",
                    "name", "Y",
                    "type", "float");
            xml.WriteElement("param",
                    "name", "Z",
                    "type", "float");

            xml.WriteEndElement(); // accessor
            xml.WriteEndElement(); // technique_common
            xml.WriteEndElement(); // source

            /* uv */
            xml.WriteStartElement("source");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-map-0");
            xml.WriteStartElement("float_array");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-map-0-array");
            xml.WriteAttributeString("count", vertexCount * 2);
            xml.WriteString(nodes.SelectMany(x => x.Vertices).SelectMany(x => new[] { x.Uv[0], -x.Uv[1] }).JoinToString(" "));
            xml.WriteEndElement(); // float_array

            xml.WriteStartElement("technique_common");
            xml.WriteStartElement("accessor");
            xml.WriteAttributeStringSafe("source", $"#{name}-mesh-map-0-array");
            xml.WriteAttributeString("count", vertexCount);
            xml.WriteAttributeString("stride", 2);

            xml.WriteElement("param",
                    "name", "S",
                    "type", "float");
            xml.WriteElement("param",
                    "name", "T",
                    "type", "float");

            xml.WriteEndElement(); // accessor
            xml.WriteEndElement(); // technique_common
            xml.WriteEndElement(); // source

            /* vertices */
            xml.WriteStartElement("vertices");
            xml.WriteAttributeStringSafe("id", $"{name}-mesh-vertices");
            xml.WriteElement("input",
                    "semantic", "POSITION",
//.........这里部分代码省略.........
开发者ID:gro-ove,项目名称:actools,代码行数:101,代码来源:Kn5_ExportCollada.cs

示例13: SerializeContent

        public override void SerializeContent(XmlWriter writer)
        {
            Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");

            writer.WriteAttributeString(NamePropertyName, this.Name);
            writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, this.TypeName);
            if (this.LifetimeIsPresent())
            {
                writer.WriteElement("lifetime", this.Lifetime.SerializeContent);
            }
            foreach (var injectionElement in this.Injection)
            {
                writer.WriteElement(injectionElement.ElementName, injectionElement.SerializeContent);
            }
        }
开发者ID:kangkot,项目名称:unity,代码行数:15,代码来源:PolicyChildElement.cs

示例14: SerializeContent

        public override void SerializeContent(XmlWriter writer)
        {
            Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");

            writer.WriteAttributeString(NamePropertyName, this.Name);
            foreach (var param in this.Parameters)
            {
                writer.WriteElement("param", param.SerializeContent);
            }
        }
开发者ID:kangkot,项目名称:unity,代码行数:10,代码来源:MethodElement.cs

示例15: SerializeContent

        /// <summary>
        /// Write the contents of this element to the given <see cref="XmlWriter"/>.
        /// </summary>
        /// <remarks>The caller of this method has already written the start element tag before
        /// calling this method, so deriving classes only need to write the element content, not
        /// the start or end tags.</remarks>
        /// <param name="writer">Writer to send XML content to.</param>
        public override void SerializeContent(XmlWriter writer)
        {
            writer.WriteAttributeString(TypePropertyName, TypeName);
            writer.WriteAttributeIfNotEmpty(MapToPropertyName, MapToName)
                .WriteAttributeIfNotEmpty(NamePropertyName, Name);

            if(!string.IsNullOrEmpty(Lifetime.TypeName))
            {
                writer.WriteElement("lifetime", Lifetime.SerializeContent);
            }

            SerializeInjectionMembers(writer);
        }
开发者ID:jorgeds001,项目名称:CodeSamples,代码行数:20,代码来源:RegisterElement.cs


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