diff options
author | Ajay kumar Dwivedi <ajay@mono-cvs.ximian.com> | 2002-07-06 18:08:09 +0400 |
---|---|---|
committer | Ajay kumar Dwivedi <ajay@mono-cvs.ximian.com> | 2002-07-06 18:08:09 +0400 |
commit | f0372f89b019bf494892599a8fad7ad17c0d2178 (patch) | |
tree | 54925a8728aabb275162b04e746793cad1860f09 | |
parent | df14556dc19030ff96f3caef7e333f5acecf556d (diff) |
2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
* XmlTextWriter: Fixed Indentation. IndentationOverridden should
not be set when inside a attribute.
svn path=/trunk/mcs/; revision=5618
-rw-r--r-- | mcs/class/System.XML/System.Xml/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlTextWriter.cs | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 507e63582c6..2e1f47bed1b 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,5 +1,10 @@ 2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com> + * XmlTextWriter: Fixed Indentation. IndentationOverridden should + not be set when inside a attribute. + +2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com> + * XmlTextWriter: In WriteStartElement, if namespace is null and prefix is null|empty do not write out xmlns="" diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index 6d8460a5658..44f456d452e 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -181,7 +181,6 @@ namespace System.Xml if (!openWriter) { throw new InvalidOperationException ("The Writer is closed."); } - if ((documentStarted == true) && (formatting == Formatting.Indented) && (!IndentingOverriden)) { indentFormatting = "\r\n"; if (indentLevel > 0) { @@ -350,13 +349,11 @@ namespace System.Xml throw new InvalidOperationException("There was no XML start tag open."); indentLevel--; - CheckState (); if (openStartElement) { if (openAttribute) WriteEndAttribute (); - if (fullEndElement) w.Write ("></{0}>", ((XmlTextWriterOpenElement)openElements.Peek ()).Name); else @@ -523,7 +520,7 @@ namespace System.Xml CheckState (); CloseStartElement (); - + string formatXmlns = ""; string formatPrefix = ""; @@ -549,6 +546,7 @@ namespace System.Xml formatPrefix = prefix + ":"; } } + w.Write ("{0}<{1}{2}{3}", indentFormatting, formatPrefix, localName, formatXmlns); openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName)); @@ -596,8 +594,10 @@ namespace System.Xml } if (!openAttribute) + { + IndentingOverriden = true; CloseStartElement (); - + } if (!openXmlLang && !openXmlSpace) w.Write (text); else @@ -620,8 +620,6 @@ namespace System.Xml } } } - - IndentingOverriden = true; } [MonoTODO] |