Hi Sharon,
Thanks for your response.
So based on your further description, my understanding on your problem is
that:
You have create a DataSet instance and populate its schema structure
through a schema. And now you may have some other strings(more than one),
and each string may contain data of of some certain Tables in the DataSet's
structure. You'd like to write a function which can help return DataRow of
Table from those strings and add into the Dataset, yes?
If so, I think we can consider the following means;
If the xml data in the string is exactly conform to the schema, we can
create another instance of the DataSet (which has populated its structure
with the same schema). After that, you can use this DataSet instance to
import Table data from those xml strings. We can use the
System.IO.StringReader to construct a reader from string, and use
DataSet.ReadXml
to populate data from that string. After that , you can try using
DataSet.Merge to merge data between this helper dataset and your original
dataset. Or you can also manually navigate into certain DataTable and use
DataTable.ImportRow to copy Row between datatable. Currently this is the
most considerable means I've found.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: How to populate a DataSet schema with data from and XML
string
| thread-index: AcWuwR64K2xiQkONSf2Ev+JwhaOfSw==
| X-WBNR-Posting-Host: 199.203.93.141
| From: =?Utf-8?B?U2hhcm9u?= <Sh*****@newsgroups.nospam>
| References: <75**********************************@microsoft.co m>
<E2**********************************@microsoft.co m>
| Subject: RE: How to populate a DataSet schema with data from and XML
string
| Date: Wed, 31 Aug 2005 23:48:11 -0700
| Lines: 34
| Message-ID: <8B**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.languages.csharp:119645
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi Steven,
|
| The ReadXml is not in my case.
| Allow me to clarify the problem.
|
| I have a DataSet loaded with an xml schema. So now the dataset contains
some
| tables and relations.
| I need to supply a function that receives an xml string containing one or
| more entries in some table like:
| <Defect>
| <ID>0</ID>
| <Type>hole</Type>
| <Sevirity>1</Sevirity>
| <XCoordinate>20</XCoordinate>
| <YCoordinate>300</YCoordinate>
| <Deleted>false</Deleted>
| <DefectUI>
| <Shape>Circle</Shape>
| <RedColor>0</RedColor>
| <GreenColor>100</GreenColor>
| <BlueColor>255</BlueColor>
| </DefectUI>
| </Defect>
|
| The Defect table may contain more sub tables and the also the Defect
table
| may be a sub table of another table.
|
| Is there a straight forward way to fill the dataset with the values given
by
| the string xml like the shown above?
|
|
| --------
| Thanks
| Sharon
|