Package net.sf.saxon.tinytree

Examples of net.sf.saxon.tinytree.TinyBuilder


                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();
                PipelineConfiguration pipe = config.makePipelineConfiguration();
                b.setPipelineConfiguration(pipe);
                new Sender(pipe).send((Source)value, b);
                return b.getCurrentRoot();
            } else if (value instanceof XMLStreamReader) {
                // Saxon extension to the XQJ specification
                StaxBridge bridge = new StaxBridge();
                bridge.setXMLStreamReader((XMLStreamReader)value);
                Builder b = new TinyBuilder();
                PipelineConfiguration pipe = config.makePipelineConfiguration();
                b.setPipelineConfiguration(pipe);
                new Sender(pipe).send(new PullSource(bridge), b);
                return b.getCurrentRoot();
            } else {
                throw new XPathException("Java object cannot be converted to an XQuery value");
            }
        } catch (XPathException e) {
            XQException xqe = new XQException(e.getMessage());
View Full Code Here


     * @return A new DOM Document object.
     */

    public Document parse(InputSource in) throws SAXException {
        try {
            Builder builder = new TinyBuilder();
            if (config == null) {
                config = new Configuration();
            }
            PipelineConfiguration pipe = config.makePipelineConfiguration();
            builder.setPipelineConfiguration(pipe);
            SAXSource source = new SAXSource(in);
            if (entityResolver != null) {
                XMLReader reader = source.getXMLReader();
                if (reader == null) {
                    reader = config.getSourceParser();
                }
                reader.setEntityResolver(entityResolver);
            }
            if (errorHandler != null) {
                XMLReader reader = source.getXMLReader();
                if (reader == null) {
                    reader = config.getSourceParser();
                }
                reader.setErrorHandler(errorHandler);
            }
            source.setSystemId(in.getSystemId());
            Source ss = source;
            if (xIncludeAware) {
                ss = AugmentedSource.makeAugmentedSource(ss);
                ((AugmentedSource)ss).setXIncludeAware(true);
            }
            if (validating) {
                ss = AugmentedSource.makeAugmentedSource(ss);
                ((AugmentedSource)ss).setDTDValidationMode(Validation.STRICT);
            }
            if (stripSpace != Whitespace.UNSPECIFIED) {
                ss = AugmentedSource.makeAugmentedSource(ss);
                ((AugmentedSource)ss).setStripSpace(stripSpace);
            }
            new Sender(pipe).send(source, builder);
            TinyDocumentImpl doc = (TinyDocumentImpl)builder.getCurrentRoot();
            return (Document)DocumentOverNodeInfo.wrap(doc);
        } catch (XPathException err) {
            throw new SAXException(err);
        }
    }
View Full Code Here

        if (treeModel == Builder.UNSPECIFIED_TREE_MODEL) {
            treeModel = this.treeModel;
        }
        if (treeModel==Builder.TINY_TREE)  {
            b = new TinyBuilder();
        } else {
            b = new TreeBuilder();
        }

        // Set builder properties
View Full Code Here

     */

    public Builder makeBuilder() {
        Builder b;
        if (treeModel==Builder.TINY_TREE)  {
            b = new TinyBuilder();
        } else {
            b = new TreeBuilder();
        }
        b.setTiming(config.isTiming());
        b.setLineNumbering(config.isLineNumbering());
View Full Code Here

     * @since 8.8
     */

    public static DocumentInfo wrap(SequenceIterator iterator, Configuration config) throws XPathException {
        PipelineConfiguration pipe = config.makePipelineConfiguration();
        TinyBuilder builder = new TinyBuilder();
        builder.setPipelineConfiguration(pipe);
        NamespaceReducer reducer = new NamespaceReducer();
        reducer.setUnderlyingReceiver(builder);
        reducer.setPipelineConfiguration(pipe);
        ComplexContentOutputter outputter = new ComplexContentOutputter();
        outputter.setPipelineConfiguration(pipe);
        outputter.setReceiver(reducer);
        sendWrappedSequence(iterator, outputter);
        return (DocumentInfo)builder.getCurrentRoot();
    }
View Full Code Here

                            SaxonErrorCode.SXXP0004);
                }
                return new SingletonNode(node);
            }
            try {
                Builder b = new TinyBuilder();
                PipelineConfiguration pipe = config.makePipelineConfiguration();
                b.setPipelineConfiguration(pipe);
                new Sender(pipe).send((Source)object, b);
                if (object instanceof AugmentedSource && ((AugmentedSource)object).isPleaseCloseAfterUse()) {
                     ((AugmentedSource)object).close();
                }
                return new SingletonNode(b.getCurrentRoot());
            } catch (XPathException err) {
                throw new XPathException(err);
            }
        } else {
            // See whether this is an object representing a Node in some recognized object model
View Full Code Here

public class XdmDestination implements Destination {

    TinyBuilder builder;

    public XdmDestination() {
        builder = new TinyBuilder();
    }
View Full Code Here

    /**
     * Allow the <code>XdmDestination</code> to be reused
     */

    public void reset() {
        builder = new TinyBuilder();
    }
View Full Code Here

            } else {
                try {
                    XPathContext c2 = context.newMinorContext();
                    c2.setOrigin(this);

                    TinyBuilder builder = new TinyBuilder();
                    //builder.setSizeParameters(treeSizeParameters);
                    builder.setLineNumbering(controller.getConfiguration().isLineNumbering());

                    //receiver.setSystemId(getBaseURI());
                    builder.setBaseURI(getBaseURI());

                    PipelineConfiguration pipe = controller.makePipelineConfiguration();
                    pipe.setHostLanguage(getHostLanguage());
                    //pipe.setBaseURI(baseURI);
                    builder.setPipelineConfiguration(pipe);

                    c2.changeOutputDestination(null,
                            builder,
                            false,
                            getHostLanguage(),
                            validation,
                            getSchemaType());
                    Receiver out = c2.getReceiver();
                    out.open();
                    out.startDocument(0);

                    content.process(c2);

                    out.endDocument();
                    out.close();

                    root = (DocumentInfo)builder.getCurrentRoot();
                } catch (XPathException e) {
                    e.maybeSetLocation(this);
                    e.maybeSetContext(context);
                    throw e;
                }
View Full Code Here

        if (source == null) {
            return null;
        }
        try {
            Transformer transformer = templates.newTransformer();
            TinyBuilder builder = new TinyBuilder();
            builder.setPipelineConfiguration(context.getController().makePipelineConfiguration());
            transformer.transform(source, builder);
            return (DocumentInfo)builder.getCurrentRoot();
        } catch (TransformerException e) {
            throw XPathException.makeXPathException(e);
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.saxon.tinytree.TinyBuilder

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.