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)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