I have a stored procedure which returns 2 xml resultsets as below:
SELECT 1 as SiteID
FOR XML PATH('FirstResultSet'), TYPE
SELECT 1 as UserID
FOR XML PATH('SecondResultSet'), TYPE
I have run my stored procedure and got the DataSet object.
I called the GetXml method and got the xml:
string xml = dataSet.GetXml();
But the xml is as below which is not in the expected format:
<NewDataSet>
<Table><Column1><FirstResultSet><SiteID>1<SiteID><FirstResultSet></Column1></Table>
<Table1><Column1><SecondResultSet><UserID>1<UserID><SecondResultSet></Column1></Table1>
</NewDataSet>
As you see the retrieved text is treated as text rather than xml.
How to get the xml out of this? I know I can just replace "<" and ">" but is there any built-in method for this to make this easier and quicker with better performance?
string xml = dataSet.GetXml().Replace("<", "<").Replace(">", ">");
Thanks,