当前位置: 首页>>代码示例>>C#>>正文


C# StringWriter.str方法代码示例

本文整理汇总了C#中System.IO.StringWriter.str方法的典型用法代码示例。如果您正苦于以下问题:C# StringWriter.str方法的具体用法?C# StringWriter.str怎么用?C# StringWriter.str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.StringWriter的用法示例。


在下文中一共展示了StringWriter.str方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: htmlToXml

        public static string htmlToXml(this string htmlCode, bool xmlFormat)
        {
            try
            {
                var stringWriter = new StringWriter();
                var xmlWriter = XmlWriter.Create(stringWriter);
                xmlWriter.Flush();
                var htmlDocument = htmlCode.htmlDocument();

                htmlDocument.Save(xmlWriter);
                if (xmlFormat)
                    return stringWriter.str().xmlFormat();
                return stringWriter.str();
            }
            catch (Exception ex)
            {
                ex.log("[string.htmlToXml]");
                return ex.Message;
            }
        }
开发者ID:njmube,项目名称:FluentSharp,代码行数:20,代码来源:HtmlAgilityPack_ExtensionMethods_Xml.cs

示例2: xmlFormat

 public static string xmlFormat(this string xml, int indentation, char indentChar)
 {
     XmlDocument doc = new XmlDocument();
     doc.Load(xml.xmlReader());
     var stringWriter = new StringWriter();
     var xmlWriter = new XmlTextWriter(stringWriter);
     xmlWriter.Formatting = Formatting.Indented;
     xmlWriter.Indentation = indentation;
     xmlWriter.IndentChar = indentChar;
     xmlWriter.field("encoding", new UTF8Encoding()); //DC: is there another to set this			
     doc.Save(xmlWriter);
     return stringWriter.str();
 }
开发者ID:pusp,项目名称:o2platform,代码行数:13,代码来源:Xml_ExtensionMethods.cs

示例3: ProcessRequest

	   public string ProcessRequest(string page)	
	   {
	   		O2Gui.open<System.Windows.Forms.Panel>("Util - LogViewer", 400,140).add_LogViewer();
	   		"Current Directory: {0}".info(Environment.CurrentDirectory);
	   		
	   		var o2Timer = new O2Timer("ProcessRequest for file: {0}".info(page)).start();			
	   		Page = page ?? Page;
			var stringWriter = new StringWriter();
		   	simpleWorkerRequest = new SimpleWorkerRequest(Page, string.Empty, stringWriter);
		   	
		   	//openScript();
		   	
		   	//"Good Morning".execute_InScriptEditor_InSeparateAppDomain();
		   	"processing request for: {0}".info(Page);
		   	HttpRuntime.ProcessRequest(simpleWorkerRequest);
		   	var Html = stringWriter.str();
		   	o2Timer.stop();
		   	return Html;	
	   }	   	   	   	
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Scripts,代码行数:19,代码来源:aspCompile.cs

