net.sf.saxon.s9api.Processor.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中net.sf.saxon.s9api.Processor.<init>()方法的一些代码示例,展示了Processor.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Processor.<init>()方法的具体详情如下:
包路径:net.sf.saxon.s9api.Processor
类名称:Processor
方法名:<init>

Processor.<init>介绍

[英]Create a Processor configured according to the settings in a supplied configuration file.
[中]根据提供的配置文件中的设置创建配置的处理器。

代码示例

代码示例来源:origin: apache/nifi

@Override
  public ValidationResult validate(final String subject, final String input, final ValidationContext validationContext) {
    try {
      final Processor proc = new Processor(false);
      final XQueryCompiler comp = proc.newXQueryCompiler();
      String error = null;
      try {
        comp.compile(input);
      } catch (final Exception e) {
        error = e.toString();
      }
      return new ValidationResult.Builder().input(input).subject(subject).valid(error == null).explanation(error).build();
    } catch (final Exception e) {
      return new ValidationResult.Builder().input(input).subject(subject).valid(false)
          .explanation("Unable to initialize XQuery engine due to " + e.toString()).build();
    }
  }
}

代码示例来源:origin: apache/nifi

final Map<String, XQueryExecutable> attributeToXQueryMap = new HashMap<>();
final Processor proc = new Processor(false);
final XMLReader xmlReader;

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Construct a TransformerFactory using an existing Configuration.
 *
 * @param config the Saxon configuration
 */
