ignore attributes from "http://www.w3.org/XML/1998/namespace".
* XmlConstants.cs: add constant for "http://www.w3.org/XML/1998/namespace".
* XmlDataInferenceLoader.cs: track the added elements index to fix the
added column ordinal.
svn path=/trunk/mcs/; revision=73118
+2007-02-19 Konstantin Triger <kostat@mainsoft.com>
+
+ * XmlDataReader.cs, XmlDataInferenceLoader.cs, XmlDiffLoader.cs:
+ ignore attributes from "http://www.w3.org/XML/1998/namespace".
+ * XmlConstants.cs: add constant for "http://www.w3.org/XML/1998/namespace".
+ * XmlDataInferenceLoader.cs: track the added elements index to fix the
+ added column ordinal.
+
2006-12-11 Chris Toshok <toshok@ximian.com>
* DataView.cs: GetItemProperties should return an empty collection
public const string SchemaNamespace = "http://www.w3.org/2001/XMLSchema";
public const string XmlnsNS = "http://www.w3.org/2000/xmlns/";
+#if NET_2_0
+ public const string XmlNS = "http://www.w3.org/XML/1998/namespace";
+#endif
//xs elements and values
//TODO - these must exist somwhere else???
public DataColumn SimpleContent;\r
public DataColumn PrimaryKey;\r
public DataColumn ReferenceKey;\r
+#if NET_2_0\r
+ public int lastElementIndex = -1;\r
+#endif\r
\r
// Parent TableMapping\r
public TableMapping ParentTable;\r
if (col != null) {\r
if (col.ColumnMapping != MappingType.Element)\r
throw new DataException (String.Format ("Column {0} is already mapped to {1}.", localName, col.ColumnMapping));\r
+#if NET_2_0\r
+ table.lastElementIndex = table.Elements.IndexOf (col);\r
+#endif\r
return;\r
}\r
if (table.ChildTables [localName] != null)\r
col = new DataColumn (localName, typeof (string));\r
col.Namespace = el.NamespaceURI;\r
col.Prefix = el.Prefix;\r
+#if NET_2_0\r
+ table.Elements.Insert (++table.lastElementIndex, col);\r
+#else\r
table.Elements.Add (col);\r
+#endif\r
}\r
\r
private void CheckExtraneousElementColumn (TableMapping parentTable, XmlElement el)\r
bool isElementRepeated = false;\r
\r
foreach (XmlAttribute attr in el.Attributes) {\r
- if (attr.NamespaceURI == XmlConstants.XmlnsNS)\r
+ if (attr.NamespaceURI == XmlConstants.XmlnsNS\r
+#if NET_2_0\r
+ || attr.NamespaceURI == XmlConstants.XmlNS\r
+#endif\r
+ )\r
continue;\r
if (ignoredNamespaces != null &&\r
ignoredNamespaces.Contains (attr.NamespaceURI))\r
}\r
\r
foreach (XmlAttribute attr in el.Attributes) {\r
- if (attr.NamespaceURI == XmlConstants.XmlnsNS)\r
+ if (attr.NamespaceURI == XmlConstants.XmlnsNS \r
+#if NET_2_0\r
+ || attr.NamespaceURI == XmlConstants.XmlNS\r
+#endif\r
+ )\r
continue;\r
if (ignoredNamespaces != null && ignoredNamespaces.Contains (attr.NamespaceURI))\r
continue;\r
ArrayList ignoredNamespaces)\r
{\r
foreach (XmlAttribute attr in top.Attributes) {\r
- if (attr.NamespaceURI == XmlConstants.XmlnsNS)\r
+ if (attr.NamespaceURI == XmlConstants.XmlnsNS\r
+#if NET_2_0\r
+ || attr.NamespaceURI == XmlConstants.XmlNS\r
+#endif\r
+ )\r
continue;\r
if (ignoredNamespaces != null &&\r
ignoredNamespaces.Contains (attr.NamespaceURI))\r
private bool IsPossibleColumnElement (XmlElement el)\r
{\r
foreach (XmlAttribute attr in el.Attributes) {\r
- if (attr.NamespaceURI == XmlConstants.XmlnsNS)\r
+ if (attr.NamespaceURI == XmlConstants.XmlnsNS\r
+#if NET_2_0\r
+ || attr.NamespaceURI == XmlConstants.XmlNS\r
+#endif\r
+ )\r
continue;\r
return false;\r
}\r
// Consume attributes\r
if (reader.MoveToFirstAttribute ()) {\r
do {\r
- if (reader.NamespaceURI == XmlConstants.XmlnsNS)\r
+ if (reader.NamespaceURI == XmlConstants.XmlnsNS\r
+#if NET_2_0\r
+ || reader.NamespaceURI == XmlConstants.XmlNS\r
+#endif\r
+ )\r
continue;\r
ReadElementAttribute (row);\r
} while (reader.MoveToNextAttribute ());\r
do {
switch (reader.NamespaceURI) {
case XmlConstants.XmlnsNS:
+#if NET_2_0
+ case XmlConstants.XmlNS:
+#endif
case XmlConstants.DiffgrNamespace:
case XmlConstants.MsdataNamespace:
case XmlConstants.MspropNamespace:
DataSet ds = GetDataSet (xml11, null);
AssertDataSet ("ds", ds, "NewDataSet", 1, 0);
DataTable dt = ds.Tables [0];
+#if NET_2_0
+ AssertDataTable ("dt", dt, "root", 1, 0, 0, 0, 0, 0);
+#else
AssertDataTable ("dt", dt, "root", 2, 0, 0, 0, 0, 0);
+#endif
AssertDataColumn ("element", dt.Columns [0], "child_after_significant_space", true, false, 0, 1, "child_after_significant_space", MappingType.Element, typeof (string), DBNull.Value, String.Empty, -1, String.Empty, 0, String.Empty, false, false);
+#if NET_2_0
+ Assert.AreEqual (1, dt.Columns.Count, "xml:space is not treated as column");
+#else
AssertDataColumn ("xml:space", dt.Columns [1], "space", true, false, 0, 1, "space", MappingType.Attribute, typeof (string), DBNull.Value, String.Empty, -1, "http://www.w3.org/XML/1998/namespace", 1, "xml", false, false);
+#endif
}
[Test]
}\r
\r
[Test] // bug #80045\r
-#if NET_2_0\r
- [Category ("NotWorking")]\r
-#endif\r
public void ColumnOrder ()\r
{\r
string xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +\r
}\r
\r
[Test] // bug #80048\r
+#if NET_1_1\r
[Category ("NotWorking")]\r
+#endif\r
public void XmlSpace ()\r
{\r
string xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +\r