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


C# XmlTextWriter.WriteFullEndElement方法代码示例

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


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

示例1: CreateXml

 public static void CreateXml(string path)
 {
     XmlTextWriter writer = new XmlTextWriter(path, Encoding.UTF8) {
         Formatting = Formatting.Indented
     };
     writer.WriteStartDocument();
     writer.WriteStartElement("root");
     for (int i = 0; i < 5; i++)
     {
         writer.WriteStartElement("Node");
         writer.WriteAttributeString("Text", "这是文章内容!~!!~~");
         writer.WriteAttributeString("ImageUrl", "");
         writer.WriteAttributeString("NavigateUrl", "Url..." + i.ToString());
         writer.WriteAttributeString("Expand", "true");
         for (int j = 0; j < 5; j++)
         {
             writer.WriteStartElement("Node");
             writer.WriteAttributeString("Text", "......名称");
             writer.WriteAttributeString("NavigateUrl", "Url..." + i.ToString());
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     writer.WriteFullEndElement();
     writer.Close();
 }
开发者ID:xiluo,项目名称:document-management,代码行数:26,代码来源:XmlUtil.cs

示例2: WriteXml

        public void WriteXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("module");
            xmlWriter.WriteAttributeString("name", testModule.Text);
            if (testModule.Trainer)
            {
                xmlWriter.WriteAttributeString("type", "training");
            }
            else
            {
                xmlWriter.WriteAttributeString("type", "test");
            }

            // Если ид не был прочитан при загрузке проекта.
            if (testModule.Id.Equals(Guid.Empty))
            {
                testModule.Id = Guid.NewGuid();
            }

            xmlWriter.WriteAttributeString("id", "#module{" + testModule.Id.ToString().ToUpper() + "}");
            xmlWriter.WriteAttributeString("order", testModule.QuestionSequence.ToString().ToLower());
            xmlWriter.WriteAttributeString("errlimit", testModule.MistakesNumber.ToString());
            xmlWriter.WriteAttributeString("time", testModule.TimeRestriction.ToString());
            if (testModule.TestType.Equals(Enums.TestType.InTest))
            {
                xmlWriter.WriteAttributeString("io", "i");
            }
            else if (testModule.TestType.Equals(Enums.TestType.OutTest))
            {
                xmlWriter.WriteAttributeString("io", "o");
            }

            #region Группы

            foreach (var g in testModule.Groups)
            {
                g.XmlWriter.WriteXml(xmlWriter);
            }

            #endregion

            #region Вопросы

            foreach (var q in testModule.Questions)
            {
                q.XmlWriter.WriteXml(xmlWriter);
            }

            #endregion

            xmlWriter.WriteFullEndElement();
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:52,代码来源:TestModuleXmlWriter.cs

示例3: WriteXml

        public override void WriteXml(XmlTextWriter xmlWriter)
        {
            var q = question as OuterQuestion;

            xmlWriter.WriteStartElement("question");
            xmlWriter.WriteAttributeString("name", q.Text);
            xmlWriter.WriteAttributeString("id", "#module{" + q.Id.ToString().ToUpper() + "}");
            if (q.NextQuestion != null)
            {
                xmlWriter.WriteAttributeString("next_question", "#module{" + q.NextQuestion.Id.ToString().ToUpper() + "}");
            }
            xmlWriter.WriteAttributeString("type", "outer");
            xmlWriter.WriteAttributeString("time", q.TimeRestriction.ToString());

            #region Wsdl

            xmlWriter.WriteStartElement("wsdl");
            xmlWriter.WriteAttributeString("address", q.Url);
            xmlWriter.WriteAttributeString("testid", q.TestId);
            xmlWriter.WriteEndElement();

            #endregion

            #region Task

            xmlWriter.WriteStartElement("task");
            xmlWriter.WriteAttributeString("id", q.TaskId);
            xmlWriter.WriteAttributeString("name", q.TaskName);
            xmlWriter.WriteAttributeString("subject", q.SubjectName);
            xmlWriter.WriteAttributeString("testname", q.TestName);
            xmlWriter.WriteStartElement("declaration");
            xmlWriter.WriteCData(q.DocumentHtml);
            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndElement();

            #endregion

            if (!(question.Parent is Group))
            {
                xmlWriter.WriteStartElement("mark");
                xmlWriter.WriteAttributeString("value", q.Marks.ToString());
                if (question.Profile != null)
                {
                    xmlWriter.WriteAttributeString("concept_id", "#elem{" + question.Profile.Id.ToString().ToUpper() + "}");
                }
                xmlWriter.WriteFullEndElement();
            }

            xmlWriter.WriteEndElement();
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:50,代码来源:OuterQuestionXmlWriter.cs

示例4: ProcessRequest

        public override void ProcessRequest(string request, ref Socket socket, bool authenticated, string body)
        {
            QueryString query = new QueryString(request);

            String sMimeType = "text/xml";
            string data="";

            string id = query.GetValues("id")[0];
            int hash = 0;
            try
            {
                hash = Convert.ToInt32(id);
                if (Earth3d.ImagesetHashTable.ContainsKey(hash))
                {

                    StringBuilder sb = new StringBuilder();
                    StringWriter sw = new StringWriter(sb);
                    using (XmlTextWriter xmlWriter = new XmlTextWriter( sw ))
                    {
                        xmlWriter.Formatting = Formatting.Indented;
                        xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
                        xmlWriter.WriteStartElement("Folder");

                        IImageSet imageset = (IImageSet)Earth3d.ImagesetHashTable[hash];
                        string alternateUrl = "";

                        try
                        {
                            if (File.Exists(imageset.Url))
                            {
                                alternateUrl = string.Format("http://{0}:5050/imageset/{1}/{2}", MyWebServer.IpAddress, hash, Path.GetFileName(imageset.Url));
                            }
                        }
                        catch
                        {
                        }
                        ImageSetHelper.SaveToXml(xmlWriter, imageset, alternateUrl);
                        xmlWriter.WriteFullEndElement();
                        xmlWriter.Close();
                    }
                    data = sb.ToString();
                }
            }
            catch
            {
            }

            SendHeaderAndData(data, ref socket, sMimeType);
        }
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:49,代码来源:HTTPImagesetWtml.cs

示例5: WriteXml

        public void WriteXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("group");
            xmlWriter.WriteAttributeString("count", group.ChosenQuestionsCount.ToString());
            xmlWriter.WriteAttributeString("name", group.Text);

            #region Вопросы

            foreach (var q in group.Questions)
            {
                q.XmlWriter.WriteXml(xmlWriter);
            }

            #endregion

            xmlWriter.WriteStartElement("mark");
            xmlWriter.WriteAttributeString("value", group.Marks.ToString());
            if (group.Profile != null)
            {
                xmlWriter.WriteAttributeString("concept_id", "#elem{" + group.Profile.Id.ToString().ToUpper() + "}");
            }
            xmlWriter.WriteFullEndElement();
            xmlWriter.WriteFullEndElement();
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:24,代码来源:GroupXmlWriter.cs

示例6: WriteXml

        public void WriteXml(XmlTextWriter xmlWriter)
        {
            foreach (var idc in trainingModule.InConceptParent.InDummyConcepts)
            {
                xmlWriter.WriteStartElement("input");
                xmlWriter.WriteAttributeString("concept_id", "#elem{" + idc.Concept.Id.ToString().ToUpper() + "}");
                xmlWriter.WriteEndElement();
            }

            foreach (var odc in trainingModule.OutConceptParent.OutDummyConcepts)
            {
                xmlWriter.WriteStartElement("output");
                xmlWriter.WriteAttributeString("concept_id", "#elem{" + odc.Concept.Id.ToString().ToUpper() + "}");
                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteStartElement("html_text");
            xmlWriter.WriteAttributeString("id", "{" + Guid.NewGuid().ToString().ToUpper() + "}");
            xmlWriter.WriteCData(HtmlToXml(trainingModule));
            xmlWriter.WriteFullEndElement();
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:21,代码来源:TrainingModuleXmlWriter.cs

示例7: saveMisc

        private void saveMisc()
        {
            Bitmap bmp = pictureBoxDot.Image as Bitmap;

            // dot is a circle with centerpoint in the middle of the gfx so we need only the radius as size
            int radius = bmp.Width;
            for (int x = 0; x < bmp.Width; x++)
                if (bmp.GetPixel(x, bmp.Height / 2).A == 0)
                    radius--;
            radius /= 2;

            XmlTextWriter textWriter = new XmlTextWriter(Path.Combine(folderBrowserDialogLevels.SelectedPath, "misc.xml"), null);
            textWriter.Formatting = Formatting.Indented;
            textWriter.WriteStartDocument();
            textWriter.WriteStartElement("Parameters");
            textWriter.WriteStartElement("Dot");
            textWriter.WriteAttributeString("X", XmlConvert.ToString(pictureBoxDot.Location.X + pictureBoxDot.Size.Width / 2 + panelGraphics.HorizontalScroll.Value));
            textWriter.WriteAttributeString("Y", XmlConvert.ToString(pictureBoxDot.Location.Y + pictureBoxDot.Size.Height / 2 + panelGraphics.VerticalScroll.Value));
            textWriter.WriteAttributeString("Radius", XmlConvert.ToString(radius));
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("Goal");
            textWriter.WriteAttributeString("LettersPercentage", textBoxLettersNeeded.Text);
            textWriter.WriteAttributeString("TimeSeconds", textBoxTime.Text);
            textWriter.WriteEndElement();
            textWriter.WriteFullEndElement();
            textWriter.Close();
        }
开发者ID:RyamBaCo,项目名称:ryambaco.github.io,代码行数:27,代码来源:Editor.cs

示例8: WriteNode

 // Writes the current node into the provided XmlWriter.
 private void WriteNode(XmlTextWriter xtw, bool defattr) {
     int d = this.NodeType == XmlNodeType.None ? -1 : this.Depth;
     while (this.Read() && (d < this.Depth)) {
         switch (this.NodeType) {
             case XmlNodeType.Element:
                 xtw.WriteStartElement(this.Prefix, this.LocalName, this.NamespaceURI);
                 xtw.QuoteChar = this.QuoteChar;
                 xtw.WriteAttributes(this, defattr);
                 if (this.IsEmptyElement) {
                     xtw.WriteEndElement();
                 }
                 break;
             case XmlNodeType.Text:
                 xtw.WriteString(this.Value);
                 break;
             case XmlNodeType.Whitespace:
             case XmlNodeType.SignificantWhitespace:
                 xtw.WriteWhitespace(this.Value);
                 break;
             case XmlNodeType.CDATA:
                 xtw.WriteCData(this.Value);
                 break;
             case XmlNodeType.EntityReference:
                 xtw.WriteEntityRef(this.Name);
                 break;
             case XmlNodeType.XmlDeclaration:
             case XmlNodeType.ProcessingInstruction:
                 xtw.WriteProcessingInstruction(this.Name, this.Value);
                 break;
             case XmlNodeType.DocumentType:
                 xtw.WriteDocType(this.Name, this.GetAttribute("PUBLIC"), this.GetAttribute("SYSTEM"), this.Value);
                 break;
             case XmlNodeType.Comment:
                 xtw.WriteComment(this.Value);
                 break;
             case XmlNodeType.EndElement:
                 xtw.WriteFullEndElement();
                 break;
         }
     }
     if (d == this.Depth && this.NodeType == XmlNodeType.EndElement) {
         Read();
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:45,代码来源:xmlreader.cs

示例9: saveHighScores

        void saveHighScores()
        {
            XmlTextWriter writer = new XmlTextWriter("Content\\highscores.xml", null);
            writer.Formatting = Formatting.Indented;

            writer.WriteRaw("<root>");
            foreach (HighScore element in highscores)
            {
                writer.WriteStartElement("item");
                writer.WriteElementString("name", element.name);
                writer.WriteElementString("score", element.score.ToString());
                writer.WriteFullEndElement();
            }
            writer.WriteRaw("\n</root>");
            writer.Close();
        }
开发者ID:kristijan-ujevic,项目名称:Breakout,代码行数:16,代码来源:Game.cs

示例10: WriteModules

        private static void WriteModules(CourseItem ci, XmlTextWriter xw)
        {
            for (var i = 0; i < ci.Nodes.Count; i++)
            {
                if (ci.Nodes[i] is TrainingModule)
                {
                    #region Запись учебных модулей

                    var tm = ci.Nodes[i] as TrainingModule;

                    xw.WriteStartElement("module");
                    xw.WriteAttributeString("name", tm.Text);
                    xw.WriteAttributeString("type", "text");
                    xw.WriteAttributeString("id", "#module{" + tm.Id.ToString().ToUpper() + "}");

                    tm.XmlWriter.WriteXml(xw);

                    RibbonStatusStripEx.Instance.MakeProgressStep(0);
                    System.Windows.Forms.Application.DoEvents();

                    if (tm.Nodes.Count != 0)
                    {
                        WriteModules(tm, xw);
                    }

                    xw.WriteFullEndElement();

                    #endregion
                }
                else if (ci.Nodes[i] is TestModule)
                {
                    #region Запись контролей

                    var tm = ci.Nodes[i] as TestModule;
                    tm.XmlWriter.WriteXml(xw);

                    #endregion

                    RibbonStatusStripEx.Instance.MakeProgressStep(0);
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:43,代码来源:SaveToXml.cs

示例11: EscreverXmlWSDLs

            /// <summary>
            /// Metodo responsavel em escrever o XML VersoesWSDLs.xml na pasta do executavel
            /// </summary>
            /// <author>
            /// Renan Borges - 25/06/2013
            /// </author>
            /// <param name="ListArquivosGerar">Lista com os informacoes a serem gravados pertinentes aos arquivos</param>
            private void EscreverXmlWSDLs(List<ArquivoItem> ListArquivosGerar)
            {

                if (ListArquivosGerar.Count > 0)
                {

                    XmlTextWriter arqXML = new XmlTextWriter(XMLVersoesWSDL, Encoding.UTF8);
                    arqXML.WriteStartDocument();

                    arqXML.Formatting = Formatting.Indented;
                    arqXML.WriteStartElement("arquivos");

                    foreach (ArquivoItem item in ListArquivosGerar)
                    {
                        arqXML.WriteStartElement("wsdl");

                        arqXML.WriteElementString("arquivo", item.Arquivo);
                        arqXML.WriteElementString("data", item.Data.ToShortDateString());
                        arqXML.WriteElementString("manual", item.Manual.ToString());

                        arqXML.WriteEndElement();
                    }

                    arqXML.WriteFullEndElement();

                    arqXML.Close();
                }

            }
开发者ID:Eversonbri,项目名称:NFSe.Net,代码行数:36,代码来源:ConfiguracaoApp.cs

示例12: saveFunctionXmlDocument

        ///*************************************************************************
        /// Method:		saveFunctionXmlDocument
        /// Description: recreating functions.xml document 
        ///
        /// Parameters:
        ///	functionXMLNavigator :
        ///
        ///	fileNameToSaveAs : filename
        ///
        ///  Return Value:  None
        ///*************************************************************************
        public void saveFunctionXmlDocument(FunctionXMLNavigator functionXMLNavigator, string fileNameToSaveAs,string fileEncoding,bool isValidationRequired)
        {
            XmlTextWriter saveFunctionXml;

            switch(fileEncoding.ToUpper())
            {
                case "UTF-8":
                case "":
                {
                    saveFunctionXml = new XmlTextWriter(fileNameToSaveAs,System.Text.UTF8Encoding.UTF8);
                    saveFunctionXml.Formatting = Formatting.Indented;
                    saveFunctionXml.WriteRaw( "<?xml version= \"1.0\"?>" );
                    break;
                }
                case "UTF-7":
                {
                    saveFunctionXml = new XmlTextWriter(fileNameToSaveAs,System.Text.UTF7Encoding.UTF7);
                    saveFunctionXml.Formatting = Formatting.Indented;
                    saveFunctionXml.WriteRaw( "<?xml version= \"1.0\" encoding=\"UTF-7\"?>" );
                    break;
                }
                case "ASCII":
                {
                    saveFunctionXml = new XmlTextWriter(fileNameToSaveAs,System.Text.ASCIIEncoding.ASCII);
                    saveFunctionXml.Formatting = Formatting.Indented;
                    saveFunctionXml.WriteRaw( "<?xml version= \"1.0\" encoding=\"ASCII\"?>" );
                    break;
                }
                case "Unicode":
                {
                    saveFunctionXml = new XmlTextWriter(fileNameToSaveAs,System.Text.UnicodeEncoding.Unicode);
                    saveFunctionXml.Formatting = Formatting.Indented;
                    saveFunctionXml.WriteRaw( "<?xml version= \"1.0\" encoding=\"Unicode\"?>" );
                    break;
                }
                default:
                {
                    saveFunctionXml = new XmlTextWriter(fileNameToSaveAs,null);
                    saveFunctionXml.Formatting = Formatting.Indented;
                    saveFunctionXml.WriteRaw( "<?xml version= \"1.0\"?>" );
                    break;
                }

            }

            if(isValidationRequired)
            {
                saveFunctionXml.WriteDocType("Functions",null,"functions.dtd","");
            }

            saveFunctionXml.WriteStartElement("Functions");

            foreach(string FunctionNameAsKey in FunctionTableByName.Keys)
            {
                Function FunctionToSave = functionXMLNavigator.GetFunctionByName(FunctionNameAsKey);

                ///Element = Function
                saveFunctionXml.WriteStartElement("Function");

                //Element = FunctionName
                saveFunctionXml.WriteStartElement("FunctionName");
                saveFunctionXml.WriteString(FunctionToSave.FunctionName.ToString());
                saveFunctionXml.WriteFullEndElement();

                //Element = OriginalDll
                saveFunctionXml.WriteStartElement("OriginalDll");
                saveFunctionXml.WriteString(FunctionToSave.OriginalDll.ToString());
                saveFunctionXml.WriteFullEndElement();

                //Element = InterceptedDll
                saveFunctionXml.WriteStartElement("InterceptedDll");
                saveFunctionXml.WriteString(FunctionToSave.InterceptedDll.ToString());
                saveFunctionXml.WriteFullEndElement();

                //Element = ReplacementFunctionName
                saveFunctionXml.WriteStartElement("ReplacementFunctionName");
                saveFunctionXml.WriteString(FunctionToSave.ReplacementFunctionName.ToString());
                saveFunctionXml.WriteFullEndElement();

                //Element = ReturnType
                saveFunctionXml.WriteStartElement("ReturnType");
                saveFunctionXml.WriteString(FunctionToSave.ReturnType.ToString());
                saveFunctionXml.WriteFullEndElement();

                //Element = Modifier
                for(int indexModifier =0; indexModifier < FunctionToSave.Modifiers.Count;indexModifier ++)
                {
                    saveFunctionXml.WriteStartElement("TypeModifier");
                    saveFunctionXml.WriteString(FunctionToSave.Modifiers[indexModifier].ToString());
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:Holodeck,代码行数:101,代码来源:FunctionXMLNavigator.cs

示例13: OutputDocComment

		//
		// Outputs XML documentation comment from tokenized comments.
		//
		public bool OutputDocComment (string asmfilename, string xmlFileName)
		{
			XmlTextWriter w = null;
			try {
				w = new XmlTextWriter (xmlFileName, null);
				w.Indentation = 4;
				w.Formatting = Formatting.Indented;
				w.WriteStartDocument ();
				w.WriteStartElement ("doc");
				w.WriteStartElement ("assembly");
				w.WriteStartElement ("name");
				w.WriteString (Path.GetFileNameWithoutExtension (asmfilename));
				w.WriteEndElement (); // name
				w.WriteEndElement (); // assembly
				w.WriteStartElement ("members");
				XmlCommentOutput = w;
				module.GenerateDocComment (this);
				w.WriteFullEndElement (); // members
				w.WriteEndElement ();
				w.WriteWhitespace (Environment.NewLine);
				w.WriteEndDocument ();
				return true;
			} catch (Exception ex) {
				Report.Error (1569, "Error generating XML documentation file `{0}' (`{1}')", xmlFileName, ex.Message);
				return false;
			} finally {
				if (w != null)
					w.Close ();
			}
		}
开发者ID:royleban,项目名称:mono,代码行数:33,代码来源:doc.cs

示例14: Serialize


//.........这里部分代码省略.........
						        (string) iter.ChildAnchor.Data ["serialize"];
						if (serialize != null)
							xml.WriteRaw (serialize);
					}
				// Line Separator character
				} else if (iter.Char == "\u2028") {
					xml.WriteCharEntity ('\u2028');
				} else if (depth_tag == null) {
					xml.WriteString (iter.Char);
				}

				bool end_of_depth_line = line_has_depth && next_iter.EndsLine ();

				bool next_line_has_depth = false;
				if (iter.Line < buffer.LineCount - 1) {
					Gtk.TextIter next_line = buffer.GetIterAtLine(iter.Line+1);
					next_line_has_depth =
					        ((NoteBuffer)buffer).FindDepthTag (next_line) != null;
				}

				bool at_empty_line = iter.EndsLine () && iter.StartsLine ();

				if (end_of_depth_line ||
				                (next_line_has_depth && (next_iter.EndsLine () || at_empty_line)))
				{
					// Close all tags in the tag_stack
					while (tag_stack.Count > 0) {
						Gtk.TextTag existing_tag = tag_stack.Pop ();

						// Any tags which continue across the indented
						// line are added to the continue_stack to be
						// reopened at the start of the next <list-item>
						if (!TagEndsHere (existing_tag, iter, next_iter)) {
							continue_stack.Push (existing_tag);
						}

						WriteTag (existing_tag, xml, false);
					}
				} else {
					foreach (Gtk.TextTag tag in iter.Tags) {
						if (TagEndsHere (tag, iter, next_iter) &&
						                NoteTagTable.TagIsSerializable(tag) && !(tag is DepthNoteTag))
						{
							while (tag_stack.Count > 0) {
								Gtk.TextTag existing_tag = tag_stack.Pop ();

								if (!TagEndsHere (existing_tag, iter, next_iter)) {
									replay_stack.Push (existing_tag);
								}

								WriteTag (existing_tag, xml, false);
							}

							// Replay the replay queue.
							// Restart any tags that
							// overlapped with the ended
							// tag...
							while (replay_stack.Count > 0) {
								Gtk.TextTag replay_tag = replay_stack.Pop ();
								tag_stack.Push (replay_tag);

								WriteTag (replay_tag, xml, true);
							}
						}
					}
				}

				// At the end of the line record that it
				// was the last line encountered with a depth
				if (end_of_depth_line) {
					line_has_depth = false;
					prev_depth_line = iter.Line;
				}

				// If we are at the end of a line with a depth and the
				// next line does not have a depth line close all <list>
				// and <list-item> tags that remain open
				if (end_of_depth_line && !next_line_has_depth) {
					for (int i = prev_depth; i > -1; i--) {
						// Close <list>
						xml.WriteFullEndElement ();
						// Close <list-item>
						xml.WriteFullEndElement ();
					}

					prev_depth = -1;
				}

				iter.ForwardChar ();
				next_iter.ForwardChar ();
			}

			// Empty any trailing tags left in tag_stack..
			while (tag_stack.Count > 0) {
				Gtk.TextTag tail_tag = tag_stack.Pop ();
				WriteTag (tail_tag, xml, false);
			}

			xml.WriteEndElement (); // </note-content>
		}
开发者ID:MatteoNardi,项目名称:Tomboy,代码行数:101,代码来源:NoteBuffer.cs

示例15: SaveToXmlFile

        /// <summary>
        /// Сериализует и сохраняет содержимое контроллера в файл в виде
        /// XML-схемы
        /// </summary>
        public void SaveToXmlFile(String path)
        {
            if (String.IsNullOrEmpty(path))
            {
                path = Environment.CurrentDirectory + @"\config.xml";
            }

            using (XmlTextWriter writer = new XmlTextWriter(path, null))
            {
                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument();
                
                writer.WriteStartElement("Network");
                writer.WriteAttributeString("Name", NetworkName);

                // Сохраняем список устройств
                writer.WriteStartElement("Devices");
                foreach (Device device in _Devices)
                {
                    writer.WriteStartElement("Device");
                    // Сохраняем свойства элемента "Device"
                    writer.WriteAttributeString("Address", device.Address.ToString());
                    writer.WriteAttributeString("Description", device.Description);
                    writer.WriteAttributeString("Status", device.Status.ToString());
                    
                    // Сохраняем узлы элемента "Device"
                    
                    // Сохраняем регистры хранения
                    writer.WriteStartElement("HoldingRegisters");
                    foreach (HoldingRegister register in device.HoldingRegisters)
                    {
                        writer.WriteStartElement("HoldingRegister");
                        writer.WriteAttributeString("Address", register.Address.ToString());
                        writer.WriteStartElement("Value");
                        writer.WriteValue(register.Value);
                        writer.WriteFullEndElement(); // "Value"
                        writer.WriteStartElement("Description");
                        writer.WriteString(register.Description);
                        writer.WriteFullEndElement(); // "Description"
                        writer.WriteFullEndElement(); // "HoldingRegister"
 
                    }
                    writer.WriteFullEndElement(); // "HoldingRegisters"

                    // Сохраняем входные регистры
                    writer.WriteStartElement("InputRegisters");
                    foreach (InputRegister register in device.InputRegisters)
                    {
                        writer.WriteStartElement("InputRegister");
                        writer.WriteAttributeString("Address", register.Address.ToString());
                        writer.WriteStartElement("Value");
                        writer.WriteValue(register.Value);
                        writer.WriteFullEndElement(); // "Value"
                        writer.WriteStartElement("Description");
                        writer.WriteString(register.Description);
                        writer.WriteFullEndElement(); // "Description"
                        writer.WriteFullEndElement(); // "InputRegister"

                    }
                    writer.WriteFullEndElement(); // "InputRegisters"

                    // Сохраняем дискретные входы/выходы
                    writer.WriteStartElement("Сoils");
                    foreach (Coil coil in device.Coils)
                    {
                        writer.WriteStartElement("Coil");
                        writer.WriteAttributeString("Address", coil.Address.ToString());
                        writer.WriteStartElement("Value");
                        writer.WriteValue(coil.Value);
                        writer.WriteFullEndElement(); // "Value"
                        writer.WriteStartElement("Description");
                        writer.WriteString(coil.Description);
                        writer.WriteFullEndElement(); // "Description"
                        writer.WriteFullEndElement(); // "Coil"

                    }
                    writer.WriteFullEndElement(); // "Сoils"

                    // Сохраняем дискретные входы
                    writer.WriteStartElement("DiscretesInputs");
                    foreach (DiscreteInput dicsreteInput in device.DiscretesInputs)
                    {
                        writer.WriteStartElement("DiscreteInput");
                        writer.WriteAttributeString("Address", dicsreteInput.Address.ToString());
                        writer.WriteStartElement("Value");
                        writer.WriteValue(dicsreteInput.Value);
                        writer.WriteFullEndElement(); // "Value"
                        writer.WriteStartElement("Description");
                        writer.WriteString(dicsreteInput.Description);
                        writer.WriteFullEndElement(); // "Description"
                        writer.WriteFullEndElement(); // "DiscreteInput"

                    }
                    writer.WriteFullEndElement(); // "DiscretesInputs"

                    // Сохраняем файлы устройства
//.........这里部分代码省略.........
开发者ID:serialbus,项目名称:NGK,代码行数:101,代码来源:NetworkController.cs


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