R
Robert Rossney
I have a pretty large store of SQL Server 2K stored procedures that
accept an XML document as their input parameter and return results using
FOR XML RAW.
What's the best way to create C# code that executes these stored procs
and returns an XmlDocument()?
The basic problem is that SQL Server 2K's XML output produces document
fragments (i.e. collections of elements), not documents. To work around
this, I'm presently using a StringBuilder to create a string containing
an opening tag, appending the OuterXml of each XmlTextReader.Read() to
it, and then, when there's no more data, slapping on the end tag,
producing the string, and passing it to XmlDocument.LoadXml().
I've toyed with deriving a class from XmlTextReader that emits the
closing and ending tags, so that I can pass that object to
XmlDocument.Load(). That seems a little roundabout, but it smells like
it's the right solution -- at least, to this mode of the problem.
I've spent a lot of time Googling for the right answer and haven't found
it. Any help would be appreciated.
Thanks,
Bob Rossney
(e-mail address removed)
accept an XML document as their input parameter and return results using
FOR XML RAW.
What's the best way to create C# code that executes these stored procs
and returns an XmlDocument()?
The basic problem is that SQL Server 2K's XML output produces document
fragments (i.e. collections of elements), not documents. To work around
this, I'm presently using a StringBuilder to create a string containing
an opening tag, appending the OuterXml of each XmlTextReader.Read() to
it, and then, when there's no more data, slapping on the end tag,
producing the string, and passing it to XmlDocument.LoadXml().
I've toyed with deriving a class from XmlTextReader that emits the
closing and ending tags, so that I can pass that object to
XmlDocument.Load(). That seems a little roundabout, but it smells like
it's the right solution -- at least, to this mode of the problem.
I've spent a lot of time Googling for the right answer and haven't found
it. Any help would be appreciated.
Thanks,
Bob Rossney
(e-mail address removed)