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


C# System.Xml.XmlTextWriter.WriteEndElement方法代码示例

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


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

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int callstack_uid;

            if (int.TryParse(Request.QueryString["callstack_uid"], out callstack_uid) == false)
                callstack_uid = 1;

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Callstack");

                DB.LoadCallstack(callstack_uid,
                    delegate(int depth, string funcname, string fileline)
                    {
                        writer.WriteStartElement("Singlestep");
                        writer.WriteAttributeString("depth", depth.ToString());
                        this.WriteCData(writer, "Funcname", funcname);
                        this.WriteCData(writer, "Fileline", fileline);
                        writer.WriteEndElement();
                    }
                );

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:33,代码来源:CallstackView.aspx.cs

示例2: IsolatedStorage_Read_and_Write_Sample

        public static void IsolatedStorage_Read_and_Write_Sample()
        {
            string fileName = @"SelfWindow.xml";

            IsolatedStorageFile storFile = IsolatedStorageFile.GetUserStoreForDomain();
            IsolatedStorageFileStream storStream = new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write);
            System.Xml.XmlWriter writer = new System.Xml.XmlTextWriter(storStream, Encoding.UTF8);
            writer.WriteStartDocument();

            writer.WriteStartElement("Settings");

            writer.WriteStartElement("UserID");
            writer.WriteValue(42);
            writer.WriteEndElement();
            writer.WriteStartElement("UserName");
            writer.WriteValue("kingwl");
            writer.WriteEndElement();

            writer.WriteEndElement();

            writer.Flush();
            writer.Close();
            storStream.Close();

            string[] userFiles = storFile.GetFileNames();

            foreach(var userFile in userFiles)
            {
                if(userFile == fileName)
                {
                    var storFileStreamnew =  new IsolatedStorageFileStream(fileName,FileMode.Open,FileAccess.Read);
                    StreamReader storReader = new StreamReader(storFileStreamnew);
                    System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(storReader);

                    int UserID = 0;
                    string UserName = null;

                    while(reader.Read())
                    {
                        switch(reader.Name)
                        {
                            case "UserID":
                                UserID = int.Parse(reader.ReadString());
                                break;
                            case "UserName":
                                UserName = reader.ReadString();
                                break;
                            default:
                                break;
                        }
                    }

                    Console.WriteLine("{0} {1}", UserID, UserName);

                    storFileStreamnew.Close();
                }
            }
            storFile.Close();
        }
开发者ID:xxy1991,项目名称:cozy,代码行数:59,代码来源:D8IsolatedStorageReadAndWrite.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int project_uid;

            if (int.TryParse(Request.QueryString["project"], out project_uid) == false)
                project_uid = 1;

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();

                writer.WriteStartElement("Report");
                writer.WriteAttributeString("project", project_uid.ToString());

                writer.WriteStartElement("Items");

                DB.LoadReportDeleted(project_uid,
                    delegate(int report_uid, string login_id, string ipaddr, DateTime reported_time, string relative_time, int callstack_uid, string funcname, string version, string filename, string assigned, string uservoice, int num_comments)
                    {
                        writer.WriteStartElement("Item");

                        writer.WriteAttributeString("report_uid", report_uid.ToString());
                        writer.WriteAttributeString("login_id", login_id);
                        writer.WriteAttributeString("ipaddr", ipaddr);
                        writer.WriteAttributeString("reported_time", reported_time.ToString());
                        writer.WriteAttributeString("relative_time", relative_time);
                        writer.WriteAttributeString("callstack_uid", callstack_uid.ToString());
                        writer.WriteAttributeString("assigned", assigned);
                        writer.WriteAttributeString("num_comments", num_comments.ToString());
                        this.WriteCData(writer, "Funcname", funcname);
                        this.WriteCData(writer, "Version", version);
                        this.WriteCData(writer, "Filename", filename);
                        this.WriteCData(writer, "Uservoice", uservoice);

                        writer.WriteEndElement();
                    }
                );
                writer.WriteEndElement(); // Items
                writer.WriteEndElement(); // Report
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:48,代码来源:ReportDeleted.aspx.cs

