[Mono-bugs] [Bug 66366][Nor] New - DataSet.GetXmlSchema(): <xs:field> xpath attribute missing '@' symbol when DataTable primary key fields have MappingType = Attribute

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 20 Sep 2004 16:50:39 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dclough@prconline.com.

http://bugzilla.ximian.com/show_bug.cgi?id=66366

--- shadow/66366	2004-09-20 16:50:39.000000000 -0400
+++ shadow/66366.tmp.21672	2004-09-20 16:50:39.000000000 -0400
@@ -0,0 +1,93 @@
+Bug#: 66366
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Fedora Core 2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dclough@prconline.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DataSet.GetXmlSchema():  <xs:field> xpath attribute missing '@' symbol when DataTable primary key fields have MappingType = Attribute
+
+Steps to reproduce the problem:
+1.  Create a DataSet with one or more DataTables 
+2.  Add a PrimaryKey column to a DataTable and set the column's 
+MappingType to MappingType.Attribute
+3.  Call the DataSet.GetXmlSchema() method to view the produced schema.
+
+Use this code:
+
+DataSet ds = new DataSet("ExampleDataSet");
+
+ds.Tables.Add(new DataTable("ExampleDataTable"));
+ds.Tables["ExampleDataTable"].Columns.Add(new DataColumn
+("PrimaryKeyColumn", typeof(System.Int32), "", MappingType.Attribute));
+ds.Tables["ExampleDataTable"].Columns["PrimaryKeyColumn"].AllowDBNull = 
+false;
+
+ds.Tables["ExampleDataTable"].Constraints.Add("PK_ExampleDataTable", 
+ds.Tables["ExampleDataTable"].Columns["PrimaryKeyColumn"], true);
+
+ds.AcceptChanges();
+System.Console.WriteLine(ds.GetXmlSchema());
+
+Actual Results:
+
+<?xml version="1.0" standalone="yes"?>
+<xs:schema id="ExampleDataSet" xmlns="" 
+xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
+microsoft-com:xml-msdata">
+  <xs:element name="ExampleDataSet" msdata:IsDataSet="true">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded">
+        <xs:element name="ExampleDataTable">
+          <xs:complexType>
+            <xs:attribute name="PrimaryKeyColumn" type="xs:int" 
+use="required" />
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+    <xs:unique name="PK_ExampleDataTable" msdata:PrimaryKey="true">
+      <xs:selector xpath=".//ExampleDataTable" />
+      <xs:field xpath="PrimaryKeyColumn" />
+    </xs:unique>
+  </xs:element>
+</xs:schema>
+
+
+Expected Results:
+
+<?xml version="1.0" standalone="yes"?>
+<xs:schema id="ExampleDataSet" xmlns="" 
+xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
+microsoft-com:xml-msdata">
+  <xs:element name="ExampleDataSet" msdata:IsDataSet="true">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded">
+        <xs:element name="ExampleDataTable">
+          <xs:complexType>
+            <xs:attribute name="PrimaryKeyColumn" type="xs:int" 
+use="required" />
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+    <xs:unique name="PK_ExampleDataTable" msdata:PrimaryKey="true">
+      <xs:selector xpath=".//ExampleDataTable" />
+      <xs:field xpath="@PrimaryKeyColumn" />
+    </xs:unique>
+  </xs:element>
+</xs:schema>
+
+
+How often does this happen? 
+
+Repeatable on Fedora Core 2 box.