<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XML and XmlDataSource Control</title><link>http://forums.asp.net/43.aspx</link><description>All about XML, XSLT, and the XmlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/996238.aspx</link><pubDate>Fri, 22 Jul 2005 15:04:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:996238</guid><dc:creator>rmprimo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/996238.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=996238</wfw:commentRss><description>Thank you</description></item><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/994688.aspx</link><pubDate>Thu, 21 Jul 2005 12:24:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:994688</guid><dc:creator>tomasr</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/994688.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=994688</wfw:commentRss><description>It should look something like this:&lt;br&gt;
&lt;br&gt;
XslCompiledTransform xslt = ....;&lt;br&gt;
&lt;br&gt;
StringBuilder buffer = new StringBuilder();&lt;br&gt;
StringWriter writer = new StringWriter(buffer);&lt;br&gt;
&lt;br&gt;
xslt.Transform(docToTransform, writer);&lt;br&gt;
&lt;br&gt;
string result = buffer.ToString();&lt;br&gt;
&lt;br&gt;
&lt;br&gt;</description></item><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/994351.aspx</link><pubDate>Thu, 21 Jul 2005 03:32:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:994351</guid><dc:creator>rmprimo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/994351.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=994351</wfw:commentRss><description>&lt;FONT size=2&gt;Would you mind posting a snippet.&lt;BR&gt;&lt;BR&gt;TIA&lt;/FONT&gt;</description></item><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/994202.aspx</link><pubDate>Wed, 20 Jul 2005 22:36:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:994202</guid><dc:creator>tomasr</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/994202.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=994202</wfw:commentRss><description>Rob,&lt;br&gt;
&lt;br&gt;
Doing it in 2.0 is not any harder, just use any of the overloads of
XslCompiledTransform.Transform() that takes an TextWriter as an
argument and pass in a StringWriter there instead of the usual
StreamWriter. This will get your transformed output to a StringBuilder
from which you can read it back (or just use a StreamWriter on top of a
MemoryStream).&lt;br&gt;
&lt;br&gt;</description></item><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/993953.aspx</link><pubDate>Wed, 20 Jul 2005 19:14:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:993953</guid><dc:creator>rmprimo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/993953.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=993953</wfw:commentRss><description>&lt;FONT size=2&gt;Thank you. That sure worked.&lt;BR&gt;&lt;BR&gt;For reference, here is the snippet that did it:&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#006400&gt;//using&amp;nbsp;a different&amp;nbsp;overload that returns an XmlReader.&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#008080 size=2&gt;XmlReader&lt;/FONT&gt;&lt;FONT size=2&gt; reader = xslt.Transform(Server.MapPath(&lt;FONT color=#800000 size=2&gt;"Source.xml"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/FONT&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt;,&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new&lt;/FONT&gt;&lt;FONT size=2&gt; System.Xml.&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;XmlUrlResolver&lt;/FONT&gt;&lt;FONT size=2&gt;()); &lt;BR&gt;reader.MoveToContent();&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; resultXmlString = reader.ReadOuterXml();&lt;BR&gt;&lt;FONT color=#006400&gt;&lt;BR&gt;//now use that string to construct my object&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt; mc =&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt;(resultXmlString);&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;There is still the issue of doing this the Whidbey way. &lt;/STRONG&gt;The&lt;STRONG&gt; &lt;/STRONG&gt;&lt;FONT color=#ff0000&gt;XslTransform&lt;/FONT&gt; is now obsolete and replaced by the &lt;FONT color=#ff0000 size=3&gt;&lt;STRONG&gt;XslCompiledTransform&lt;/STRONG&gt;&lt;/FONT&gt;, which, however only has overloads that return &lt;STRONG&gt;&lt;FONT color=#0000ff&gt;void&lt;/FONT&gt;.&lt;/STRONG&gt; It is supposed to be much more efficient.&lt;BR&gt;&lt;BR&gt;So how do we do this in v2.0?&lt;BR&gt;&lt;BR&gt;TIA&lt;BR&gt;&lt;BR&gt;Rob&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;</description></item><item><title>Re: How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/993595.aspx</link><pubDate>Wed, 20 Jul 2005 15:09:38 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:993595</guid><dc:creator>JasonFollas</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/993595.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=993595</wfw:commentRss><description>Look at the sample code in this thread: &lt;A HREF="/977351/ShowPost.aspx"&gt;http://forums.asp.net/977351/ShowPost.aspx&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;The Transform() method is overloaded, and the code in that thread shows one way to invoke it and get a XmlReader returned (which can then be used to get the string).</description></item><item><title>How to xsltransform to an xml string in memory?</title><link>http://forums.asp.net/thread/993472.aspx</link><pubDate>Wed, 20 Jul 2005 13:54:26 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:993472</guid><dc:creator>rmprimo</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/993472.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=993472</wfw:commentRss><description>&lt;FONT size=2&gt;I have a custom control which can consume either an xml file or an xml string. They are both exposed as methods and consructor&amp;nbsp;overloads.&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt; mc =&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt;("&lt;FONT color=#800000&gt;File.xml&lt;/FONT&gt;");&lt;BR&gt;&lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt; mc =&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;string&lt;/FONT&gt; xmlString);&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#006400&gt;&lt;FONT color=#000000&gt;This works, however the runtime needs to have write permissions and I don't really want to keep this file anyway, just use it at runtime.&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;//or the v1.1 XslTransform class-same issue&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt;&lt;FONT color=#008080 size=2&gt;XslCompiledTransform&lt;/FONT&gt;&lt;FONT size=2&gt; xslt = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;XslCompiledTransform&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;xslt.Load(Server.MapPath(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"StyleSheet.xslt"&lt;/FONT&gt;&lt;FONT size=2&gt;));&lt;BR&gt;xslt.Transform(Server.MapPath(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Source.xml"&lt;/FONT&gt;&lt;FONT size=2&gt;), Server.MapPath(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"Result.xml"&lt;/FONT&gt;&lt;FONT size=2&gt;)); 
&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt; mc =&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt;("&lt;FONT color=#800000&gt;Result.xml&lt;/FONT&gt;");&lt;BR&gt;...&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;I would much rather be able to:&lt;BR&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt; mc =&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#008080&gt;MyCustomControl&lt;/FONT&gt;(resultXmlString);&lt;BR&gt;...&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;Any tip would be greatly appreciated.&lt;BR&gt;&lt;BR&gt;TIA&lt;BR&gt;&lt;BR&gt;Rob&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;</description></item></channel></rss>