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:
authorAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>2002-07-06 17:01:54 +0400
committerAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>2002-07-06 17:01:54 +0400
commitdf14556dc19030ff96f3caef7e333f5acecf556d (patch)
tree3518c034f47293eaf230bd8b914800c48e99a5a7 /mcs/class/System.XML/System.Xml
parent813918c45f1fbceb4b4a5dfcfe07eea0da65f4db (diff)
2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
* XmlTextWriter: In WriteStartElement, if namespace is null and prefix is null|empty do not write out xmlns="" * XmlWriter: WriteStartElement calls the virtual method with null argument instead of empty string. svn path=/trunk/mcs/; revision=5617
Diffstat (limited to 'mcs/class/System.XML/System.Xml')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog8
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriter.cs41
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWriter.cs4
3 files changed, 31 insertions, 22 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 51b7e658681..507e63582c6 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,11 @@
+2002-07-06 Ajay kumar Dwivedi <adwiv@yahoo.com>
+
+ * XmlTextWriter: In WriteStartElement, if namespace is null and
+ prefix is null|empty do not write out xmlns=""
+
+ * XmlWriter: WriteStartElement calls the virtual method with null
+ argument instead of empty string.
+
2002-07-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* XmlTextReader.cs: implemented .ctor (Stream).
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
index a598695b306..6d8460a5658 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
@@ -518,9 +518,6 @@ namespace System.Xml
if (prefix == null)
prefix = String.Empty;
- if (ns == null)
- ns = String.Empty;
-
if ((prefix != String.Empty) && ((ns == null) || (ns == String.Empty)))
throw new ArgumentException ("Cannot use a prefix with an empty namespace.");
@@ -530,26 +527,28 @@ namespace System.Xml
string formatXmlns = "";
string formatPrefix = "";
- if (ns != String.Empty)
+ if(ns != null)
{
- string existingPrefix = namespaceManager.LookupPrefix (ns);
+ if (ns != String.Empty)
+ {
+ string existingPrefix = namespaceManager.LookupPrefix (ns);
- if (prefix == String.Empty)
- prefix = existingPrefix;
+ if (prefix == String.Empty)
+ prefix = existingPrefix;
- if (prefix != existingPrefix)
- formatXmlns = String.Format (" xmlns:{0}={1}{2}{1}", prefix, quoteChar, ns);
- else if (existingPrefix == String.Empty)
- formatXmlns = String.Format (" xmlns={0}{1}{0}", quoteChar, ns);
- }
- else if ((prefix == String.Empty) && (namespaceManager.LookupNamespace(prefix) != String.Empty)) {
- formatXmlns = String.Format (" xmlns={0}{0}", quoteChar);
- }
+ if (prefix != existingPrefix)
+ formatXmlns = String.Format (" xmlns:{0}={1}{2}{1}", prefix, quoteChar, ns);
+ else if (existingPrefix == String.Empty)
+ formatXmlns = String.Format (" xmlns={0}{1}{0}", quoteChar, ns);
+ }
+ else if ((prefix == String.Empty) && (namespaceManager.LookupNamespace(prefix) != String.Empty)) {
+ formatXmlns = String.Format (" xmlns={0}{0}", quoteChar);
+ }
- if (prefix != String.Empty) {
- formatPrefix = prefix + ":";
+ if (prefix != String.Empty) {
+ formatPrefix = prefix + ":";
+ }
}
-
w.Write ("{0}<{1}{2}{3}", indentFormatting, formatPrefix, localName, formatXmlns);
openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName));
@@ -557,8 +556,10 @@ namespace System.Xml
openStartElement = true;
namespaceManager.PushScope ();
- namespaceManager.AddNamespace (prefix, ns);
-
+ if(ns != null)
+ {
+ namespaceManager.AddNamespace (prefix, ns);
+ }
indentLevel++;
}
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
index f1c0b96737c..c383cca6501 100644
--- a/mcs/class/System.XML/System.Xml/XmlWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs
@@ -147,12 +147,12 @@ namespace System.Xml
public void WriteStartElement (string localName)
{
- WriteStartElementInternal ("", localName, "");
+ WriteStartElementInternal (null, localName, null);
}
public void WriteStartElement (string localName, string ns)
{
- WriteStartElement ("", localName, ns);
+ WriteStartElement (null, localName, ns);
}
public abstract void WriteStartElement (string prefix, string localName, string ns);