You can associate a schema with your query. The Schema header will set the
root node such as the "myroot" in the partial schema header below:
<xsd:schema id="myRoot" xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
If you don't have control over the schema used for the query then a simple
replace could be used (or XSLT transform).
ds.ReadXml(dr, XmlReadMode.Fragment)
dim s as string
s = ds.GetXml
s = s.Replace("<Schema1>","<myRoot>")
s = s.Replace("</Schema1>","</myRoot>")
Response.Write(s)
Hope this helps...
"Simeon Lobo" wrote:
> Hello All,
>
> I have an ASP.NET web form that retrieves data from a SQL
> Server stored proc containing a "FOR XML AUTO, XMLDATA".
> The following is a snippet I use to convert the dataset to
> XML;
>
> '-- Start ---
> ds.ReadXml(dr, XmlReadMode.Fragment)
> Response.ContentType = "text/xml"
> Response.Write(ds.GetXml)
> '-- End ---
>
> When the XML data is returned, it is formatted as;
> <Schema1>
> ....
> ....
> ....
> </Schema>
>
> I was wondering if anyone could give me some ideas as to
> replacing <Schema1> with a parent node of my choice. I
> would also like to include a namespace declaration within
> this parent node.
>
> I would appreciate any ideas...thanks....
>
> Simeon
>
>
>
>
>
>
|