Re: Display XML Output from SQL Server



Thanks for your followup Terry,

As for your new question, I think it can be done through the XmlDocument
class's methods. There is a "CreateProcessingInstrunction" method which can
help create a XML processing instruction (such as the XSLT link
instruction). We can simply create such a processing instruction and insert
it into the XmlDocument(load from XmlReader) and then use the
XmlDocument.Save method to flush it into file. For exapmle:

=============================
XmlReader xdr = comm.ExecuteXmlReader();

XmlDocument doc = new XmlDocument();

doc.Load(xdr);

//save the xmlstream into file(with xsl*** instruction

XmlProcessingInstruction newPI;
string PItext = "type='text/xsl' href='template.xslt'";
newPI = doc.CreateProcessingInstruction("xml-style***", PItext);

doc.InsertBefore(newPI,doc.DocumentElement);

doc.Save(@"d:\temp\output.xml");
...................
==========================

In addition, I would suggest you have a look at the .NET's XML processing
reference and you'll find many useful stuff there:

#XML Documents and Data
http://msdn2.microsoft.com/en-us/library/2bcctyt8.aspx

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



.