System.Xml.XmlTextWriter.WriteEndDocument C# (CSharp) Method

WriteEndDocument() public method

public WriteEndDocument ( ) : void
return void
        public override void WriteEndDocument() {
            try {
                AutoCompleteAll();
                if (this.currentState != State.Epilog) {
                    throw new ArgumentException(Res.GetString(Res.Xml_NoRoot));
                }
                this.stateTable = stateTableDefault;
                this.currentState = State.Start;
                this.lastToken = Token.Empty;
            }
            catch {
                currentState = State.Error;
                throw;
            }
        }

Usage Example

Example #1
1
        private bool SaveRegister(string RegisterKey)
        {
            try
            {
                
                Encryption enc = new Encryption();
                FileStream fs = new FileStream("reqlkd.dll", FileMode.Create);
                XmlTextWriter w = new XmlTextWriter(fs, Encoding.UTF8);

                // Khởi động tài liệu.
                w.WriteStartDocument();
                w.WriteStartElement("QLCV");

                // Ghi một product.
                w.WriteStartElement("Register");
                w.WriteAttributeString("GuiNumber", enc.EncryptData(sGuiID));
                w.WriteAttributeString("Serialnumber", enc.EncryptData(sSerial));
                w.WriteAttributeString("KeyRegister", enc.EncryptData(RegisterKey, sSerial + sGuiID));
                w.WriteEndElement();

                // Kết thúc tài liệu.
                w.WriteEndElement();
                w.WriteEndDocument();
                w.Flush();
                w.Close();
                fs.Close();
                return true;
            }
            catch (Exception ex)
            {

                return false;
            }
        }
All Usage Examples Of System.Xml.XmlTextWriter::WriteEndDocument