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


C# XsltArgumentList.Clear方法代码示例

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


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

示例1: Clear8

        public void Clear8(object param)
        {
            string Baseline = "baseline\\" + (string)param;
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //TEST_SKIPPED;
            retObj = m_xsltArg.RemoveParam("myArg1", szEmpty);
            m_xsltArg.Clear();

            if ((LoadXSL("showParam.xsl") != 1) || (Transform_ArgList("fruits.xml") != 1))
                Assert.True(false);

            VerifyResult(Baseline, _strOutFile);

            MyObject obj = new MyObject(26, _output);

            m_xsltArg.AddExtensionObject(szDefaultNS, obj);
            m_xsltArg.RemoveExtensionObject(szDefaultNS);
            m_xsltArg.Clear();

            if ((LoadXSL("MyObjectDef.xsl") == 1))
            {
                try
                {
                    Transform_ArgList("fruits.xml");
                }
                catch (System.Xml.Xsl.XsltException)
                {
                    return;
                }
            }
            _output.WriteLine("Exception not thrown for NS not found");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:37,代码来源:XsltArgumentList.cs

示例2: Clear5

        public void Clear5(object param)
        {
            string Baseline = "baseline\\" + (string)param;
            m_xsltArg = new XsltArgumentList();
            String obj = "Test";

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg2", szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg2", szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed to add/remove iteration {0}", i);
                    _output.WriteLine("{0} : {1}", retObj, obj + i);

                    Assert.True(false);
                }
                m_xsltArg.Clear();
            }

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg" + i, szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg" + i, szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed in 2nd part to add/remove iteration {0}", i);
                    Assert.True(false);
                }
            }

            //  _output.WriteLine(retObj.GetType());

            m_xsltArg.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(Baseline, _strOutFile);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:43,代码来源:XsltArgumentList.cs

