Package net.sf.saxon

Examples of net.sf.saxon.Configuration


    protected synchronized void initialize(Exchange exchange) throws XPathException, IOException {
        // must use synchronized for concurrency issues and only let it initialize once
        if (!initialized.get()) {
            LOG.debug("Initializing XQueryBuilder {}", this);
            if (configuration == null) {
                configuration = new Configuration();
                configuration.setHostLanguage(Configuration.XQUERY);
                configuration.setStripsWhiteSpace(isStripsAllWhiteSpace() ? Whitespace.ALL : Whitespace.IGNORABLE);
                LOG.debug("Created new Configuration {}", configuration);
            } else {
                LOG.debug("Using existing Configuration {}", configuration);
View Full Code Here


        return expression;
    }

    public Configuration getConfiguration() {
        if (configuration == null) {
            configuration = new Configuration();
            configuration.setHostLanguage(Configuration.XQUERY);
        }
        return configuration;
    }
View Full Code Here

    /**
     * Creates a dynamic context for the given exchange
     */
    protected DynamicQueryContext createDynamicContext(E exchange) throws Exception {
        Configuration config = getConfiguration();
        DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

        Source source = exchange.getIn().getBody(Source.class);
        if (source == null) {
            source = converter.toSource(converter.createDocument());
View Full Code Here

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();

        conf = new Configuration();
        conf.registerExtensionFunction(new SimpleExtension());

        jndi.bind("saxonConf", conf);
        return jndi;
    }
View Full Code Here

*/
public class Node2NodeInfoTransformer extends BaseTransformer<Node, NodeInfo> implements
    PullTransformer<Node, NodeInfo> {

    public NodeInfo transform(Node source, TransformationContext context) {
        Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        if (configuration == null) {
            configuration = new Configuration();
        }
        NodeInfo docInfo = null;
        try {
            source = DOMHelper.promote(source);
            docInfo = Builder.build(new DOMSource(source), null, configuration);
View Full Code Here

        xqueryImplementation.setXqExpression(xqExpression);

        xqExpression += "\r\n<dummy></dummy>";

        Configuration config = new Configuration();
        StaticQueryContext sqc = new StaticQueryContext(config);
        XQueryExpression exp = null;
        try {
            exp = sqc.compileQuery(xqExpression);
        } catch (XPathException e) {
View Full Code Here

    /**
     * Creates a dynamic context for the given exchange
     */
    protected DynamicQueryContext createDynamicContext(Exchange exchange) throws Exception {
        Configuration config = getConfiguration();
        DynamicQueryContext dynamicQueryContext = new DynamicQueryContext(config);

        Message in = exchange.getIn();
        Source source = null;
        try {
View Full Code Here

        // must use synchronized for concurrency issues and only let it initialize once
        if (!initialized.get()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Initializing XQueryBuilder " + this);
            }
            configuration = new Configuration();
            configuration.setHostLanguage(Configuration.XQUERY);

            staticQueryContext = new StaticQueryContext(getConfiguration());
            Set<Map.Entry<String, String>> entries = namespacePrefixes.entrySet();
            for (Map.Entry<String, String> entry : entries) {
View Full Code Here

     * @param contextVar The name of the context variable
     * @param boundary The offset of the end of the prolog
     */
    public XBeansXQuery(String query, String contextVar, Integer boundary)
    {
        config = new Configuration();
        config.setDOMLevel(2);
        config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
        StaticQueryContext sc = new StaticQueryContext(config);
        this.contextVar = contextVar;
        int bdry = boundary.intValue();
View Full Code Here

    {
        try
        {
            Node contextNode = (Node)node;
            XPathEvaluator xpe = new XPathEvaluator();
            Configuration config = new Configuration();
            config.setDOMLevel(2);
            config.setTreeModel(net.sf.saxon.event.Builder.STANDARD_TREE);
            IndependentContext sc = new IndependentContext(config);
            // Declare ns bindings
            if (defaultNS != null)
                sc.setDefaultElementNamespace(defaultNS);

            for (int i = 0; i < namespaceMap.length; i++)
            {
                Map.Entry entry = (Map.Entry) namespaceMap[i];
                sc.declareNamespace((String) entry.getKey(),
                        (String) entry.getValue());
            }
            xpe.setStaticContext(sc);
            XPathVariable thisVar = xpe.declareVariable("", contextVar);
            XPathExpression xpath = xpe.createExpression(path);
            NodeInfo contextItem =
                //config.buildDocument(new DOMSource(contextNode));
                config.unravel(new DOMSource(contextNode));
            XPathDynamicContext dc = xpath.createDynamicContext(null);
            dc.setContextItem(contextItem);
            dc.setVariable(thisVar, contextItem);

            List saxonNodes = xpath.evaluate(dc);
View Full Code Here

TOP

Related Classes of net.sf.saxon.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.