public SaxonTransformerFactory(Configuration config) {
  processor = new Processor(config);
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Default constructor.
 */
public SaxonTransformerFactory() {
  processor = new Processor(true);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Default constructor.
 */
public SaxonTransformerFactory() {
  processor = new Processor(true);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Construct a TransformerFactory using an existing Configuration.
 *
 * @param config the Saxon configuration
 */
public SaxonTransformerFactory(Configuration config) {
  processor = new Processor(config);
}

代码示例来源:origin: msokolov/lux

public Processor getProcessor () {
  if (processor == null) {
    processor = new Processor(false);
  }
  return processor;
}

代码示例来源:origin: org.daisy.pipeline/common-utils

public XMLStreamWriterOverTreeWriter(Configuration configuration) {
  // FIXME: TreeWriter doesn't need the Processor, it calls getUnderlyingConfiguration
  super(new Processor(configuration));
}

代码示例来源:origin: msokolov/lux

private static Processor makeProcessor () {
  try {
    if (Class.forName("com.saxonica.config.EnterpriseConfiguration") != null) {
      return new Processor (true);
    }
  } catch (ClassNotFoundException e) { }
  try {
    if (Class.forName("com.saxonica.config.ProfessionalConfiguration") != null) {
      //return new Processor (new Config());
      return new Processor (true);
    }
  } catch (ClassNotFoundException e) { }
  Processor p = new Processor (new Config());
  if (! StringUtils.isEmpty(System.getProperty("org.expath.pkg.saxon.repo"))) {
    EXPathSupport.initializeEXPath(p);
  }
  return p;
}

代码示例来源:origin: org.daisy.pipeline/common-utils

private void initCompiler(Configuration config) {
    this.xsltCompiler = new Processor(config).newXsltCompiler();
    if (this.uriResolver != null) {
      //this resolver is used for xsl:include and xsl:import
      this.xsltCompiler.setURIResolver(this.uriResolver);
    }
  }
}

代码示例来源:origin: com.taxonic.carml/carml-logical-source-resolver-xpath

public XPathResolver(boolean autoNodeTextExtraction) {
  this.autoNodeTextExtraction = autoNodeTextExtraction;
  this.xpathProcessor = new Processor(false);
  this.xpath = xpathProcessor.newXPathCompiler();
  this.xpath.setCaching(true);
}

代码示例来源:origin: carml/carml

public XPathResolver(boolean autoNodeTextExtraction) {
  this.autoNodeTextExtraction = autoNodeTextExtraction;
  this.xpathProcessor = new Processor(false);
  this.xpath = xpathProcessor.newXPathCompiler();
  this.xpath.setCaching(true);
}

代码示例来源:origin: epam/Wilma

/**
   * Creates a new {@link Processor} with a default {@link Configuration}.
   * @return the new instance
   */
  public Processor createProcessor() {
    return new Processor(new Configuration());
  }
}

代码示例来源:origin: org.opengis.cite.teamengine/teamengine-core

public Engine() throws Exception {
  String s = System.getProperty("te.cacheSize");
  if (s != null) {
    cacheSize = Integer.parseInt(s);
  }
  // Create processor
  processor = new Processor(false);
  // Modify its configuration settings
  Configuration config = processor.getUnderlyingConfiguration();
  config.setVersionWarning(false);
  // Use our custom error listener which reports line numbers in the CTL
  // source file
  errorListener = new TeErrorListener();
  config.setErrorListener(errorListener);
  // Create a compiler and document builder
  compiler = processor.newXsltCompiler();
  builder = processor.newDocumentBuilder();
  // Load an executable for the TECore.form method
  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  InputStream is = cl.getResourceAsStream("com/occamlab/te/formfn.xsl");
  formExecutable = compiler.compile(new StreamSource(is));
  // Fortify Mod: We are done with the InputStream.  Release the resource
  is.close();
}

代码示例来源:origin: gradle.plugin.com.simonscholz/report-aggregator-gradle

private void generateAggregatedHtmlReport(File xmlFile, File outputDir) throws SaxonApiException {
  Processor proc = new Processor(false);
  XsltCompiler comp = proc.newXsltCompiler();
  InputStream xsl = getClass().getClassLoader().getResourceAsStream("spotbugs/html-aggregated.xsl");
  XsltExecutable exp = comp.compile(new StreamSource(xsl));
  XdmNode source = proc.newDocumentBuilder().build(new StreamSource(xmlFile));
  Serializer out = proc.newSerializer(new File(outputDir, "SpotBugsAggregated.html"));
  out.setOutputProperty(Serializer.Property.METHOD, "html");
  out.setOutputProperty(Serializer.Property.INDENT, "yes");
  XsltTransformer trans = exp.load();
  trans.setInitialContextNode(source);
  trans.setDestination(out);
  trans.transform();
}

代码示例来源:origin: codice/ddf

public XpathFilterCollector(String query) {
 xpath = query;
 config = new Config();
 Processor processor = new Processor(config);
 XPathCompiler compiler = processor.newXPathCompiler();
 try {
  selector = compiler.compile(xpath).load();
 } catch (SaxonApiException e) {
  throw new SolrException(
    SolrException.ErrorCode.BAD_REQUEST, "Unable to compile xpath: " + query, e);
 }
}

代码示例来源:origin: ndw/xmlcalabash1

public void run() throws SaxonApiException {
  Processor saxon = new Processor(false);
  XProcConfiguration config = new XProcConfiguration(saxon);
  XProcRuntime runtime = new XProcRuntime(config);
  InputStream stream = new ByteArrayInputStream(pipeline_xml.getBytes());
  DocumentBuilder builder = saxon.newDocumentBuilder();
  XdmNode pipeline_doc = builder.build(new SAXSource(new InputSource(stream)));
  XPipeline pipeline = runtime.use(pipeline_doc);
  pipeline.run();
}

代码示例来源:origin: com.cloudera.cdk/cdk-morphlines-saxon

public SaxonCommand(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
 super(builder, config, parent, child, context);
 
 this.isTracing = getConfigs().getBoolean(config, "isTracing", false);
 boolean isLicensedSaxonEdition = getConfigs().getBoolean(config, "isLicensedSaxonEdition", false);
 this.processor = new Processor(isLicensedSaxonEdition);
 this.documentBuilder = processor.newDocumentBuilder();
 
 Config features = getConfigs().getConfig(config, "features", ConfigFactory.empty());
 for (Map.Entry<String, Object> entry : new Configs().getEntrySet(features)) {
  processor.setConfigurationProperty(entry.getKey(), entry.getValue());
 }
}

代码示例来源:origin: gradle.plugin.com.simonscholz/report-aggregator-gradle

public void aggregateSpotBugsFiles(File rootDir, int level, File outputDir)
    throws FileNotFoundException, IOException, SaxonApiException {
  List<File> spotBugsFiles = getSpotBugsFiles(rootDir, level);
  Processor proc = new Processor(false);
  XsltCompiler comp = proc.newXsltCompiler();
  InputStream xsl = getClass().getClassLoader().getResourceAsStream("spotbugs/xml-aggregated.xsl");
  XsltExecutable exp = comp.compile(new StreamSource(xsl));
  Serializer out = proc.newSerializer(new File(outputDir, "SpotBugsAggregated.xml"));
  out.setOutputProperty(Serializer.Property.METHOD, "xml");
  out.setOutputProperty(Serializer.Property.INDENT, "yes");
  XsltTransformer trans = exp.load();
  List<XdmNode> sources = createXdmNodes(spotBugsFiles, proc.newDocumentBuilder());
  QName xmlFiles = new QName("xmlFiles");
  XdmValue filesXdm = XdmValue.makeSequence(sources);
  trans.setParameter(xmlFiles, filesXdm);
  trans.setInitialTemplate(new QName("test"));
  trans.setDestination(out);
  trans.transform();
}

代码示例来源:origin: org.apache.nifi/nifi-standard-processors

@Override
  public ValidationResult validate(final String subject, final String input, final ValidationContext validationContext) {
    try {
      final Processor proc = new Processor(false);
      final XQueryCompiler comp = proc.newXQueryCompiler();
      String error = null;
      try {
        comp.compile(input);
      } catch (final Exception e) {
        error = e.toString();
      }
      return new ValidationResult.Builder().input(input).subject(subject).valid(error == null).explanation(error).build();
    } catch (final Exception e) {
      return new ValidationResult.Builder().input(input).subject(subject).valid(false)
          .explanation("Unable to initialize XQuery engine due to " + e.toString()).build();
    }
  }
}

相关文章