示例4: CriarArquivoXML

        /// <summary>
        /// Método para criação do Arquivo XML com Configurações do usuário.
        /// </summary>
        public static void CriarArquivoXML()
        {
            try
            {
                System.Xml.XmlTextWriter xtrPrefs = new System.Xml.XmlTextWriter(Directories.UserPrefsDirectory + 
                    @"\UserPrefs.config", System.Text.Encoding.UTF8);

                // Inicia o documento XML.
                xtrPrefs.WriteStartDocument();

                // Escreve elemento raiz.
                xtrPrefs.WriteStartElement("Directories");
                // Escreve sub-Elementos.
                xtrPrefs.WriteElementString("Starbound", Directories.StarboundDirectory);
                xtrPrefs.WriteElementString("Mods", Directories.ModsDirectory);
                // Encerra o elemento raiz.
                xtrPrefs.WriteEndElement();
                // Escreve o XML para o arquivo e fecha o objeto escritor.
                xtrPrefs.Close();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);

            }
        }
开发者ID:MiCLeal,项目名称:Mod-Editor--Starbound,代码行数:29,代码来源:XmlPrefs.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int report_uid;
            int new_state;

            if (int.TryParse(Request.QueryString["report_uid"], out report_uid) == false)
            {
                return;
            }

            if (int.TryParse(Request.QueryString["state"], out new_state) == false)
                new_state = 1;

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Outputs");

                DB.UpdateReportState(report_uid, new_state);

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:30,代码来源:UpdateReportState.aspx.cs

示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();

                writer.WriteStartElement("Project");
                writer.WriteStartElement("Items");

                Dictionary<int, sProject> projectList;
                DB.LoadProject(out projectList);

                foreach (KeyValuePair<int, sProject> item in projectList)
                {
                    writer.WriteStartElement("Item");
                    writer.WriteAttributeString("uid", item.Key.ToString());
                    writer.WriteAttributeString("name", item.Value.name);
                    writer.WriteEndElement();
                }

                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:29,代码来源:ProjectList.aspx.cs

