469,909 Members | 1,598 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

reading a schema into a dataset problem.

I am using the ReadXMLSchema method of system.data.dataset to read a schema into a dataset.

I have an XML file that I build up and wish to do a .Update against a database.

The dataset doesn't have a schema and takes the following form:

xml:

<?xml version="1.0" encoding="utf-8"?>
<DataSetEntities xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:guids="urn:schemas-microsoft-com:guids" xmlns="C:/DACXML/EntityAttribute.xsd">
<Entity>
<EntityId>319f8e68-2bf2-444c-b0e7-0baa1c069a12</EntityId>
<Name>Candidate</Name>
<PhysicalName/>
<LogicalName>Candidate</LogicalName>
<IsMappable>true</IsMappable>
<EntityMask>0</EntityMask>
<DataSourceId>a3a1a14e-51d9-44b4-b0da-b5b564b405b1</DataSourceId>
</Entity>
<Attribute>
<AttributeId>7957b56a-59f7-412c-b0dc-7784d70381c1</AttributeId>
<AttributeTypeId>cedd0a61-8699-40e9-96e0-00165659eb3a</AttributeTypeId>
<Name>CandidateID</Name>
<PhysicalName>CandidateID</PhysicalName>
<Length/>
<isNullable>false</isNullable>
<Default>newid()</Default>
<EntityId>319f8e68-2bf2-444c-b0e7-0baa1c069a12</EntityId>
<LogicalName>CandidateID</LogicalName>
<IsPK>true</IsPK>
</Attribute>
<Attribute>
<AttributeId>4a7ee005-64d1-4a3b-9b84-e021344e9874</AttributeId>
<AttributeTypeId>41a5626e-2d8f-45a2-9415-d4ddf3bf7971</AttributeTypeId>
<Name>Surname</Name>
<PhysicalName>Surname</PhysicalName>
<Length/>
<isNullable>false</isNullable>
<Default>test</Default>
<EntityId>319f8e68-2bf2-444c-b0e7-0baa1c069a12</EntityId>
<LogicalName>Surname</LogicalName>
<IsPK>false</IsPK>
</Attribute>
<Attribute>
<AttributeId>aa8d232b-9cb3-458c-8f66-4f3b151b7924</AttributeId>
<AttributeTypeId>7d3bd9b9-7f3e-49e4-b1d5-d6bc7fbf9ce8</AttributeTypeId>
<Name>DOB</Name>
<PhysicalName>DOB</PhysicalName>
<Length/>
<isNullable>true</isNullable>
<Default>GetDate()</Default>
<EntityId>319f8e68-2bf2-444c-b0e7-0baa1c069a12</EntityId>
<LogicalName>DOB</LogicalName>
<IsPK>false</IsPK>
</Attribute>
</DataSetEntities>
schema i load in:

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Entity">
<xs:complexType>
<xs:sequence>
<xs:element name="EntityId" type="xs:string" minOccurs="0" />
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="PhysicalName" type="xs:string" minOccurs="0" />
<xs:element name="LogicalName" type="xs:string" minOccurs="0" />
<xs:element name="IsMappable" type="xs:string" minOccurs="0" />
<xs:element name="EntityMask" type="xs:string" minOccurs="0" />
<xs:element name="DataSourceId" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Attribute">
<xs:complexType>
<xs:sequence>
<xs:element name="AttributeId" type="xs:string" minOccurs="0" />
<xs:element name="AttributeTypeId" type="xs:string" minOccurs="0" />
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="PhysicalName" type="xs:string" minOccurs="0" />
<xs:element name="Length" type="xs:string" minOccurs="0" />
<xs:element name="isNullable" type="xs:string" minOccurs="0" />
<xs:element name="Default" type="xs:string" minOccurs="0" />
<xs:element name="EntityId" type="xs:string" minOccurs="0" />
<xs:element name="LogicalName" type="xs:string" minOccurs="0" />
<xs:element name="IsPK" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

I read the schema in first with a ReadXMLSchema, i then use
ReadXml(sr,XmlReadMode.IgnoreSchema); where sr is the XML file above (dataset)

The dataset never polutes and when i do a .GetXML() i only get <DataSetEntities />
and not the full XML file, is there a problem with the XML.

any ideas?

cheers

chris.


************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 12 '05 #1
0 1242

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul Bromley | last post: by
4 posts views Thread by Amit Maheshwari | last post: by
reply views Thread by c.w.browne | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.