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


C# XmlWriter.WriteEndElement方法代码示例

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


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

示例1: AddProperty

 public static void AddProperty(string name, object value, XmlWriter wr)
 {
     string svalue = string.Empty;
     if (value is string)
         svalue = value as string;
     if (svalue.Length == 0 && value.GetType() == typeof(float))
         svalue = XmlConvert.ToString(Math.Round((float)value, 8));
     if (svalue.Length == 0 && value.GetType() == typeof(double))
         svalue = XmlConvert.ToString(Math.Round((double)value, 8));
     if (svalue.Length == 0 && value.GetType() == typeof(List<ModuleItems.Property>)){
         List<ModuleItems.Property> temp = (List<ModuleItems.Property>)value;
         foreach(ModuleItems.Property p in temp){
             wr.WriteStartElement("properties");
             wr.WriteAttributeString("name", p.name);
             wr.WriteAttributeString("value", p.value.ToString());
             wr.WriteEndElement();
         }
         return;
     }
     if (svalue.Length == 0)
         svalue = value.ToString();
     wr.WriteStartElement("property");
     wr.WriteAttributeString("name", name);
     wr.WriteAttributeString("value", svalue);
     wr.WriteEndElement();
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:26,代码来源:SerializeUtil.cs

示例2: DoWrite

 protected override void DoWrite(XmlWriter writer, Object obj, IXmlRpcStreamConfig config, ITypeSerializerFactory typeSerializerFactory)
 {
     writer.WriteStartElement(XmlRpcSpec.VALUE_TAG);
     writer.WriteStartElement(XmlRpcSpec.EXTENSIONS_PREFIX, XmlRpcSpec.NIL_TAG, XmlRpcSpec.EXTENSIONS_URI);
     writer.WriteEndElement();
     writer.WriteEndElement();
 }
开发者ID:longshine,项目名称:EasyWeb.NET,代码行数:7,代码来源:NullSerializer.cs

示例3: TraverseDirectory

        private static void TraverseDirectory(XmlWriter writer, string path, StringBuilder textToShowinConsole)
        {
            bool inDirectories = true;
            string[] folderDirectories = Directory.GetDirectories(path);

            if (0 == folderDirectories.Length)
            {
                folderDirectories = Directory.GetFiles(path);
                inDirectories = false;
            }

            for (int i = 0; i < folderDirectories.Length; i++)
            {
                textToShowinConsole.AppendLine(folderDirectories[i]);
                if (inDirectories)
                {
                    writer.WriteStartElement("dir");
                    writer.WriteAttributeString("path", folderDirectories[i]);
                    TraverseDirectory(writer, folderDirectories[i], textToShowinConsole);
                    writer.WriteEndElement();
                }
                else
                {
                    writer.WriteStartElement("file");
                    writer.WriteAttributeString("filename", Path.GetFileName(folderDirectories[i]));
                    writer.WriteEndElement();
                }
            }
        }
开发者ID:viktorD1m1trov,项目名称:T-Academy,代码行数:29,代码来源:VeryLaggProgram.cs

示例4: Write

        /// <summary>
        /// Writes the section using an XML writer
        /// </summary>
        /// <param name="writer">XML writer to use</param>
        /// <param name="project">The project to generate .csproj for</param>
        /// <param name="context">Current .csproj generation context</param>
        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            writer.WriteStartElement("PropertyGroup");
            writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' ");
            WriteConfigurationSpecificPart(writer, project);
            writer.WriteEndElement();

            writer.WriteStartElement("PropertyGroup");

            // Writing out configuration specific part to the non conditional block as well
            WriteConfigurationSpecificPart(writer, project);

            writer.WriteElementString("OutputType", GetOutputType(project.Type));
            writer.WriteElementString("AssemblyName", project.Name);
            writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B"));

            CsharpProjectParameters parameters = project.GetInheritableParameters<CsharpProjectParameters, CsharpProjectParametersDef>("csharp");

            parameters.FillProjectSpecificMissingInfo(project);
            parameters.ToCsprojProperties(writer);

            WriteAppConfig(writer, project);
            WriteManifest(writer, project);
            WriteApplicationIcon(writer, project, parameters);

            writer.WriteEndElement();
        }
开发者ID:vigoo,项目名称:bari,代码行数:33,代码来源:PropertiesSection.cs

