public virtual void Save(string filename) { if (this.DocumentElement == null) { throw new XmlException("Xml_InvalidXmlDocument", Res.GetString("Xdom_NoRootEle")); } XmlDOMTextWriter w = new XmlDOMTextWriter(filename, this.TextEncoding); try { if (!this.preserveWhitespace) { w.Formatting = Formatting.Indented; } this.WriteTo(w); w.Flush(); } finally { w.Close(); } }
public virtual void Save( string filename ) { if ( DocumentElement == null ) throw new XmlException( Res.Xml_InvalidXmlDocument, Res.GetString( Res.Xdom_NoRootEle ) ); XmlDOMTextWriter xw = new XmlDOMTextWriter( filename, TextEncoding ); try { if ( preserveWhitespace == false ) xw.Formatting = Formatting.Indented; WriteTo( xw ); xw.Flush(); } finally { xw.Close(); } }
private String WriteAttributeContent( String prefix, String localName, String ns, String value, bool bMarkup ) { StringWriter sw = new StringWriter(); XmlDOMTextWriter xw = new XmlDOMTextWriter( sw ); if ( bMarkup ) xw.WriteStartAttribute( prefix, localName, ns ); xw.WriteString( value ); if ( bMarkup ) xw.WriteEndAttribute(); xw.Close(); return sw.ToString(); }