Examples of JPConverter


Examples of org.pdf4j.saxon.expr.JPConverter

        }
    }

    public JPConverter getJPConverter(Class targetClass) {
        if (isRecognizedNodeClass(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
                    return convertObjectToXPathValue(object, context.getConfiguration());
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

    }


    public JPConverter getJPConverter(Class targetClass) {
        if (isRecognizedNodeClass(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
                    return convertObjectToXPathValue(object, context.getConfiguration());
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

    }


    public JPConverter getJPConverter(Class targetClass) {
        if (Node.class.isAssignableFrom(targetClass) && !(NodeOverNodeInfo.class.isAssignableFrom(targetClass))) {
            return new JPConverter() {
                public ValueRepresentation convert(Object obj, XPathContext context) throws XPathException {
                    return wrapOrUnwrapNode((Node)obj, context.getConfiguration());
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
                }
            };
        } else if (NodeList.class.isAssignableFrom(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object obj, XPathContext context) throws XPathException {
                    Configuration config = context.getConfiguration();
                    NodeList list = ((NodeList)obj);
                    final int len = list.getLength();
                    NodeInfo[] nodes = new NodeInfo[len];
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

        }
    }

    public JPConverter getJPConverter(Class targetClass) {
        if (NodeOverNodeInfo.class.isAssignableFrom(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
                    return convertObjectToXPathValue(object, context.getConfiguration());
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

        }
    }

    public JPConverter getJPConverter(Class targetClass) {
        if (isRecognizedNodeClass(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
                    return unwrapXdmValue(object);
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

     * the required code is not on the class path
     */

    public XdmNode wrap(Object node) throws IllegalArgumentException {
         try {
             JPConverter converter = JPConverter.allocate(node.getClass(), config);
             NodeInfo nodeInfo = (NodeInfo)converter.convert(node, new EarlyEvaluationContext(config, null));
             return (XdmNode)XdmItem.wrapItem(nodeInfo);
         } catch (XPathException e) {
             throw new IllegalArgumentException(e.getMessage());
         }
    }
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

        }
    }

    public JPConverter getJPConverter(Class targetClass) {
        if (isRecognizedNodeClass(targetClass)) {
            return new JPConverter() {
                public ValueRepresentation convert(Object object, XPathContext context) throws XPathException {
                    return convertObjectToXPathValue(object, context.getConfiguration());
                }
                public ItemType getItemType() {
                    return AnyNodeTest.getInstance();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

            } else if (value instanceof QName) {
                QName q = (QName)value;
                return new QNameValue(q.getPrefix(), q.getNamespaceURI(), q.getLocalPart(),
                        BuiltInAtomicType.QNAME, null);
            } else if (value instanceof Node) {
                JPConverter jp = DOMObjectModel.getInstance().getJPConverter(Node.class);
                return Value.asItem(jp.convert(value, new EarlyEvaluationContext(config, null)));
                //return Value.asItem(DOMObjectModel.getInstance().convertObjectToXPathValue(value, config));
            } else if (value instanceof Source) {
                // Saxon extension to the XQJ specification
                Builder b = new TinyBuilder();
                PipelineConfiguration pipe = config.makePipelineConfiguration();
View Full Code Here

Examples of org.pdf4j.saxon.expr.JPConverter

    public XQItem createItemFromNode(Node value, XQItemType type) throws XQException {
        checkNotClosed();
        SaxonXQDataSource.checkNotNull(value, "value");
        try {
            JPConverter jp = DOMObjectModel.getInstance().getJPConverter(Node.class);
            NodeInfo n = (NodeInfo)jp.convert(value, new EarlyEvaluationContext(getConfiguration(), null));
            //NodeInfo n = DOMObjectModel.getInstance().wrapOrUnwrapNode(value, getConfiguration());
            XQItem result = new SaxonXQItem(n, this);
            if (type != null && !result.instanceOf(type)) {
                throw new XQException("The node is not a valid instance of the required type");
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.