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


C# DocumentBuilder.Build方法代码示例

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


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

示例1: processTestSet

 private void processTestSet(DocumentBuilder catbuilder, XPathCompiler xpc, XdmNode funcSetNode)
 {
     string testName;
     try
     {
         results.WriteLine("<test-set name='" + funcSetNode.GetAttributeValue(new QName("name")) + "'>");
     }
     catch (Exception e)
     {
     }
     string testSetFile = testSuiteDir + "\\" + funcSetNode.GetAttributeValue(new QName("file"));
     xpc.BaseUri = testSetFile;
     XdmNode testSetDocNode = catbuilder.Build(new Uri(testSetFile));
     localEnvironments.Clear();
     TestEnvironment defaultEnvironment = createLocalEnvironment(testSetDocNode.BaseUri);
     localEnvironments.Add("default", defaultEnvironment);
     bool run = true;
     IEnumerator dependency = xpc.Evaluate("/test-set/dependency", testSetDocNode).GetEnumerator();
     while (dependency.MoveNext())
     {
         if (!DependencyIsSatisfied((XdmNode)dependency.Current, defaultEnvironment))
         {
             run = false;
         }
     }
     if (run)
     {
         IEnumerator iter = xpc.Evaluate("//environment[@name]", testSetDocNode).GetEnumerator();
         while (iter.MoveNext())
         {
             processEnvironment(xpc, (XdmNode)iter.Current, localEnvironments);
         }
         IEnumerator testCases = xpc.Evaluate("//test-case", testSetDocNode).GetEnumerator();
         while (testCases.MoveNext())
         {
             testName = ((XdmNode)xpc.EvaluateSingle("@name", (XdmItem)testCases.Current)).StringValue;
             if (testPattern != null && !testPattern.Match(testName).Success)
             {
                 continue;
             }
             feedback.Message("Test set " + funcSetNode.GetAttributeValue(new QName("name")) + " ", false);
             runTestCase((XdmNode)testCases.Current, xpc);
         }
     }
     try
     {
         results.WriteLine("</test-set>");
     }
     catch (Exception e)
     {
     }
 }
开发者ID:zhuyue1314,项目名称:xcat,代码行数:52,代码来源:FOTestSuiteDriver.cs

示例2: buildSource

    /**
     * Construct source object. This method allows subclassing e.g. to build a DOM or XOM source.
     * @param xml
     * @return
     * @throws XPathException
     */
    protected XdmNode buildSource(XdmNode catalog, DocumentBuilder builder, String sourceName)
    {
        // Find the source element in the catalog

        XPathSelector xps = findSourcePath.Load();
        xps.SetVariable(new QName("", "param"), new XdmAtomicValue(sourceName));
        xps.ContextItem = catalog;
        XdmNode source = (XdmNode)xps.EvaluateSingle();

        // decide whether schema validation is needed

        bool validate = source.GetAttributeValue(new QName("", "schema")) != null;
        if (validate)
        {
            builder.SchemaValidationMode = SchemaValidationMode.Strict;
        }
        else
        {
            builder.SchemaValidationMode = SchemaValidationMode.None;
        }

        // build the document tree from the source file

        string filename = testSuiteDir + "/" + source.GetAttributeValue(new QName("", "FileName"));
        if (source == null)
        {
            throw new ArgumentException("Source " + sourceName + " not found in catalog");
        }
        return builder.Build(new Uri(filename));
    }
开发者ID:nuxleus,项目名称:saxonica,代码行数:36,代码来源:XQueryTestSuiteDriver.cs

示例3: BuildDocument

 private void BuildDocument(FileCollection files, Dictionary<string, object> metadata = null, ApplyTemplateSettings applyTemplateSettings = null, string templateFolder = null)
 {
     using (var builder = new DocumentBuilder(LoadAssemblies(), ImmutableArray<string>.Empty, null, templateFolder))
     {
         if (applyTemplateSettings == null)
         {
             applyTemplateSettings = new ApplyTemplateSettings(_inputFolder, _outputFolder);
             applyTemplateSettings.RawModelExportSettings.Export = true;
         }
         var parameters = new DocumentBuildParameters
         {
             Files = files,
             OutputBaseDir = Path.Combine(Directory.GetCurrentDirectory(), _outputFolder),
             ApplyTemplateSettings = applyTemplateSettings,
             Metadata = metadata?.ToImmutableDictionary(),
             TemplateManager = new TemplateManager(null, null, new List<string> { _templateFolder }, null, null),
             TemplateDir = templateFolder,
         };
         builder.Build(parameters);
     }
 }
开发者ID:dotnet,项目名称:docfx,代码行数:21,代码来源:DocumentBuilderTest.cs

示例4: buildSource

    /**
     * Construct source object. This method allows subclassing e.g. to build a DOM or XOM source.
     * @param xml
     * @return
     * @throws XPathException
     */

    protected XdmNode buildSource(DocumentBuilder builder, String xml, String validationMode)
    {
        if ("strict".Equals(validationMode))
        {
            builder.SchemaValidationMode = SchemaValidationMode.Strict;
        }
        else
        {
            builder.SchemaValidationMode = SchemaValidationMode.None;
        }
        return builder.Build(new Uri(xml));
    }
开发者ID:zhuyue1314,项目名称:xcat,代码行数:19,代码来源:XsltTestSuiteDriver.cs

示例5: BuildDocument

 private void BuildDocument(
     FileCollection files,
     string inputFolder,
     string outputFolder,
     Dictionary<string, object> metadata = null,
     ApplyTemplateSettings applyTemplateSettings = null,
     string templateFolder = null,
     string intermediateFolder = null,
     Dictionary<string, ChangeKindWithDependency> changes = null)
 {
     using (var builder = new DocumentBuilder(LoadAssemblies(), ImmutableArray<string>.Empty, null, intermediateFolder))
     {
         if (applyTemplateSettings == null)
         {
             applyTemplateSettings = new ApplyTemplateSettings(inputFolder, outputFolder);
         }
         var parameters = new DocumentBuildParameters
         {
             Files = files,
             OutputBaseDir = Path.Combine(Directory.GetCurrentDirectory(), outputFolder),
             ApplyTemplateSettings = applyTemplateSettings,
             Metadata = metadata?.ToImmutableDictionary(),
             TemplateManager = new TemplateManager(null, null, new List<string> { templateFolder }, null, null),
             TemplateDir = templateFolder,
             Changes = changes?.ToImmutableDictionary(),
         };
         builder.Build(parameters);
     }
 }
开发者ID:vicancy,项目名称:docfx,代码行数:29,代码来源:IncrementalBuildTest.cs


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