Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet.GetXml Preserve XML Declaration ???

Status
Not open for further replies.

JSpicolli

Programmer
Apr 2, 2004
208
US
Hi,

Is there not a way to specify that a DataSet should Preserve the XML Declaration when calling DataSet.GetXml ?

I am using the DataSet only to Merge 2 XML strings.
After I merge the 2 dataSets, I then Call ds.GetXml to return the XML string with all the records merged into it.

I then pass that XML string as a param to a SQLXML sproc.

The only problem is that the proc always returns an empty node because it requires the XML Declaration, which the DataSet strips out when you call the GetXml method.

Anyone have a workaround?

Thanks.
 
Thnx, I can write to a textstream and wrap it with a StringBuilder, then call sb.ToString to retrieve the XML and then manually insert the XML Declaration.

Now my issue is that the ds also strips out the namespace attribute of the root element.

I don't think I am going to be able to use the ds.merge method.

Anyone have another way to merge XML streams?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top