熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

如何將結果輸出到字符串裡

2013-11-13 09:57:30  來源: .NET編程 
    XslTransformTransform 方法將結果輸出到字符串裡有中辦法
  
  
  通過SystemIOMemoryStream類來實現
  通過SystemTextStringBuilder類來實現
  
  下面是具體的實現方法
  
  SystemXmlXslXslTransform RssXslt = new SystemXmlXslXslTransform();
  SystemXmlXmlDocument RssXml = new SystemXmlXmlDocument();
  RssXsltLoad(ServerMapPath(RssReaderxslt));
  RssXmlLoad(ServerMapPath(Rssxml));
  SystemIOMemoryStream t = new SystemIOMemoryStream();
  RssXsltTransform(RssXmlnulltnull);
  string resultString = SystemTextUTFEncodingUTFGetString(tToArray());
  ResponseWrite(resultString);
  
  SystemXmlXslXslTransform RssXslt = new SystemXmlXslXslTransform();
  SystemXmlXmlDocument RssXml = new SystemXmlXmlDocument();
  RssXsltLoad(ServerMapPath(RssReaderxslt));
  RssXmlLoad(ServerMapPath(Rssxml));
  SystemTextStringBuilder t = new SystemTextStringBuilder();
  RssXsltTransform(RssXmlnullnew SystemIOStringWriter(t)null);
  string resultString = tToString();
  ResponseWrite(resultString);

From:http://tw.wingwit.com/Article/program/net/201311/12112.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.