diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-01-12 07:47:39 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-01-12 07:47:39 +0300 |
commit | 1ca0a71ebfd1e2bd654b64c64f47a8141771ab1d (patch) | |
tree | aff807b88efb232d70ab3527c9f7a533a5fe5f96 /mcs/class/System.XML/System.Xml/XmlTextWriter.cs | |
parent | 88feacd9a1d31ad3b3c9af64fc8a9e24318ee528 (diff) |
2006-01-12 Atsushi Enomoto <atsushi@ximian.com>
* XmlTextWriter.cs : Fixed bug #77094. Only XmlTextWriter checks
such invalid "xml" prefix which is being mapped to different
namespace URI than the predefined one.
Removed comment that does not make sense.
* XmlNamespaceManager.cs : IsValidDeclaration() could be private.
Added some comments.
* XmlTextWriterTests.cs : re-enabled bug #77094 related tests.
svn path=/trunk/mcs/; revision=55414
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlTextWriter.cs')
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlTextWriter.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index cc86640a281..0dd0ffc1921 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -752,8 +752,6 @@ openElements [openElementCount - 1]).IndentingOverriden; public override void WriteStartAttribute (string prefix, string localName, string ns) { if (prefix == "xml") { - // MS.NET looks to allow other names than - // lang and space (e.g. xml:link, xml:hack). ns = XmlNamespaceManager.XmlnsXml; if (localName == "lang") openXmlLang = true; @@ -916,6 +914,14 @@ openElements [openElementCount - 1]).IndentingOverriden; if ((prefix != null && prefix.Length > 0) && ((ns == null))) throw ArgumentError ("Cannot use a prefix with an empty namespace."); + // Considering the fact that WriteStartAttribute() + // automatically changes argument namespaceURI, this + // is kind of silly implementation. See bug #77094. + if (Namespaces && + ns != XmlNamespaceManager.XmlnsXml && + String.Compare (prefix, "xml", true) == 0) + throw new ArgumentException ("A prefix cannot be equivalent to \"xml\" in case-insensitive match."); + // ignore non-namespaced node's prefix. if (ns == null || ns == String.Empty) prefix = String.Empty; |