diff options
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlTextWriter.cs')
-rw-r--r-- | mcs/class/System.XML/System.Xml/XmlTextWriter.cs | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index 061d259b364..cc86640a281 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -752,6 +752,8 @@ 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; @@ -797,7 +799,7 @@ openElements [openElementCount - 1]).IndentingOverriden; string formatPrefix = ""; if (ns != String.Empty && prefix != "xmlns") { - string existingPrefix = GetExistingPrefix (ns); + string existingPrefix = namespaceManager.LookupPrefix (ns, false); if (existingPrefix == null || existingPrefix == "") { bool createPrefix = false; @@ -852,15 +854,6 @@ openElements [openElementCount - 1]).IndentingOverriden; } } - string GetExistingPrefix (string ns) - { - if (newAttributeNamespaces.ContainsValue (ns)) - foreach (DictionaryEntry de in newAttributeNamespaces) - if (de.Value as string == ns) - return (string) de.Key; - return namespaceManager.LookupPrefix (ns, false); - } - private string CheckNewPrefix (bool createPrefix, string prefix, string ns) { do { @@ -923,14 +916,6 @@ 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; |