示例3: Clear7

        public void Clear7(object param)
        {
            string Baseline = "baseline\\" + (string)param;
            m_xsltArg = new XsltArgumentList();
            XsltArgumentList m_2 = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //TEST_SKIPPED;

            m_2.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(Baseline, _strOutFile);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:21,代码来源:XsltArgumentList.cs

示例4: Clear2

        public void Clear2(object param)
        {
            string Baseline = "baseline\\" + (string)param;
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.Clear();
            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(Baseline, _strOutFile);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:14,代码来源:XsltArgumentList.cs

示例5: Clear4

        public void Clear4()
        {
            MyObject obj = new MyObject(26, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject(szDefaultNS, obj);
            m_xsltArg.Clear();
            retObj = m_xsltArg.GetExtensionObject(szDefaultNS);
            if (retObj != null)
            {
                _output.WriteLine("Did not appear to clear an extension object");
                Assert.True(false);
            }

            if ((LoadXSL("MyObjectDef.xsl") == 1))
            {
                try
                {
                    Transform_ArgList("fruits.xml");
                }
                catch (System.Xml.Xsl.XsltException)
                {
                    return;
                }
            }
            _output.WriteLine("Exception not thrown for NS not found");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:28,代码来源:XsltArgumentList.cs

示例6: GenerateHtmlFiles

        /// <summary>
        /// Generates HTML report files if allowed by this.<see cref="ReportFormat"/> and as specified by this.<see cref="HtmlReportFormat"/>.
        /// </summary>
        /// <returns>True on success, false on fail.</returns>
        private bool GenerateHtmlFiles()
        {
            // Use custom XSLT if provided
            string transformFile = String.Empty;
            if (!String.IsNullOrEmpty(this.xsltStylesheetPath))
            {
                //executor.Invoke(this.xsltStylesheetPath);
                transformFile = this.xsltStylesheetPath;
            }
            else
            {
                transformFile = RulesEngineUtils.GetResourcePath( RulesEngineUtils.ReportBuilderFolder.Resources, RulesEngineUtils.TransformFile );
                //executor.Invoke(transformFile);
            }

            if( !File.Exists( transformFile ) )
            {
                executor.Invoke("Conversion aborted");
                Trace.TraceError( "Error: Transform File not found at:\n\t" + transformFile + "\nHtml Conversion aborted." );
                return false;
            }

            bool anyFiles = false;

            //load the transform once for all R-files
            XslCompiledTransform transform = new XslCompiledTransform();
            try
            {
                transform.Load(transformFile);
            }
            catch ( XmlException )
            {
                Trace.TraceError("Error: Transform File contains invalid XML:\n\t" + transformFile + "\nHtml Conversion aborted.");
                return false;
            }
            catch ( XsltException )
            {
                Trace.TraceError("Error: Transform File contains invalid XSLT:\n\t" + transformFile + "\nHtml Conversion aborted.");
                return false;
            }

            XsltArgumentList argList = new XsltArgumentList();
            argList.Clear();

            if( this.HtmlReportFormat == HtmlReportFormat.Complete )
            {
                argList.AddParam( "asPage", string.Empty, "true" );

            }

            argList.AddParam( "numberDecimalSeparator", string.Empty, Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator );
            argList.AddParam( "numberGroupSeparator", string.Empty, Thread.CurrentThread.CurrentCulture.NumberFormat.NumberGroupSeparator );
            argList.AddParam( "numberGroupSize", string.Empty, Thread.CurrentThread.CurrentCulture.NumberFormat.NumberGroupSizes[ 0 ].ToString() );

            XmlWriterSettings writerSettings = new XmlWriterSettings();
            writerSettings.Encoding = InstanceReport.Encoding;
            writerSettings.Indent = true;
            writerSettings.OmitXmlDeclaration = true;

            //set intelligent HTML output
            writerSettings.GetType().GetProperty( "OutputMethod" ).SetValue( writerSettings, XmlOutputMethod.Html, null );

            foreach( ReportHeader header in this.currentFilingSummary.MyReports )
            {
                switch( header.ReportType )
                {
                    case ReportHeaderType.Notes:
                    case ReportHeaderType.Sheet:
                        break;
                    default:
                        continue;
                }

                string inFile = Path.Combine( this.currentReportDirectory, header.XmlFileName );
                if( !File.Exists( inFile ) )
                {
                    Trace.TraceWarning( "Warning: The FilingSummary provided '"+ header.XmlFileName +"' but the file was not found." +
                        separator +"\tReport skipped: "+ header.LongName );
                    continue;
                }

                int extLen = Path.GetExtension( header.XmlFileName ).Length;
                string outFile = inFile.Substring( 0, inFile.Length - extLen ) +".htm";

                using( XmlReader xReader = XmlReader.Create( inFile ) )
                {
                    using( FileStream msOut = new FileStream( outFile, FileMode.Create, FileAccess.Write ) )
                    {
                        try
                        {
                            using( RivetXmlWriter xWriter = new RivetXmlWriter( msOut, writerSettings ) )
                            {
                                transform.Transform( xReader, argList, xWriter );
                            }

                            anyFiles = true;
//.........这里部分代码省略.........
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:101,代码来源:ReportBuilder.cs

示例7: CalculatePercentage


//.........这里部分代码省略.........
              string name = baseName.Substring(0, baseName.LastIndexOf('.'));
              if (name.Equals(k))
              {
                // This is a base class; don't check inheritance.
                wrong = false;
                wellWrittenFiles++;
                break;
              }
              matchDict = baseName.Contains(k);
              if (matchDict)
              {
                // classes inherited from base classes;
                // check inheritance according to the second rule of the naming convention:
                // e.g. mafView -> mafViewVTK
                if (CheckInheritance(f, k))
                {
                  wrong = false;
                  wellWrittenFiles++;
                  goodFiles += " " + baseName;
                }
                break;
              }
            }
            if (wrong)
            {
              wrongFiles += " " + baseName;
            }
              }
              double percentage = (wellWrittenFiles / Convert.ToDouble(totalFiles));
              xwriter.WriteAttributeString("Percentage", percentage.ToString("P"));
              string[] wfilesList = wrongFiles.Split(' ');
              foreach (string f in wfilesList)
              {
            if (f == "")
            {
              continue;
            }
            xwriter.WriteStartElement("WrongFiles");
            xwriter.WriteAttributeString("FileName", f);
            xwriter.WriteEndElement();
              }
              string[] gfilesList = goodFiles.Split(' ');
              foreach (string f in gfilesList)
              {
            if (f == "")
            {
              continue;
            }
            xwriter.WriteStartElement("GoodFiles");
            xwriter.WriteAttributeString("FileName", f);
            xwriter.WriteEndElement();
              }

              //End the nodeDir element.
              xwriter.WriteEndElement();
              Array.Clear(files, 0, files.Length);
            }
            myTimer.Stop();

            // Calculate time per iteration in seconds
            myTimer.SetMultiplier(1.0);
            double result = myTimer.Duration();
            xwriter.WriteElementString("ComputationTime", result.ToString("F") + " s");

            //End the "root" element.
            xwriter.WriteEndElement();

            //End the document
            xwriter.WriteEndDocument();
            xwriter.Close();

            // Load the style sheet.
            XslCompiledTransform xslt = new XslCompiledTransform();
            xslt.Load("resultTransform.xslt");

            // Execute the transform and output the results to a file.
            string reportHTMLFile = resultDirXML + "\\" + "..\\HTML\\FileNamingReport.html";
            xslt.Transform(reportFile, reportHTMLFile);

            XslCompiledTransform xsltWrongFiles = new XslCompiledTransform();
            xsltWrongFiles.Load("wrongFileList.xslt");

            string dirResultFile;
            XsltArgumentList xslArg = new XsltArgumentList();
            foreach (string d in dirList)
            {
              nodeDir = d.Substring(d.LastIndexOf('\\') + 1);
              dirResultFile = resultDirXML + "\\" + "..\\HTML\\" + nodeDir + ".html";
              xslArg.AddParam("dir", "", nodeDir);
              StreamWriter sw = new StreamWriter(dirResultFile);
              xsltWrongFiles.Transform(reportFile, xslArg, sw);
              sw.Close();
              xslArg.Clear();
            }
              }
              catch (Exception ex)
              {
            Console.WriteLine(ex.Message);
              }
        }
开发者ID:besoft,项目名称:MAF2Medical,代码行数:101,代码来源:Program.cs

示例8: Clear6

        public void Clear6()
        {
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //return TEST_SKIPPED;

            for (int i = 0; i < 300; i++)
                m_xsltArg.Clear();
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj != null)
                Assert.True(false);

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(466.5112789241) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:21,代码来源:CXslTArgumentList.cs

示例9: Clear7

        public void Clear7()
        {
            m_xsltArg = new XsltArgumentList();
            XsltArgumentList m_2 = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //return TEST_SKIPPED;

            m_2.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(457.6003003605) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:18,代码来源:CXslTArgumentList.cs

示例10: Clear2

        public void Clear2()
        {
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.Clear();
            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(466.5112789241) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:CXslTArgumentList.cs

示例11: Clear5

        public void Clear5()
        {
            m_xsltArg = new XsltArgumentList();
            String obj = "Test";

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg2", szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg2", szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed to add/remove iteration {0}", i);
                    _output.WriteLine("{0} : {1}", retObj, obj + i);

                    Assert.True(false);
                }
                m_xsltArg.Clear();
            }

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg" + i, szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg" + i, szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed in 2nd part to add/remove iteration {0}", i);
                    Assert.True(false);
                }
            }

            //	_output.WriteLine(retObj.GetType());

            m_xsltArg.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(466.5112789241) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:40,代码来源:CXslTArgumentList.cs

示例12: Clear6

        public void Clear6(object param)
        {
            string Baseline = Path.Combine("baseline", (string)param);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //TEST_SKIPPED;

            for (int i = 0; i < 300; i++)
                m_xsltArg.Clear();
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj != null)
                Assert.True(false);

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(Baseline, _strOutFile);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:AtsushiKan,项目名称:corefx,代码行数:24,代码来源:XsltArgumentList.cs

示例13: Clear8

        public void Clear8()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result>
		1.No Value Specified
		2.No Value Specified
		3.No Value Specified
		4.No Value Specified
		5.No Value Specified
		6.No Value Specified</result>";

            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //return TEST_SKIPPED;
            retObj = m_xsltArg.RemoveParam("myArg1", szEmpty);
            m_xsltArg.Clear();

            if ((LoadXSL("showParam.xsl") != 1) || (Transform_ArgList("fruits.xml") != 1))
            Assert.True(false);

            VerifyResult(expected);

            MyObject obj = new MyObject(26, _output);

            m_xsltArg.AddExtensionObject(szDefaultNS, obj);
            m_xsltArg.RemoveExtensionObject(szDefaultNS);
            m_xsltArg.Clear();

            if ((LoadXSL("myObjectDef.xsl") == 1))
            {
                try
                {
                    Transform_ArgList("fruits.xml");
                }
                catch (System.Xml.Xsl.XsltException)
                {
                    return;
                }
            }
            _output.WriteLine("Exception not thrown for NS not found");
            Assert.True(false);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:44,代码来源:CXslTArgumentList.cs

示例14: Clear7

        public void Clear7()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result>
		1.Test1
		2.No Value Specified
		3.No Value Specified
		4.No Value Specified
		5.No Value Specified
		6.No Value Specified</result>";

            m_xsltArg = new XsltArgumentList();
            XsltArgumentList m_2 = new XsltArgumentList();

            m_xsltArg.AddParam("myArg1", szEmpty, "Test1");
            retObj = m_xsltArg.GetParam("myArg1", szEmpty);
            if (retObj.ToString() != "Test1")
                return; //return TEST_SKIPPED;

            m_2.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(expected);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:28,代码来源:CXslTArgumentList.cs

示例15: Clear5

        public void Clear5()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result>
		1.No Value Specified
		2.No Value Specified
		3.No Value Specified
		4.No Value Specified
		5.No Value Specified
		6.No Value Specified</result>";

            m_xsltArg = new XsltArgumentList();
            String obj = "Test";

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg2", szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg2", szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed to add/remove iteration {0}", i);
                    _output.WriteLine("{0} : {1}", retObj, obj + i);

                    Assert.True(false);
                }
                m_xsltArg.Clear();
            }

            for (int i = 0; i < 200; i++)
            {
                m_xsltArg.AddParam("myArg" + i, szEmpty, obj + i);
                retObj = m_xsltArg.GetParam("myArg" + i, szEmpty);
                if (retObj.ToString() != (obj + i))
                {
                    _output.WriteLine("Failed in 2nd part to add/remove iteration {0}", i);
                    Assert.True(false);
                }
            }

            m_xsltArg.Clear();

            if ((LoadXSL("showParam.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(expected);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:48,代码来源:CXslTArgumentList.cs


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