-
Loading XML data into DataSet w/ different schema
Hello,
I'm currently writing the database backend for a game using the classic server/client
model. Right now I'm focusing on the loading and saving of entities (game
objects).
To make creation of new entities easier, there are entity templates. These
entity templates contain all the default values for the entity so that all
the developer needs to create a new entity is its name.
What I'd like to do, is load the XML data into a DataSet with the same schema
as the entity DataSet. That way, creating a new entity from an entity template
would be as easy as copying the correct entity template DataRow into the
entity DataSet. The problem, however, is that the XML data has an entirely
different schema. Is there an easy way to map XML attributes to DataTable
columns or in any other way accomplish this? I don't want to resort to loading
the XML data separately and then copying the values into each DataRow's cell.
-
Re: Loading XML data into DataSet w/ different schema
Without transforming the XML to match the schema with XSLT you'll more than
likely want to look at classes such as DataTableMapping and DataColumnMapping.
They can be used to map data from one structure to another.
HTH,
Dan Wahlin
http://www.XMLforASP.NET
Microsoft MVP - ASP.NET
XML for ASP.NET Developers in bookstores everywhere.
"Michael Koehmstedt" <baynah@yahoo.com> wrote:
>
>Hello,
>I'm currently writing the database backend for a game using the classic
server/client
>model. Right now I'm focusing on the loading and saving of entities (game
>objects).
>
>To make creation of new entities easier, there are entity templates. These
>entity templates contain all the default values for the entity so that all
>the developer needs to create a new entity is its name.
>
>What I'd like to do, is load the XML data into a DataSet with the same schema
>as the entity DataSet. That way, creating a new entity from an entity template
>would be as easy as copying the correct entity template DataRow into the
>entity DataSet. The problem, however, is that the XML data has an entirely
>different schema. Is there an easy way to map XML attributes to DataTable
>columns or in any other way accomplish this? I don't want to resort to loading
>the XML data separately and then copying the values into each DataRow's
cell.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|