DataSet Xml Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am trying to use the GetXml() function of my DataSet, and its returning
all the rows and their values correctly in Elements format. How can i change
this default behaviour of the GetXml() function to return the embedded nodes
as an Attribute of an entity and not ChildNodes, e.g.

The DataSet's GetXml function returns like this

<File>
<FileName>some.xml</FileName>
<FileType>Xml</FileType>
</File>

I want it to return like this

<File FileName="some.xml" FileType="Xml" />

Please suggest. . .

Thanks!

With Regards
Sunny
 
Got it, thanks for looking, this is the solution... for anyone else interested.

1. If you are creating a new DataSet and its tables then while creating the
columns u can specify for each column's ColumnMapping property and making its
type as MappingType.Attribute. Then it will be emitted as an attribute of
the entity.

2. If the dataset is populated through a DataAdapter, then u can iterate
through the columns of the dataset tables and make their ColumnMappin
property as Attribute.

Thanks!
 
Back
Top