public string ReadFile(string path)
{
string tempContent = "";
using (StreamReader sr = new StreamReader(path,System.Text.Encoding.GetEncoding("gb2312")))
{
tempContent = sr.ReadToEnd();
}
return tempContent;
}
private string TransfromXmlStringToHtml(string XmlString, string xsltpath)
{
StringReader xml = new StringReader(XmlString);
XPathDocument xmlDoc = new XPathDocument(xml);
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(xsltpath);
string temp = "";
System.IO.Stream str = new System.IO.MemoryStream();
xsl.Transform(xmlDoc, null, str);
str.Flush();
str.Position = 0;
using (System.IO.StreamReader sr = new System.IO.StreamReader(str, System.Text.Encoding.GetEncoding("GB2312")))
{
temp = sr.ReadToEnd();
};
return temp;
}
private string TransfromXmlToHtml(DataSet ds, string xsltpath)
{
XmlDataDocument xmlDoc = new XmlDataDocument(ds);
XslCompiledTransform xsl = new XslCompiledTransform();
xsl.Load(xsltpath);
string temp = "";
System.IO.Stream str = new System.IO.MemoryStream();
xsl.Transform(xmlDoc, null, str);
str.Flush();
str.Position = 0;
using (System.IO.StreamReader sr = new System.IO.StreamReader(str, System.Text.Encoding.UTF8))
{
temp = sr.ReadToEnd();
};
return temp;
}
posted on 2010-11-24 10:20
sanmao 阅读(275)
评论(0) 编辑 收藏