示例5: WriteClaimsIdentity

        private void WriteClaimsIdentity( ClaimsIdentity ci, XmlWriter writer )
        {
            writer.WriteStartElement( "ClaimsIdentity" );
            writer.WriteAttributeString( "Name", ci.Name );
            writer.WriteAttributeString( "NameClaimType", ci.NameClaimType );
            writer.WriteAttributeString( "RoleClaimType", ci.RoleClaimType );
            writer.WriteAttributeString( "Label", ci.Label );

            if ( ci.Actor != null )
            {
                writer.WriteStartElement( "Actor" );
                WriteClaimsIdentity( ci.Actor, writer );
                writer.WriteEndElement();
            }

            foreach ( Claim c in ci.Claims )
            {
                writer.WriteStartElement( "Claim" );
                writer.WriteAttributeString( "Value", c.Value );
                writer.WriteAttributeString( "Type", c.Type );
                writer.WriteAttributeString( "ValueType", c.ValueType );
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:ClaimsPrincipalTraceRecord.cs

示例6: WriteXmlSchemaType

 public override void WriteXmlSchemaType(XmlWriter xw, string xmlns)
 {
     xw.WriteStartElement("complexType", XmlSchemaUtil.SCHEMA_NS);
     if (Name != null) xw.WriteAttributeString("name", Name);
     xw.WriteStartElement("sequence", XmlSchemaUtil.SCHEMA_NS);
     foreach (MemberDef member in Members)
     {
         xw.WriteStartElement("element", XmlSchemaUtil.SCHEMA_NS);
         xw.WriteAttributeString("name", member.Name);
         TypeDef td = ParentTypeSet.GetTypeDef(member.TypeName);
         if (td.IsSimpleType)
         {
             xw.WriteAttributeString("type", "xs:" + td.Name);
             if (member.IsRequired)
                 xw.WriteAttributeString("nillable", "false");
         }
         else
         {
             if (string.IsNullOrEmpty(xmlns))
                 xw.WriteAttributeString("type", td.Name);
             else
             {
                 string prf = xw.LookupPrefix(xmlns);
                 xw.WriteAttributeString("type", string.Format("{0}:{1}", prf, td.Name));
             }
         }
         xw.WriteAttributeString("minOccurs", member.IsRequired ? "1" : "0");
         xw.WriteAttributeString("maxOccurs", member.IsArray ? "unbounded" : "1");
         xw.WriteEndElement();
     }
     xw.WriteEndElement();
     xw.WriteEndElement();
 }
开发者ID:yonglehou,项目名称:NGinnBPM,代码行数:33,代码来源:StructDef.cs

示例7: Write

        /// <summary>
        /// Writes the section using an XML writer
        /// </summary>
        /// <param name="writer">XML writer to use</param>
        /// <param name="project">The project to generate .csproj for</param>
        /// <param name="context">Current .csproj generation context</param>
        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            var csRoot = project.RootDirectory.GetChildDirectory("cs");
            if (csRoot != null)
            {
                var serviceReferencesRoot = csRoot.GetChildDirectory("Service References");
                if (serviceReferencesRoot != null)
                {
                    writer.WriteStartElement("ItemGroup");

                    writer.WriteStartElement("WCFMetadata");
                    writer.WriteAttributeString("Include", "Service References" + Path.DirectorySeparatorChar);
                    writer.WriteEndElement();

                    foreach (var child in serviceReferencesRoot.ChildDirectories)
                    {
                        writer.WriteStartElement("WCFMetadataStorage");
                        writer.WriteAttributeString("Include", "Service References\\" + child + Path.DirectorySeparatorChar);
                        writer.WriteEndElement();
                    }

                    writer.WriteEndElement();
                }
            }
        }
开发者ID:vigoo,项目名称:bari,代码行数:31,代码来源:WCFMetadataSection.cs

示例8: ProcessDirectory

        public static void ProcessDirectory(string targetDirectory, XmlWriter writer)
        {
            // Process the list of files found in the directory.
            string[] fileEntries = Directory.GetFiles(targetDirectory);

            writer.WriteStartElement("dir");

            foreach (string fileName in fileEntries)
            {
                writer.WriteStartElement("file");
                writer.WriteString(fileName);
                writer.WriteEndElement();
            }

            // Recurse into subDirectories of this directory.
            string[] subDirectoryEntries = Directory.GetDirectories(targetDirectory);

            foreach (string subDirectory in subDirectoryEntries)
            {
                writer.WriteStartElement("dir");
                writer.WriteAttributeString("dirName", subDirectory);
                ProcessDirectory(subDirectory, writer);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:27,代码来源:EntryPoint.cs

示例9: WriteResponseMessage

        public void WriteResponseMessage ( XmlWriter writer, string innerXml, NuxleusAsyncResult asyncResult ) {

            using (writer) {
                writer.WriteStartDocument();
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='/service/transform/openid-redirect.xsl'");
                }
                writer.WriteStartElement("auth");
                writer.WriteAttributeString("xml:base", "http://dev.amp.fm/");
                writer.WriteAttributeString("status", m_status);
                if (m_responseType == ResponseType.REDIRECT) {
                    writer.WriteElementString("url", "http://dev.amp.fm/");
                }
                if (m_responseType == ResponseType.QUERY_RESPONSE && innerXml != null) {
                    writer.WriteStartElement("response");
                    writer.WriteRaw(innerXml);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }

            asyncResult.CompleteCall();

        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:25,代码来源:Message.cs

示例10: Write

        public void Write()
        {
            XmlWriterSettings xmlSetting = new XmlWriterSettings();
            xmlSetting.CloseOutput = true;
            xmlSetting.Encoding = Encoding.UTF8;
            xmlSetting.Indent = true;
            xmlSetting.NewLineChars = "\r\n";

            wr = XmlWriter.Create(GeneralConfig.AppDataPath + "Questionaries\\" + questionary.Category + ".xml", xmlSetting);
            wr.WriteStartDocument();
            wr.WriteStartElement("Questionary");
            wr.WriteStartAttribute("category");
            wr.WriteValue(questionary.Category);
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("created");
            wr.WriteValue(questionary.Created.ToString());
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("updated");
            wr.WriteValue(questionary.Updated.ToString());
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("template");
            wr.WriteValue(questionary.TemplateId);
            wr.WriteEndAttribute();

            wr.WriteStartElement("Questions");
            WriteQuestions();
            wr.WriteEndElement();

            wr.WriteEndElement();
            wr.WriteEndDocument();
            wr.Close();
        }
开发者ID:foresightbrand,项目名称:kebibi,代码行数:35,代码来源:QuestionaryWriter.cs

示例11: WriteSummaryDocument

		private void WriteSummaryDocument(XmlWriter writer, string systemManagedItemName, List<string> userRoles)
		{
			//document (root node)
			writer.WriteStartElement("document");
			writer.WriteAttributeString("xmlns", "", null, XMLNames._M_TallComponents_URL);

			//	<sections>
			writer.WriteStartElement("sections");

			//	<section>
			writer.WriteStartElement("section");

			//	<margin bottom="" top="" left="" right="" />
			writer.WriteStartElement("margin");
			writer.WriteAttributeString("top", "72");
			writer.WriteAttributeString("right", "36");
			writer.WriteAttributeString("bottom", "72");
			writer.WriteAttributeString("left", "36");
			writer.WriteEndElement();  // </margin>

			WriteSummaryDocumentBody(writer, systemManagedItemName, userRoles);
			WriteSummaryPageHeaders(writer, "odd");
			WriteSummaryPageHeaders(writer, "even");
			WriteSummaryPageFooters(writer, systemManagedItemName, "odd");
			WriteSummaryPageFooters(writer, systemManagedItemName, "even");

			writer.WriteEndElement();   // </section>
			writer.WriteEndElement();   // </sections>
			writer.WriteEndElement();   // </document>
		}
开发者ID:dlnuckolls,项目名称:glorykidd-public,代码行数:30,代码来源:ManagedItemSummary.cs

示例12: WriteXml

		///<summary>This is not explicitly called by our code.  It's required for the IXmlSerializable interface, which we have defined for this class.  So C# will call this when we call Serialize().</summary>
		public void WriteXml(XmlWriter writer) {
			/* we want the result to look like this:
			<TypeName>Patient</TypeName>
			<Obj>
				<Patient>
					<LName>Smith</LName>
					<PatNum>22</PatNum>
					<IsGuar>True</IsGuar>
				</Patient>
			</Obj>
			*/
			writer.WriteStartElement("TypeName");
			writer.WriteString(TypeName);
			writer.WriteEndElement();//TypeName
			writer.WriteStartElement("Obj");
			if(TypeName=="System.Drawing.Color") {
				XmlSerializer serializer = new XmlSerializer(typeof(int));
				serializer.Serialize(writer,((Color)Obj).ToArgb());
			}
			else {
				//string assemb=Assembly.GetAssembly(typeof(Db)).FullName;//"OpenDentBusiness, Version=14.3.0.0, Culture=neutral, PublicKeyToken=null"
				Type type=ConvertNameToType(TypeName);//,assemb);
				XmlSerializer serializer = new XmlSerializer(type);
				serializer.Serialize(writer,Obj);
			}
			writer.WriteEndElement();//Obj
		}
开发者ID:mnisl,项目名称:OD,代码行数:28,代码来源:DtoObject.cs

示例13: Write

        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            // TODO: merge common code with C# PropertiesSection

            writer.WriteStartElement("PropertyGroup");
            writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' ");
            WriteConfigurationSpecificPart(writer, project);
            writer.WriteEndElement();

            writer.WriteStartElement("PropertyGroup");
            WriteConfigurationSpecificPart(writer, project);
            
            writer.WriteElementString("OutputType", GetOutputType(project.Type));
            writer.WriteElementString("AssemblyName", project.Name);
            writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B"));

            FsharpProjectParameters parameters = project.HasParameters("fsharp")
                                         ? project.GetParameters<FsharpProjectParameters>("fsharp")
                                         : new FsharpProjectParameters(Suite);

            parameters.FillProjectSpecificMissingInfo(project);
            parameters.ToFsprojProperties(writer);   

            writer.WriteEndElement();
        }
开发者ID:zvrana,项目名称:bari,代码行数:25,代码来源:PropertiesSection.cs

示例14: WriteBooksToXml

        private static void WriteBooksToXml( XmlWriter writer, List<Book> booklist )
        {
            writer.WriteStartDocument();
              {
            writer.WriteStartElement("bdd", "books", NS); //This adds the root element, <bdd:books>.

            foreach(Book book in booklist) {

              writer.WriteStartElement("bdd", "book", NS); //Adds the element <bdd:book>.
              writer.WriteAttributeString("language", NS, book.Language); //Adding attributes to the element we just started.
              writer.WriteAttributeString("pages", NS, book.Pages);
              {
            writer.WriteElementString("title", NS, book.Title);
            if(book.Subtitle != "")
              writer.WriteElementString("subtitle", NS, book.Subtitle);
            if(book.Authors != null)
              foreach(string author in book.Authors)
                writer.WriteElementString("author", NS, author);
            else
              writer.WriteElementString("author", NS, book.Author);
            writer.WriteElementString("publisher", NS, book.Publisher);
            writer.WriteElementString("year", NS, book.Year);
              }
              writer.WriteEndElement(); //Closes the <bdd:book> element.
            }

            writer.WriteEndElement(); //Closes the <bdd:books> element.
              }
              writer.WriteEndDocument();
        }
开发者ID:jgn-epp,项目名称:Skole,代码行数:30,代码来源:Program.cs

示例15: WriteElement

        public void WriteElement(IAixmConverter converter, int flow, JObject feature, XmlWriter writer)
        {
            var validTime = feature["properties"]["avalibility"];
              var type = feature["properties"]["AixmType"];
              if (type != null)
              {
                  if (flow == 0)
                  {
                      writer.WriteStartElement("aixm", "timeSlice", null);
                      writer.WriteStartElement("aixm", type.ToString() + "TimeSlice", null);
                      if (validTime != null)
                      {
                          writer.WriteStartElement("gml", "validTime", null);
                          writer.WriteStartElement("gml", "TimePeriod", null);

                          writer.WriteElementString("gml", "beginPosition", null, "");
                          writer.WriteElementString("gml", "endPosition", null, "");

                          writer.WriteEndElement();
                          writer.WriteEndElement();
                      }
                     
                  }
                  else
                  {
                      writer.WriteEndElement();
                      writer.WriteEndElement();
                  }
              }
        }
开发者ID:s-innovations,项目名称:S-Innovations.Aixm,代码行数:30,代码来源:GMLValidTimeConverter.cs


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