Skip to content

Commit

Permalink
2002-07-26 Tim Coleman <tim@timcoleman.com>
Browse files Browse the repository at this point in the history
        * XmlTextWriter.cs:
                When given a textwriter, check to see if it has a
                null encoding. This was being done for other inputs
                than a textwriter.

svn path=/trunk/mcs/; revision=6199
  • Loading branch information
Tim Coleman committed Jul 26, 2002
1 parent 6728c63 commit 6ae048f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mcs/class/System.XML/System.Xml/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2002-07-26 Tim Coleman <tim@timcoleman.com>
* XmlTextWriter.cs:
When given a textwriter, check to see if it has a
null encoding. This was being done for other inputs
than a textwriter.

Wed Jul 24 13:16:19 CEST 2002 Paolo Molaro <lupus@ximian.com>

Expand Down
4 changes: 3 additions & 1 deletion mcs/class/System.XML/System.Xml/XmlTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class XmlTextWriter : XmlWriter
public XmlTextWriter (TextWriter w) : base ()
{
this.w = w;
nullEncoding = (w.Encoding == null);

try {
baseStream = ((StreamWriter)w).BaseStream;
Expand Down Expand Up @@ -494,7 +495,7 @@ private void WriteStartDocument (string standaloneFormatting)

string encodingFormatting = "";

if (!nullEncoding)
if (!nullEncoding)
encodingFormatting = String.Format (" encoding={0}{1}{0}", quoteChar, w.Encoding.HeaderName);

w.Write("<?xml version={0}1.0{0}{1}{2}?>", quoteChar, encodingFormatting, standaloneFormatting);
Expand Down Expand Up @@ -548,6 +549,7 @@ protected override void WriteStartElementInternal (string prefix, string localNa
}

w.Write ("{0}<{1}{2}{3}", indentFormatting, formatPrefix, localName, formatXmlns);


openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName));
ws = WriteState.Element;
Expand Down

0 comments on commit 6ae048f

Please sign in to comment.