blob: 228d6ff1f9b666fb331c28d8d866c4780a5d93b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
//------------------------------------------------------------------------------
// <copyright file="XmlDomTextWriter.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">[....]</owner>
//------------------------------------------------------------------------------
namespace System.Xml {
using System;
using System.IO;
using System.Text;
using System.Runtime.Versioning;
// Represents a writer that will make it possible to work with prefixes even
// if the namespace is not specified.
// This is not possible with XmlTextWriter. But this class inherits XmlTextWriter.
internal class XmlDOMTextWriter : XmlTextWriter {
public XmlDOMTextWriter( Stream w, Encoding encoding ) : base( w,encoding ) {
}
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
public XmlDOMTextWriter( String filename, Encoding encoding ) : base( filename,encoding ){
}
public XmlDOMTextWriter( TextWriter w ) : base( w ){
}
// Overrides the baseclass implementation so that emptystring prefixes do
// do not fail if namespace is not specified.
public override void WriteStartElement( string prefix, string localName, string ns ){
if( ( ns.Length == 0 ) && ( prefix.Length != 0 ) )
prefix = "" ;
base.WriteStartElement( prefix, localName, ns );
}
// Overrides the baseclass implementation so that emptystring prefixes do
// do not fail if namespace is not specified.
public override void WriteStartAttribute( string prefix, string localName, string ns ){
if( ( ns.Length == 0 ) && ( prefix.Length != 0 ) )
prefix = "" ;
base.WriteStartAttribute( prefix, localName, ns );
}
}
}
|