Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2002-09-23 04:39:30 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2002-09-23 04:39:30 +0400
commit59d02c87d9acad75aa3dd0bbc81a58641ed09a4c (patch)
treefde99e8f9a3403fe54a66a02f6ab6804b40282b4 /mcs/class/System.XML
parent593854090bcf07d7b13bb2ce64a9eb266d5028bd (diff)
2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* XmlConvert.cs: IsInvalid is now internal. * XmlNamespaceManager.cs: implemented RemoveNamespace * XmlTextReader.cs: return BaseURI and Encoding from the parser. * XmlTextWriter.cs: implemented WriteName and WriteNmToken. svn path=/trunk/mcs/; revision=7725
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog7
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlConvert.cs2
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs29
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextReader.cs6
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriter.cs17
5 files changed, 47 insertions, 14 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 12d7685c601..1fcc5926704 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,10 @@
+2002-09-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * XmlConvert.cs: IsInvalid is now internal.
+ * XmlNamespaceManager.cs: implemented RemoveNamespace
+ * XmlTextReader.cs: return BaseURI and Encoding from the parser.
+ * XmlTextWriter.cs: implemented WriteName and WriteNmToken.
+
2002-09-19 Matt Hunter <mahunter@tconl.com>
* XmlElement.cs: Implementing SetAttributeNode(localName,namespaceURI)
diff --git a/mcs/class/System.XML/System.Xml/XmlConvert.cs b/mcs/class/System.XML/System.Xml/XmlConvert.cs
index cc078e21fdc..fa35d16acab 100755
--- a/mcs/class/System.XML/System.Xml/XmlConvert.cs
+++ b/mcs/class/System.XML/System.Xml/XmlConvert.cs
@@ -61,7 +61,7 @@ namespace System.Xml {
return encoded.Replace (":", encodedColon);
}
- private static bool IsInvalid (char c, bool firstOnlyLetter)
+ internal static bool IsInvalid (char c, bool firstOnlyLetter)
{
if (c == ':') // Special case. allowed in EncodeName, but encoded in EncodeLocalName
return false;
diff --git a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
index 745a1f5cca4..9e5a0a87330 100644
--- a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
@@ -60,7 +60,7 @@ namespace System.Xml
throw new ArgumentNullException ("uri", "Value cannot be null.");
if (prefix.Length > 2 && prefix.Substring (0, 3).ToLower () == "xml")
- throw new ArgumentException ("Prefixes beginning with \"xml\" (regardless of whether the characters are uppercase, lowercase, or some combination thereof) are reserved for use by XML.", "prefix");
+ throw new ArgumentException ( "Prefixes beginning with \"xml\" (regardless " + "of whether the characters are uppercase, lowercase, or some combination thereof) are reserved for use by XML.", "prefix");
if (currentScope.Namespaces == null)
currentScope.Namespaces = new Hashtable ();
@@ -71,10 +71,12 @@ namespace System.Xml
currentScope.Namespaces.Add (nameTable.Add (prefix), nameTable.Add (uri));
}
- [MonoTODO]
public virtual IEnumerator GetEnumerator ()
{
- throw new NotImplementedException ();
+ if (currentScope.Namespaces == null)
+ currentScope.Namespaces = new Hashtable ();
+
+ return currentScope.Namespaces.Keys.GetEnumerator ();
}
public virtual bool HasNamespace (string prefix)
@@ -141,10 +143,27 @@ namespace System.Xml
currentScope = newScope;
}
- [MonoTODO]
public virtual void RemoveNamespace (string prefix, string uri)
{
- throw new NotImplementedException ();
+ if (prefix == null)
+ throw new ArgumentNullException ("prefix");
+
+ if (uri == null)
+ throw new ArgumentNullException ("uri");
+
+ if (currentScope == null || currentScope.Namespaces == null)
+ return;
+
+ string p = nameTable.Get (prefix);
+ string u = nameTable.Get (uri);
+ if (p == null || u == null)
+ return;
+
+ string storedUri = currentScope.Namespaces [p] as string;
+ if (storedUri == null || storedUri != u)
+ return;
+
+ currentScope.Namespaces.Remove (p);
}
#endregion
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
index db56e9df26f..9e305cc50d1 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -147,10 +147,9 @@ namespace System.Xml
get { return attributes.Count; }
}
- [MonoTODO]
public override string BaseURI
{
- get { throw new NotImplementedException (); }
+ get { return parserContext.BaseURI; }
}
public override int Depth
@@ -158,10 +157,9 @@ namespace System.Xml
get { return depth > 0 ? depth : 0; }
}
- [MonoTODO]
public Encoding Encoding
{
- get { throw new NotImplementedException (); }
+ get { return parserContext.Encoding; }
}
public override bool EOF
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
index 179f1511f18..b1f3c4df9ce 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
@@ -392,16 +392,25 @@ namespace System.Xml
WriteEndElementInternal (true);
}
- [MonoTODO]
+ private void CheckValidChars (string name, bool firstOnlyLetter)
+ {
+ foreach (char c in name) {
+ if (XmlConvert.IsInvalid (c, firstOnlyLetter))
+ throw new ArgumentException ("There is an invalid character: '" + c +
+ "'", "name");
+ }
+ }
+
public override void WriteName (string name)
{
- throw new NotImplementedException ();
+ CheckValidChars (name, true);
+ w.Write (name);
}
- [MonoTODO]
public override void WriteNmToken (string name)
{
- throw new NotImplementedException ();
+ CheckValidChars (name, false);
+ w.Write (name);
}
public override void WriteProcessingInstruction (string name, string text)