示例7: SaveQuotes

        /// <summary>
        /// Saves movie quotes to an xml file 
        /// </summary>
        /// <param name="movie">IIMDbMovie object</param>
        /// <param name="xmlPath">path to save xml file to</param>
        /// <param name="overwrite">set to true to overwrite existing xml file</param>
        public static void SaveQuotes(
            IIMDbMovie movie, 
            string xmlPath, 
            bool overwrite)
        {
            System.Xml.XmlTextWriter xmlWr;

            try
            {
                if (File.Exists(xmlPath) == false
                    || overwrite)
                    if (movie.Quotes.Count > 0)
                    {
                        xmlWr = new System.Xml.XmlTextWriter(xmlPath, Encoding.Default)
                                    {Formatting = System.Xml.Formatting.Indented};

                        xmlWr.WriteStartDocument();
                        xmlWr.WriteStartElement("Quotes");
                        foreach (IList<IIMDbQuote> quoteBlock in movie.Quotes)
                        {
                            xmlWr.WriteStartElement("QuoteBlock");
                            foreach (IIMDbQuote quote in quoteBlock)
                            {
                                xmlWr.WriteStartElement("Quote");
                                xmlWr.WriteElementString("Character", quote.Character);
                                xmlWr.WriteElementString("QuoteText", quote.Text);
                                xmlWr.WriteEndElement();
                            }
                            xmlWr.WriteEndElement();
                        }
                        xmlWr.WriteEndElement();
                        xmlWr.WriteEndDocument();
                        xmlWr.Flush();
                        xmlWr.Close();
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:47,代码来源:ExtraFilmDetailsFileIO.cs

示例8: WriteConfig

 // Lecture de la configuration
 public static void WriteConfig()
 {
     string config_file = "config.xml";
     var newconf = new System.Xml.XmlTextWriter(config_file, null);
     newconf.WriteStartDocument();
     newconf.WriteStartElement("config");
     newconf.WriteElementString("last_update", LastUpdate.ToShortDateString());
     newconf.WriteElementString("auth_token", AuthToken);
     newconf.WriteEndElement();
     newconf.WriteEndDocument();
     newconf.Close();
 }
开发者ID:remyoudompheng,项目名称:flickrstats,代码行数:13,代码来源:Program.cs

示例9: SaveToFile

		protected virtual void SaveToFile(DataSet pDataSet)
		{
			if (m_FileName == null)
				throw new ApplicationException("FileName is null");
			
			byte[] completeByteArray;
			using (System.IO.MemoryStream fileMemStream = new System.IO.MemoryStream())
			{
				System.Xml.XmlTextWriter xmlWriter = new System.Xml.XmlTextWriter(fileMemStream, System.Text.Encoding.UTF8);

				xmlWriter.WriteStartDocument();
				xmlWriter.WriteStartElement("filedataset", c_DataNamespace);

				xmlWriter.WriteStartElement("header", c_DataNamespace);
				//File Version
				xmlWriter.WriteAttributeString(c_FileVersion, c_FileVersionNumber.ToString());
				//Data Version
				xmlWriter.WriteAttributeString(c_DataVersion, GetDataVersion().ToString());
				//Data Format
				xmlWriter.WriteAttributeString(c_DataFormat, ((int)mSaveDataFormat).ToString());
				xmlWriter.WriteEndElement();

				xmlWriter.WriteStartElement("data", c_DataNamespace);

				byte[] xmlByteArray;
				using (System.IO.MemoryStream xmlMemStream = new System.IO.MemoryStream())
				{
					StreamDataSet.Write(xmlMemStream, pDataSet, mSaveDataFormat);
					//pDataSet.WriteXml(xmlMemStream);

					xmlByteArray = xmlMemStream.ToArray();
					xmlMemStream.Close();
				}

				xmlWriter.WriteBase64(xmlByteArray, 0, xmlByteArray.Length);
				xmlWriter.WriteEndElement();

				xmlWriter.WriteEndElement();
				xmlWriter.WriteEndDocument();

				xmlWriter.Flush();
				
				completeByteArray = fileMemStream.ToArray();
				fileMemStream.Close();
			}

			//se tutto è andato a buon fine scrivo effettivamente il file
			using (System.IO.FileStream fileStream = new System.IO.FileStream(m_FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write))
			{
				fileStream.Write(completeByteArray, 0, completeByteArray.Length);
				fileStream.Close();
			}
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:53,代码来源:FileDataSet.cs

示例10: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int callstack_uid;

            if (int.TryParse(Request.QueryString["callstack_uid"], out callstack_uid) == false)
                callstack_uid = 1;

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Comment");

                writer.WriteAttributeString("callstack_uid", callstack_uid.ToString());

                DB.ForEachCallstackComment CommentWriter = delegate(string author, string comment, DateTime created)
                {
                    writer.WriteStartElement("Item");

                    writer.WriteAttributeString("author", author);
                    writer.WriteAttributeString("created", created.ToString());

                    writer.WriteCData(comment);

                    writer.WriteEndElement();
                };

                DB.LoadCallstackComment(callstack_uid, CommentWriter);

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:38,代码来源:CallstackComment.aspx.cs

示例11: ReadConfig

        // Lecture de la configuration
        static void ReadConfig()
        {
            string config_file = "config.xml";
            if (!System.IO.File.Exists(config_file))
            {
                var newconf = new System.Xml.XmlTextWriter(config_file, null);
                newconf.WriteStartDocument();
                newconf.WriteStartElement("config");
                newconf.WriteElementString("last_update", "0");
                newconf.WriteElementString("auth_token", "");
                newconf.WriteEndElement();
                newconf.WriteEndDocument();
                newconf.Close();
            }

            var conf = new System.Xml.XmlTextReader(config_file);
            string CurrentElement = "";
            while (conf.Read())
            {
                switch(conf.NodeType) {
                    case System.Xml.XmlNodeType.Element:
                        CurrentElement = conf.Name;
                        break;
                    case System.Xml.XmlNodeType.Text:
                    if (CurrentElement == "last_update")
                        LastUpdate = DateTime.Parse(conf.Value);
                    if (CurrentElement == "auth_token")
                        AuthToken = conf.Value;
                        break;
                }
            }
            conf.Close();

            // On vérifie que le token est encore valide
            if (AuthToken.Length > 0)
            {
                var flickr = new Flickr(Program.ApiKey, Program.SharedSecret);
                try
                {
                    Auth auth = flickr.AuthCheckToken(AuthToken);
                    Username = auth.User.UserName;
                }
                catch (FlickrApiException ex)
                {
                    //MessageBox.Show(ex.Message, "Authentification requise",
                    //    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    AuthToken = "";
                }
            }
        }
开发者ID:remyoudompheng,项目名称:flickrstats,代码行数:51,代码来源:Program.cs

示例12: saveButton_Click

        private void saveButton_Click(object sender, EventArgs e)
        {
            string settingsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DichMusicHelperPathSettings.xml";

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(settingsFile, System.Text.Encoding.Unicode))
            {
                writer.WriteStartElement("PathSettings");
                writer.WriteAttributeString("Path", pathTextBox.Text);
                writer.WriteAttributeString("CreateFolder", createFolderBox.Checked.ToString());
                writer.WriteEndElement();
                writer.Close();
            }

            this.Close();
        }
开发者ID:kishtatik,项目名称:MusicFromVKWalls,代码行数:15,代码来源:PathSettingForm.cs

示例13: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            string settingsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DichMusicHelperProxySettings.xml";

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(settingsFile, System.Text.Encoding.Unicode))
            {
                writer.WriteStartElement("ProxySettings");
                writer.WriteAttributeString("Server", serverBox.Text);
                writer.WriteAttributeString("Port", portBox.Text);
                writer.WriteAttributeString("Login", loginBox.Text);
                writer.WriteAttributeString("Password", passwordBox.Text);
                writer.WriteAttributeString("UseProxy", useProxyBox.Checked.ToString());
                writer.WriteEndElement();
                writer.Close();
            }

            this.Close();
        }
开发者ID:kishtatik,项目名称:MusicFromVKWalls,代码行数:18,代码来源:ProxyForm.cs

示例14: GenerateTOC

        /// <summary>
        /// Automatically create the table of contents for the specified document.
        /// Insert an ID in the document if the heading doesn't have it.
        /// Returns the XHTML for the TOC
        /// </summary>
        public static string GenerateTOC(System.Xml.XmlDocument doc)
        {
            System.Xml.XmlNodeList headings = doc.SelectNodes("//*");

              Heading root = new Heading("ROOT", null, 0);
              int index = 0;
              GenerateHeadings(headings, root, ref index);

              using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
              {
            System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8);
            writer.WriteStartElement("div");
            root.WriteChildrenToXml(writer);
            writer.WriteEndElement();
            writer.Flush();

            stream.Seek(0, System.IO.SeekOrigin.Begin);
            System.IO.StreamReader reader = new System.IO.StreamReader(stream, System.Text.Encoding.UTF8);

            return reader.ReadToEnd();
              }
        }
开发者ID:Learion,项目名称:BruceToolSet,代码行数:27,代码来源:HTMLHeadingParser.cs

示例15: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "text/xml";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int project_uid;
            int report_uid;
            string version;

            if (int.TryParse(Request.QueryString["project"], out project_uid) == false)
                project_uid = 1;

            if (int.TryParse(Request.QueryString["report_uid"], out report_uid) == false)
            {
                return;
            }

            version = Request.QueryString["version"];
            if (version != null)
            {
                version.Trim();
                if (version.Length == 0)
                    version = null;
            }

            using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
            {
                writer.WriteStartDocument();
                writer.WriteStartElement("Outputs");

                DB.ReserveReparse(project_uid, report_uid, version);

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();
            }
        }
开发者ID:NtreevSoft,项目名称:Crashweb,代码行数:39,代码来源:ReportReserveReparse.aspx.cs


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