1 //------------------------------------------------------------------------------
2 // <copyright file="XmlDomTextWriter.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">[....]</owner>
6 //------------------------------------------------------------------------------
13 using System.Runtime.Versioning;
15 // Represents a writer that will make it possible to work with prefixes even
16 // if the namespace is not specified.
17 // This is not possible with XmlTextWriter. But this class inherits XmlTextWriter.
18 internal class XmlDOMTextWriter : XmlTextWriter {
20 public XmlDOMTextWriter( Stream w, Encoding encoding ) : base( w,encoding ) {
23 [ResourceConsumption(ResourceScope.Machine)]
24 [ResourceExposure(ResourceScope.Machine)]
25 public XmlDOMTextWriter( String filename, Encoding encoding ) : base( filename,encoding ){
28 public XmlDOMTextWriter( TextWriter w ) : base( w ){
31 // Overrides the baseclass implementation so that emptystring prefixes do
32 // do not fail if namespace is not specified.
33 public override void WriteStartElement( string prefix, string localName, string ns ){
34 if( ( ns.Length == 0 ) && ( prefix.Length != 0 ) )
37 base.WriteStartElement( prefix, localName, ns );
40 // Overrides the baseclass implementation so that emptystring prefixes do
41 // do not fail if namespace is not specified.
42 public override void WriteStartAttribute( string prefix, string localName, string ns ){
43 if( ( ns.Length == 0 ) && ( prefix.Length != 0 ) )
46 base.WriteStartAttribute( prefix, localName, ns );