/** * Create an IndependentContext along with a new (non-schema-aware) Saxon Configuration */ public IndependentContext() { this(new Configuration()); }
/** * Set the error event listener for the TransformerFactory, which * is used for the processing of transformation instructions, * and not for the transformation itself. * * @param listener The new error listener. * @throws IllegalArgumentException if listener is null. */ public void setErrorListener(ErrorListener listener) throws IllegalArgumentException { config.setErrorListener(listener); }
/** * Create the node factory for representing an XSLT stylesheet as a tree structure * * @param config the Saxon configuration * @param compilation the compilation episode (compiling one package) */ public StyleNodeFactory(Configuration config, Compilation compilation) { this.config = config; this.compilation = compilation; namePool = config.getNamePool(); }
/** * Simple interface to load a schema document * * @param absoluteURI the absolute URI of the location of the schema document * @throws net.sf.saxon.type.SchemaException if the schema document at the given location cannot be read or is invalid */ public void loadSchema(String absoluteURI) throws SchemaException { readSchema(makePipelineConfiguration(), "", absoluteURI, null); }
public Builder(PipelineConfiguration pipe) { this.pipe = pipe; config = pipe.getConfiguration(); lineNumbering = config.isLineNumbering(); namePool = config.getNamePool(); }
public BasicTransformerFactory() { Configuration config = new Configuration(); config.setProcessor(this); setConfiguration(config); }
/** * Main method for testing only * @param args not used * @throws Exception */ public static void main(String[] args) throws Exception { Configuration config = new Configuration(); DocumentInfo doc = config.buildDocument(new StreamSource(new File("c:/MyJava/samples/data/books.xml"))); EventIterator e = new Decomposer(new SingletonEventIterator(doc), config); SequenceIterator iter = new SequenceComposer(e, config.makePipelineConfiguration()); while (true) { NodeInfo item = (NodeInfo)iter.next(); if (item == null) { break; } System.out.println(QueryResult.serialize(item)); } } }
/** * Creates an evaluator that uses the provided objects to evaluate queries. * @param compiler queries are compiled using this * @param searcher search operations required by evaluated queries are carried out using this * @param docWriter this writer is used to modify the index (write, delete documents). It must * be tied to the same index as the searcher. */ public Evaluator(Compiler compiler, LuxSearcher searcher, DocWriter docWriter) { this.compiler = compiler; this.searcher = searcher; builder = compiler.getProcessor().newDocumentBuilder(); Configuration config = compiler.getProcessor().getUnderlyingConfiguration(); if (searcher != null) { docReader = new CachingDocReader(builder, config, compiler.getIndexConfiguration()); } else { docReader = null; } this.docWriter = docWriter; queryStats = new QueryStats(); errorListener = new TransformErrorListener(); errorListener.setUserData(this); // TODO: move these out of here; they should be one-time setup for the Processor config.setCollectionURIResolver(new LuxCollectionURIResolver()); config.setOutputURIResolver(new LuxOutputURIResolver()); if (config.getURIResolver() == null || !(config.getURIResolver() instanceof LuxURIResolver)) { config.setURIResolver(new LuxURIResolver(config.getSystemURIResolver(), this, compiler.getIndexConfiguration().getFieldName(FieldRole.URI))); } }
public ValueRepresentation convert(Object object, XPathContext context) throws XPathException { return context.getConfiguration().buildDocument((Source)object); }
@Override public void setRepository(SchemaRepository xRepo) { super.setRepository(xRepo); clnFinder = new CollectionFinderImpl((com.bagri.core.server.api.SchemaRepository) xRepo); config.setCollectionFinder(clnFinder); config.setDefaultCollection(""); //config.setConfigurationProperty(FeatureKeys., value); //config.setConfigurationProperty(FeatureKeys.PRE_EVALUATE_DOC_FUNCTION, Boolean.TRUE); SourceResolverImpl sResolver = new SourceResolverImpl(xRepo, config); config.setSourceResolver(sResolver); //config.registerExternalObjectModel(sResolver); config.setURIResolver(sResolver); ModuleURIResolver mResolver = new ModuleURIResolverImpl((com.bagri.core.server.api.SchemaRepository) xRepo); config.setModuleURIResolver(mResolver); //dqc.setUnparsedTextURIResolver(sResolver); //config.setCompileWithTracing(logger.isDebugEnabled()); //sqc.setCodeInjector(new CodeInjectorImpl()); }
XmlObjectXQueryEvaluatorImpl(DefaultNamespaceContext namespaceContext) { this.configuration = new Configuration(); staticQueryContext = configuration.newStaticQueryContext(); for (Map.Entry<String, String> namespaceBinding : namespaceContext.getNamespaces().entrySet()) { staticQueryContext.declareNamespace(namespaceBinding.getKey(), namespaceBinding.getValue()); } }
public void start() throws Exception { super.start(); Configuration config = getConfiguration(); if (config == null) { config = new Configuration(); } config.setHostLanguage(Configuration.XQUERY); setConfiguration(config); staticEnv = new StaticQueryContext(config); exp = compileQuery(); }
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(); }
public SaxonXQueryExpression(String xQueryString, XMLNamespaces namespaces, List<DerivedColumn> passing, List<XMLTable.XMLColumn> columns) throws QueryResolverException { config.setErrorListener(ERROR_LISTENER); this.xQueryString = xQueryString; StaticQueryContext context = config.newStaticQueryContext(); IndependentContext ic = new IndependentContext(config); namespaceMap.put(EMPTY_STRING, EMPTY_STRING);
/** * Set the Configuration that contains this document * * @param config the Saxon configuration */ public void setConfiguration(/*@NotNull*/ Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
config.setSourceParserClass("org.apache.xml.resolver.tools.ResolvingXMLReader"); config.setStyleParserClass("org.apache.xml.resolver.tools.ResolvingXMLReader"); try { config.setURIResolver(config.makeURIResolver("org.apache.xml.resolver.tools.CatalogResolver")); } catch (TransformerException err) { throw XPathException.makeXPathException(err);
/** * Set a configuration option * @param name the name of the option to be set. The names of the options available are listed * as constants in class {@link net.sf.saxon.FeatureKeys} * @param value the value of the option to be set. The type of the value depends on the option * that is being set * @throws IllegalArgumentException if the property name is not recognized */ // TODO: make this a typesafe method public void setConfigurationProperty(String name, Object value) { config.setConfigurationProperty(name, value); }
/** * Protected constructor * @param processor the Saxon processor */ protected XsltCompiler(Processor processor) { this.processor = processor; this.config = processor.getUnderlyingConfiguration(); compilerInfo = new CompilerInfo(); compilerInfo.setURIResolver(config.getURIResolver()); compilerInfo.setErrorListener(config.getErrorListener()); compilerInfo.setCompileWithTracing(config.isCompileWithTracing()); }
/** * Get the type hierarchy cache * * @return the type hierarchy cache */ public TypeHierarchy getTypeHierarchy() { return config.getTypeHierarchy(); }
/** * Get a Builder suitable for building nodes that can be attached to this document. * * @return a new TreeBuilder */ /*@NotNull*/ public Builder newBuilder() { LinkedTreeBuilder builder = new LinkedTreeBuilder(config.makePipelineConfiguration()); builder.setAllocateSequenceNumbers(false); return builder; }