當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。