Author: atsushi
Date: 2007-09-28 01:27:11 -0400 (Fri, 28 Sep 2007)
New Revision: 86546
Modified:
trunk/mcs/class/System.XML/System.Xml/ChangeLog
trunk/mcs/class/System.XML/System.Xml/XQueryConvert.cs
trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs
trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
Log:
2007-09-28 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriter.cs : it is now documented that WriteNode(XPathNavigator)
ignores attributes and namespace decls, so do that.
* XQueryConvert.cs : removed extra stuff that are not in use.
* XmlWriterTests.cs : added WriteNodeXPathNavigatorAttribute().
Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog 2007-09-28 04:51:31 UTC
(rev 86545)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog 2007-09-28 05:27:11 UTC
(rev 86546)
@@ -1,3 +1,9 @@
+2007-09-28 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlWriter.cs : it is now documented that WriteNode(XPathNavigator)
+ ignores attributes and namespace decls, so do that.
+ * XQueryConvert.cs : removed extra stuff that are not in use.
+
2007-09-27 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriter.cs : implemented WriteValue(object) based on
Modified: trunk/mcs/class/System.XML/System.Xml/XQueryConvert.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XQueryConvert.cs 2007-09-28
04:51:31 UTC (rev 86545)
+++ trunk/mcs/class/System.XML/System.Xml/XQueryConvert.cs 2007-09-28
05:27:11 UTC (rev 86546)
@@ -249,19 +249,6 @@
return Convert.ToInt64 (value);
}
- [MonoTODO] // what if value was negative?
- public static decimal DecimalToNonNegativeInteger (decimal
value)
- {
- // MS has a bug that does not reject negative values.
- throw new NotImplementedException ();
- }
-
- [MonoTODO] // what if value was positive?
- public static decimal DecimalToNonPositiveInteger (decimal
value)
- {
- throw new NotImplementedException ();
- }
-
public static string DecimalToString (decimal value)
{
return XmlConvert.ToString (value);
@@ -292,19 +279,6 @@
return Convert.ToInt64 (value);
}
- [MonoTODO] // what if value was negative?
- public static decimal DoubleToNonNegativeInteger (double value)
- {
- // MS has a bug that does not reject negative values.
- throw new NotImplementedException ();
- }
-
- [MonoTODO] // what if value was positive?
- public static decimal DoubleToNonPositiveInteger (double value)
- {
- throw new NotImplementedException ();
- }
-
public static string DoubleToString (double value)
{
return XmlConvert.ToString (value);
@@ -351,19 +325,6 @@
return Convert.ToInt64 (value);
}
- [MonoTODO] // what if value was negative?
- public static decimal FloatToNonNegativeInteger (float value)
- {
- // MS has a bug that does not reject negative values.
- throw new NotImplementedException ();
- }
-
- [MonoTODO] // what if value was positive?
- public static decimal FloatToNonPositiveInteger (float value)
- {
- throw new NotImplementedException ();
- }
-
public static string FloatToString (float value)
{
return XmlConvert.ToString (value);
Modified: trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs 2007-09-28 04:51:31 UTC
(rev 86545)
+++ trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs 2007-09-28 05:27:11 UTC
(rev 86546)
@@ -393,27 +393,16 @@
}
#if NET_2_0 && !NET_2_1
- [MonoTODO] // FIXME: test defattr handling
public virtual void WriteNode (XPathNavigator navigator, bool
defattr)
{
if (navigator == null)
throw new ArgumentNullException ("navigator");
switch (navigator.NodeType) {
case XPathNodeType.Attribute:
- if (defattr || navigator.SchemaInfo == null ||
- !navigator.SchemaInfo.IsDefault)
- WriteAttributeString (navigator.Prefix,
- navigator.LocalName,
- navigator.NamespaceURI,
- navigator.Value);
+ // no operation
break;
case XPathNodeType.Namespace:
- if (defattr || navigator.SchemaInfo == null ||
- !navigator.SchemaInfo.IsDefault)
- WriteAttributeString (navigator.Prefix,
- navigator.LocalName ==
String.Empty ? "xmlns" : navigator.LocalName,
- "http://www.w3.org/2000/xmlns/",
- navigator.Value);
+ // no operation
break;
case XPathNodeType.Text:
WriteString (navigator.Value);
@@ -442,13 +431,19 @@
WriteStartElement (navigator.Prefix,
navigator.LocalName, navigator.NamespaceURI);
if (navigator.MoveToFirstNamespace
(XPathNamespaceScope.Local)) {
do {
- WriteNode (navigator, defattr);
+ if (defattr ||
navigator.SchemaInfo == null || navigator.SchemaInfo.IsDefault)
+ WriteAttributeString
(navigator.Prefix,
+
navigator.LocalName == String.Empty ? "xmlns" : navigator.LocalName,
+
"http://www.w3.org/2000/xmlns/",
+
navigator.Value);
} while (navigator.MoveToNextNamespace
(XPathNamespaceScope.Local));
navigator.MoveToParent ();
}
if (navigator.MoveToFirstAttribute ()) {
do {
- WriteNode (navigator, defattr);
+ if (defattr ||
navigator.SchemaInfo == null || navigator.SchemaInfo.IsDefault)
+ WriteAttributeString
(navigator.Prefix, navigator.LocalName, navigator.NamespaceURI,
navigator.Value);
+
} while (navigator.MoveToNextAttribute
());
navigator.MoveToParent ();
}
Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2007-09-28
04:51:31 UTC (rev 86545)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2007-09-28
05:27:11 UTC (rev 86546)
@@ -1,3 +1,7 @@
+2007-09-28 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlWriterTests.cs : added WriteNodeXPathNavigatorAttribute().
+
2007-09-27 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriterTests.cs : added test for WriteValue(object).
Modified: trunk/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
2007-09-28 04:51:31 UTC (rev 86545)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
2007-09-28 05:27:11 UTC (rev 86546)
@@ -530,6 +530,25 @@
w.Close ();
AssertType.AreEqual ("<A xmlns=\"urn:x\"><B
xmlns=\"urn:y\" /></A>", sw.ToString ());
}
+
+ [Test]
+ public void WriteNodeXPathNavigatorAttribute ()
+ {
+ string xml = "<!DOCTYPE root [<!ELEMENT root EMPTY>
<!ATTLIST root implicit NMTOKEN 'nam'>]><root attr='val' />";
+ XPathNavigator nav = new XPathDocument (new
StringReader (xml)).CreateNavigator ();
+ XmlWriterSettings s = new XmlWriterSettings ();
+ s.OmitXmlDeclaration = true;
+ StringWriter sw = new StringWriter ();
+ XmlWriter w = XmlWriter.Create (sw, s);
+ w.WriteStartElement ("hoge");
+ nav.MoveToFirstChild ();
+ nav.MoveToFirstAttribute ();
+ w.WriteNode (nav, false);
+ nav.MoveToNextAttribute ();
+ w.WriteNode (nav, false);
+ w.Close ();
+ AssertType.AreEqual ("<hoge />", sw.ToString ());
+ }
#endif
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches