Package net.sf.saxon

Examples of net.sf.saxon.Configuration


*/
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


            throw new XQueryInvokationException("No java method for operation: " + operation.getName());
        }
        String xqExpression =
            implementation.getXqExpression() + implementation.getXqExpressionExtensionsMap().get(theMethod);

        Configuration config = null;
        Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "xml");
        props.setProperty(OutputKeys.INDENT, "yes");

        XQueryExpression exp = implementation.getCompiledExpressionsCache().get(xqExpression);
        if (exp == null) {
            config = new Configuration();
            StaticQueryContext sqc = new StaticQueryContext(config);
            exp = sqc.compileQuery(xqExpression);
            implementation.getCompiledExpressionsCache().put(xqExpression, exp);
        } else {
            config = exp.getStaticContext().getConfiguration();
        }

        Object[] params = prepareParameters(payload, config, props);

        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);

        // Setting the parameters for function invokation
        String methodName = theMethod.getName();
        for (int i = 0; i < params.length; i++) {
            dynamicContext.setParameter(methodName + "_" + i, params[i]);
        }

        // Setting references
        for (Map.Entry<String, Object> entry : referenceProxies.entrySet()) {
            dynamicContext.setParameter(entry.getKey(), entry.getValue());
        }

        // Setting properties
        for (Map.Entry<String, Object> entry : properties.entrySet()) {
            dynamicContext.setParameter(entry.getKey(), transformProperty(entry.getValue(), config));
        }

        SequenceIterator iterator = null;
        Configuration oldConfigValue = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = config;
        try {
            iterator = exp.iterator(dynamicContext);
        } finally {
            SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = oldConfigValue;
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();

        Item item = in.getBody(Item.class);
View Full Code Here

     */
    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);
            configuration = new Configuration();
            configuration.setHostLanguage(Configuration.XQUERY);
            configuration.setStripsWhiteSpace(isStripsAllWhiteSpace() ? Whitespace.ALL : Whitespace.IGNORABLE);

            staticQueryContext = new StaticQueryContext(getConfiguration());
            if (moduleURIResolver != null) {
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);
View Full Code Here

            throw new XQueryInvokationException("No java method for operation: " + operation.getName());
        }
        String xqExpression =
            implementation.getXqExpression() + implementation.getXqExpressionExtensionsMap().get(theMethod);

        Configuration config = null;
        Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "xml");
        props.setProperty(OutputKeys.INDENT, "yes");

        XQueryExpression exp = implementation.getCompiledExpressionsCache().get(xqExpression);
        if (exp == null) {
            config = new Configuration();
            StaticQueryContext sqc = new StaticQueryContext(config);
            exp = sqc.compileQuery(xqExpression);
            implementation.getCompiledExpressionsCache().put(xqExpression, exp);
        } else {
            config = exp.getStaticContext().getConfiguration();
        }

        Object[] params = prepareParameters(payload, config, props);

        DynamicQueryContext dynamicContext = new DynamicQueryContext(config);

        // Setting the parameters for function invocation
        String methodName = theMethod.getName();
        for (int i = 0; i < params.length; i++) {
            dynamicContext.setParameter(methodName + "_" + i, params[i]);
        }

        // Setting references
        for (Map.Entry<String, Object> entry : referenceProxies.entrySet()) {
            dynamicContext.setParameter(entry.getKey(), entry.getValue());
        }

        // Setting properties
        for (Map.Entry<String, Object> entry : properties.entrySet()) {
            dynamicContext.setParameter(entry.getKey(), transformProperty(entry.getValue(), config));
        }

        SequenceIterator iterator = null;
        Configuration oldConfigValue = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
        SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = config;
        try {
            iterator = exp.iterator(dynamicContext);
        } finally {
            SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = oldConfigValue;
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();

        Item item = in.getBody(Item.class);
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

    /**
     * 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();

        Item item = in.getBody(Item.class);
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.