Here is a simple webservice returning a dataset with a table (MyTable1) containing one coloumn (ID) as xml.
I would like to assign some attributes to both 'MyTable1' and 'ID'.
How to do that
See below - sourcecode, existing xml response, desired xml response:
Hope you get the point - or ask me to clarify... Thanks;-)
Sourcecode:
--------------------------
----------
----------
----------
----------
---------
[WebMethod]
public DataSet MyDataSet()
{
DataSet ds = new DataSet("MyDS");
DataTable dt = new DataTable("MyTable1");
dt.Columns.Add("ID");
ds.Tables.Add(dt);
DataRow datarow = ds.Tables["MyTable1"].NewR
ow();
datarow["ID"] = "Test";
ds.Tables["MyTable1"].Rows
.Add(datar
ow);
return ds;
}
--------------------------
----------
----------
----------
----------
Xml response:
--------------------------
----------
----------
----------
----------
-
<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns="
http://tempuri.org/">
<xs:schema id="MyDS" xmlns="" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
microsoft-
com:xml-ms
data">
.........................
.........................
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-
microsoft-
com:xml-ms
data" xmlns:diffgr="urn:schemas-
microsoft-
com:xml-di
ffgram-v1"
>
<MyDS xmlns="">
<MyTable1 diffgr:id="MyTable11" msdata:rowOrder="0" diffgr:hasChanges="inserte
d">
<ID>test</ID>
</MyTable1>
</MyDS>
</diffgr:diffgram>
</DataSet>
--------------------------
----------
----------
----------
----------
--------
Desired xml response:
--------------------------
----------
----------
----------
----------
--------
<?xml version="1.0" encoding="utf-8"?>
<DataSet xmlns="
http://tempuri.org/">
<xs:schema id="MyDS" xmlns="" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
microsoft-
com:xml-ms
data">
.........................
.........................
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-
microsoft-
com:xml-ms
data" xmlns:diffgr="urn:schemas-
microsoft-
com:xml-di
ffgram-v1"
>
<MyDS xmlns="">
<MyTable1 diffgr:id="MyTable11" msdata:rowOrder="0" diffgr:hasChanges="inserte
d" customAttribute="content">
<ID attribute1="Content" attribute2="etc.">test</ID
>
</MyTable1>
</MyDS>
</diffgr:diffgram>
</DataSet>