2003-09-08 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 8 Sep 2003 16:36:38 +0000 (16:36 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 8 Sep 2003 16:36:38 +0000 (16:36 -0000)
* XmlNamespaceManager.cs : GetEnumerator() should return all of the
  available pairs (of prefix and namespace).
* XmlQualifiedName.cs : Quick fix for NullReferenceException in case
  of name (or ns) is null. (The description of the immediate previous
  changes will be inserted below.)
* XmlTextWriter.cs : Fixed WriteDocType(). Removed CheckValidName().
* XmlUrlResolver.cs : Changed not to call WebClient.Dispose() which
  will release resources it had allocated.

svn path=/trunk/mcs/; revision=17996

mcs/class/System.XML/System.Xml/ChangeLog
mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
mcs/class/System.XML/System.Xml/XmlTextWriter.cs
mcs/class/System.XML/System.Xml/XmlUrlResolver.cs

index f8474122767d19f344a8a37837c2af7bd8049530..2efece026e0694db72015326dc43bd6ecafb3d8d 100644 (file)
@@ -1,3 +1,14 @@
+2003-09-08  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+       * XmlNamespaceManager.cs : GetEnumerator() should return all of the
+         available pairs (of prefix and namespace).
+       * XmlQualifiedName.cs : Quick fix for NullReferenceException in case
+         of name (or ns) is null. (The description of the immediate previous 
+         changes will be inserted below.)
+       * XmlTextWriter.cs : Fixed WriteDocType(). Removed CheckValidName().
+       * XmlUrlResolver.cs : Changed not to call WebClient.Dispose() which
+         will release resources it had allocated.
+
 2003-09-01 Ben Maurer  <bmaurer@users.sourceforge.net>
 
        * XmlDocument.cs (Save): use the encoding of the document, if
index 9d034661737cbb9487b59120fd4c0ff51b6e765e..9026a9a5f72226780cb4cd8fed5dabd0a41fbac5 100644 (file)
@@ -37,6 +37,7 @@ namespace System.Xml
 
                        PushScope ();
                        currentScope.Namespaces = new Hashtable ();
+                       currentScope.Namespaces.Add ("", "");
                        currentScope.Namespaces.Add ("xml", XmlnsXml);
                        currentScope.Namespaces.Add ("xmlns", XmlnsXmlns);
                }
@@ -94,10 +95,29 @@ namespace System.Xml
 
                public virtual IEnumerator GetEnumerator ()
                {
+                       /*
                        if (currentScope.Namespaces == null)
                                currentScope.Namespaces = new Hashtable ();
 
                        return currentScope.Namespaces.Keys.GetEnumerator ();
+                       */
+
+                       // In fact it returns such table's enumerator that contains all the namespaces.
+                       // while HasNamespace() ignores pushed namespaces.
+                       Hashtable ht = new Hashtable ();
+                       NamespaceScope scope = currentScope;
+
+                       while (scope != null) {
+                               if (scope.Namespaces != null) {
+                                       IEnumerator e = scope.Namespaces.Keys.GetEnumerator ();
+                                       while (e.MoveNext ()) {
+                                               if (!ht.ContainsKey (e.Current))
+                                                       ht.Add (e.Current, scope.Namespaces [e.Current]);
+                                       }
+                               }
+                               scope = scope.Next;
+                       }
+                       return ht.Keys.GetEnumerator ();
                }
 
                public virtual bool HasNamespace (string prefix)
index e61dd0aebde1f30e6285d374e0280a032c34fcbd..b689ef7476776be76e6beee1284c6ca2c2e539db 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Xml
                {
                        this.name = (name == null) ? "" : name;
                        this.ns = (ns == null) ? "" : ns;
-                       this.hash = name.GetHashCode () ^ ns.GetHashCode ();
+                       this.hash = this.name.GetHashCode () ^ this.ns.GetHashCode ();
                }
 
                // Fields
index 214aac3a919779a0d7da08b5c2fcc3914ac20e83..831f2b64d8c591149f27cfc18c1215886cc15661 100644 (file)
@@ -395,7 +395,7 @@ namespace System.Xml
                                w.Write (quoteChar);
                                w.Write (pubid);
                                w.Write (quoteChar);
-                               
+                               w.Write (' ');
                                w.Write (quoteChar);
                                w.Write (sysid);
                                w.Write (quoteChar);
@@ -508,27 +508,19 @@ namespace System.Xml
                        WriteEndElementInternal (true);
                }
 
-               private void CheckValidName (string name, bool firstOnlyLetter)
+               public override void WriteName (string name)
                {
-                       if (firstOnlyLetter && !XmlConstructs.IsNameStart (name [0]))
+                       if (!XmlChar.IsName (name))
                                throw new ArgumentException ("There is an invalid character: '" + name [0] +
                                                             "'", "name");
-                       foreach (char c in name) {
-                               if (!XmlConstructs.IsName (c))
-                                       throw new ArgumentException ("There is an invalid character: '" + c +
-                                                                    "'", "name");
-                       }
-               }
-
-               public override void WriteName (string name)
-               {
-                       CheckValidName (name, true);
                        w.Write (name);
                }
 
                public override void WriteNmToken (string name)
                {
-                       CheckValidName (name, false);
+                       if (!XmlChar.IsNmToken (name))
+                               throw new ArgumentException ("There is an invalid character: '" + name [0] +
+                                                            "'", "name");
                        w.Write (name);
                }
 
@@ -549,7 +541,6 @@ namespace System.Xml
                        w.Write ("?>");
                }
 
-               [MonoTODO]
                public override void WriteQualifiedName (string localName, string ns)
                {
                        if (localName == null || localName == String.Empty)
index 5311643ffc41d0f183a06981e0e09540031bff42..42569949aa9f3a134f9da15cc9aad6051f0c6dca 100755 (executable)
@@ -53,7 +53,7 @@ namespace System.Xml
                                s = wc.OpenRead (absoluteUri.ToString ());\r
                                if (s.GetType ().IsSubclassOf (ofObjectToReturn))\r
                                        return s;\r
-                               wc.Dispose ();\r
+//                             wc.Dispose ();\r
                        }\r
                        return null;\r
                }\r