+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
PushScope ();
currentScope.Namespaces = new Hashtable ();
+ currentScope.Namespaces.Add ("", "");
currentScope.Namespaces.Add ("xml", XmlnsXml);
currentScope.Namespaces.Add ("xmlns", XmlnsXmlns);
}
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)
{
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
w.Write (quoteChar);
w.Write (pubid);
w.Write (quoteChar);
-
+ w.Write (' ');
w.Write (quoteChar);
w.Write (sysid);
w.Write (quoteChar);
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);
}
w.Write ("?>");
}
- [MonoTODO]
public override void WriteQualifiedName (string localName, string ns)
{
if (localName == null || localName == String.Empty)
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