示例4: xmlString

 public static string xmlString(this XmlDocument xmlDocument)
 {
     var stringBuilder = new StringBuilder();
     var stringWriter = new StringWriter(stringBuilder);
     xmlDocument.Save(stringWriter);
     return stringWriter.str();
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:7,代码来源:Xml_ExtensionMethods.cs

示例5: xsl_Transform

        public static string xsl_Transform(this string xmlContent, string xstlFile)
        {
            try
            {
                var xslTransform = new XslCompiledTransform();

                xslTransform.Load(xstlFile);

                var xmlReader = new XmlTextReader(new StringReader(xmlContent));
                var xpathNavigator = new XPathDocument(xmlReader);
                var stringWriter = new StringWriter();

                xslTransform.Transform(xpathNavigator, new XsltArgumentList(), stringWriter);
                return stringWriter.str();
            }
            catch (Exception ex)
            {
                ex.log("[in xsl_Transform]");
                return "";
            }
        }
开发者ID:njmube,项目名称:FluentSharp,代码行数:21,代码来源:Xml_ExtensionMethods.cs

示例6: handleAction_Xsl

        private bool handleAction_Xsl(string data, string xsltToUse)
        {
            //if (this.tmWebServices.tmAuthentication.sessionID. UserRole.ReadArticles
            var xstlFile = context.Server.MapPath("\\xslt\\" + xsltToUse);
            if (xstlFile.fileExists())
            {
                var guid = tmWebServices.getGuidForMapping(data);
                if (guid != Guid.Empty)
                {
                    var xmlContent = tmWebServices.XmlDatabase_GetGuidanceItemXml(guid);
                                                  //.add_Xslt(xsltToUse);
                    if (xmlContent.valid())
                    {
                        //var xslTransform = new System.Xml.Xsl.XslTransform();
                        var xslTransform = new System.Xml.Xsl.XslCompiledTransform();

                        xslTransform.Load(xstlFile);

                        var xmlReader = new System.Xml.XmlTextReader(new StringReader(xmlContent));
                        var xpathNavigator = new System.Xml.XPath.XPathDocument(xmlReader);
                        var stringWriter = new StringWriter();

                        xslTransform.Transform(xpathNavigator, new System.Xml.Xsl.XsltArgumentList(), stringWriter);

                        context.Response.ContentType = "text/html";
                        context.Response.Write(stringWriter.str());
                        return true;
                    }
                    return false;
                }
                return transfer_ArticleViewer();

            }
            return false;
        }
开发者ID:DinisCruz,项目名称:TeamMentor_O2Platform,代码行数:35,代码来源:HandleUrlRequest.cs

示例7: handleAction_Xsl

        public void handleAction_Xsl(string data, string xsltToUse)
        {
            //if (this.TmWebServices.tmAuthentication.sessionID. UserRole.ReadArticles
            var xstlFile = context.Server.MapPath("\\xslt\\" + xsltToUse);
            if (xstlFile.fileExists())
            {
                var guid = tmWebServices.getGuidForMapping(data);
                if (guid != Guid.Empty)
                {
                    var xmlContent = tmWebServices.XmlDatabase_GetGuidanceItemXml(guid);
                                                  //.add_Xslt(xsltToUse);
                    if (xmlContent.valid())
                    {
                        //var xslTransform = new System.Xml.Xsl.XslTransform();
                        var xslTransform = new System.Xml.Xsl.XslCompiledTransform();

                        xslTransform.Load(xstlFile);

                        var xmlReader = new System.Xml.XmlTextReader(new StringReader(xmlContent));
                        var xpathNavigator = new System.Xml.XPath.XPathDocument(xmlReader);
                        var stringWriter = new StringWriter();

                        xslTransform.Transform(xpathNavigator, new System.Xml.Xsl.XsltArgumentList(), stringWriter);

                        context.Response.ContentType = "text/html";
                        context.Response.Write(stringWriter.str());

                        var article = tmWebServices.GetGuidanceItemById(guid);
                        switch(xsltToUse)
                        {
                            case "Notepad_Edit.xslt":
                                tmWebServices.RBAC_Demand_EditArticles();           // will trigger an Security exception if the user if not authorized
                                tmWebServices.logUserActivity("Edit Article (Notepad)", "{0} ({1})".format(article.Metadata.Title, guid));
                                break;
                            case "TeamMentor_Article.xslt":
                                tmWebServices.logUserActivity("View Article (xslt)", "{0} ({1})".format(article.Metadata.Title, guid));
                                break;
                            case "JsCreole_Article.xslt":
                                tmWebServices.logUserActivity("View Article (wiki)", "{0} ({1})".format(article.Metadata.Title, guid));
                                break;
                            default:
                                tmWebServices.logUserActivity("View Article ({0})", "{1} ({2})".format(xsltToUse, data,xsltToUse));
                                break;
                        }

                        endResponse();
                    }
                }
                else
                    transfer_Request("articleViewer");              // will trigger exception
            }
        }
开发者ID:TeamMentor,项目名称:Dev,代码行数:52,代码来源:HandleUrlRequest.cs


注:本文中的System.IO.StringWriter.str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。