Package net.sf.saxon.om

Examples of net.sf.saxon.om.DocumentInfo


                if (source == null) {
                    // indicate it was not possible to convert to a Source type
                    throw new NoTypeConversionAvailableException(body, Source.class);
                }

                DocumentInfo doc = getStaticQueryContext().buildDocument(source);
                dynamicQueryContext.setContextItem(doc);
            } finally {
                // can deal if is is null
                IOHelper.close(is);
            }
View Full Code Here


        } else {
            Source source = in.getBody(Source.class);
            if (source == null) {
                source = converter.toSource(converter.createDocument());
            }
            DocumentInfo doc = getStaticQueryContext().buildDocument(source);
            dynamicQueryContext.setContextItem(doc);
        }
       
        configureQuery(dynamicQueryContext, exchange);
        // call the reset if the in message body is StreamCache
View Full Code Here

        Source source = exchange.getIn().getBody(Source.class);
        if (source == null) {
            source = converter.toSource(converter.createDocument());
        }

        DocumentInfo doc = getStaticQueryContext().buildDocument(source);
        dynamicQueryContext.setContextItem(doc);
        configureQuery(dynamicQueryContext, exchange);
        return dynamicQueryContext;
    }
View Full Code Here

                } else {
                    System.err.println("Source document supplied, but query does not access the context item");
                }
            }
            if (sourceInput != null) {
                DocumentInfo doc = config.buildDocument(sourceInput);
                dynamicEnv.setContextItem(doc);
            }
        }
    }
View Full Code Here

    protected void runQuery(XQueryExpression exp, DynamicQueryContext dynamicEnv,
                            OutputStream destination, Properties outputProps)
            throws XPathException, IOException {
        if (wrap && !pullMode) {
            SequenceIterator results = exp.iterator(dynamicEnv);
            DocumentInfo resultDoc = QueryResult.wrap(results, config);
            QueryResult.serialize(resultDoc,
                    new StreamResult(destination),
                    outputProps);
            destination.close();
        } else if (pullMode) {
View Full Code Here

                return new QNameValue(q.getPrefix(), q.getNamespaceURI(), q.getLocalPart(),
                        BuiltInAtomicType.QNAME, null);
            } else if (value instanceof Node) {
                //return (Item)(new DOMObjectModel().convertObjectToXPathValue(value, config));
                DOMObjectModel model = new DOMObjectModel();
                DocumentInfo wrapper = model.wrapDocument(value, "", config);
                NodeInfo node = model.wrapNode(wrapper, value);
                return node;
            } else if (value instanceof Source) {
                // Saxon extension to the XQJ specification
                Builder b = new TinyBuilder();
View Full Code Here

    * the transformation of the constructed document
    */

    public void endDocument() throws SAXException {
        super.endDocument();
        DocumentInfo doc = (DocumentInfo)builder.getCurrentRoot();
        if (doc==null) {
            throw new SAXException("No source document has been built");
        }

        try {
View Full Code Here

      * @since DOM Level 2
      */

     public Element getElementById(String elementId) {
         // Defined on Document node; but we support it on any node.
         DocumentInfo doc = node.getDocumentRoot();
         if (doc == null) {
             return null;
         }
         return (Element)wrap(doc.selectID(elementId));
     }
View Full Code Here

    public boolean matches(NodeInfo e, XPathContext context) throws XPathException {
        if (e.getNodeKind() != Type.ELEMENT) {
            return false;
        }
        DocumentInfo doc = e.getDocumentRoot();
        if (doc==null) {
            return false;
        }
        AtomicValue idValue = (AtomicValue)idExpression.evaluateItem(context);
        if (idValue == null) {
            return false;
        }
        String ids = idValue.getStringValue();
        if (ids.indexOf(' ') < 0 &&
                ids.indexOf(0x09) < 0 &&
                ids.indexOf(0x0a) < 0 &&
                ids.indexOf(0x0c) < 0) {
            NodeInfo element = doc.selectID(ids);
            if (element==null) return false;
            return (element.isSameNodeInfo(e));
        } else {
            StringTokenizer tokenizer = new StringTokenizer(ids, " \t\n\r", false);
            while (tokenizer.hasMoreElements()) {
                String id = (String)tokenizer.nextElement();
                NodeInfo element = doc.selectID(id);
                if (element != null && e.isSameNodeInfo(element)) {
                    return true;
                }
            }
            return false;
View Full Code Here

        Item current = context.getContextItem();
        if (current==null) {
            dynamicError("Finding root of tree: the context item is undefined", "XPDY0002", context);
        }
        if (current instanceof NodeInfo) {
            DocumentInfo doc = ((NodeInfo)current).getDocumentRoot();
            if (doc==null) {
                dynamicError("The root of the tree containing the context item is not a document node", "XPDY0050", context);
            }
            return doc;
        }
View Full Code Here

TOP

Related Classes of net.sf.saxon.om.DocumentInfo

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.