Package net.sf.saxon.event

Examples of net.sf.saxon.event.Receiver


        }
        Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "xml");
        props.setProperty(OutputKeys.INDENT, "yes");
        props.setProperty(SaxonOutputKeys.INDENT_SPACES, "2");
        Receiver diag = config.getSerializerFactory().getReceiver(
                new StreamResult(explainOutput),
                config.makePipelineConfiguration(),
                props);
        ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag);
        exp.explain(expressionPresenter);
View Full Code Here


                // -- Execute Statement
                rs = ps.executeQuery();

                // -- Print out Result
                Receiver out = context.getReceiver();
                String result = "";
                int icol = rs.getMetaData().getColumnCount();
                while (rs.next()) {                            // next row
                    //System.out.print("<- SQL : "+ rowStart);
                    out.startElement(rowCode, StandardNames.XS_UNTYPED, locationId, 0);
                    for (int col = 1; col <= icol; col++) {     // next column
                        // Read result from RS only once, because
                        // of JDBC-Specifications
                        result = rs.getString(col);
                        out.startElement(colCode, StandardNames.XS_UNTYPED, locationId, 0);
                        if (result != null) {
                            out.characters(result, locationId, options);
                        }
                        out.endElement();
                    }
                    //System.out.println(rowEnd);
                    out.endElement();
                }
                //rs.close();

                if (!connection.getAutoCommit()) {
                    connection.commit();
View Full Code Here

    private void writeItemToResult(Result result, Properties props) throws XQException {
        try {
            SerializerFactory sf = config.getSerializerFactory();
            PipelineConfiguration pipe = config.makePipelineConfiguration();
            Receiver out = sf.getReceiver(result, pipe, props);
            TreeReceiver tr = new TreeReceiver(out);
            tr.open();
            tr.append(item, 0, NodeInfo.ALL_NAMESPACES);
            tr.close();
        } catch (XPathException e) {
View Full Code Here

                        }
                        Properties props = new Properties();
                        props.setProperty(OutputKeys.METHOD, "xml");
                        props.setProperty(OutputKeys.INDENT, "yes");
                        props.setProperty(SaxonOutputKeys.INDENT_SPACES, "2");
                        Receiver diag = config.getSerializerFactory().getReceiver(
                                new StreamResult(explainOutput),
                                config.makePipelineConfiguration(),
                                props);
                        ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag);
                        sheet.explain(expressionPresenter);
View Full Code Here

     * XML document
     */

    public void exportComponents(Destination destination) throws SaxonApiException {
        try {
            Receiver out = destination.getReceiver(config);
            SchemaModelSerializer serializer = new SchemaModelSerializer(config, out);
            serializer.serialize();
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
View Full Code Here

            if (source instanceof NodeInfo || source instanceof DOMSource) {
                NodeInfo startNode = controller.prepareInputTree(source);
                newdoc = startNode.getDocumentRoot();
            } else {
                Builder b = controller.makeBuilder();
                Receiver s = b;
                source = AugmentedSource.makeAugmentedSource(source);
                ((AugmentedSource)source).setStripSpace(Whitespace.XSLT);
                if (controller.getExecutable().stripsInputTypeAnnotations()) {
                    s = controller.getConfiguration().getAnnotationStripper(s);
                }
View Full Code Here

     * or xsi:noNamespaceSchemaLocation attributes
     * @throws SaxonApiException if the source document is found to be invalid
     */

    public void validate(Source source) throws SaxonApiException {
        Receiver receiver = getReceiver(config, source.getSystemId());
        PipelineConfiguration pipe = receiver.getPipelineConfiguration();
        try {
            new Sender(pipe).send(source, receiver, true);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
View Full Code Here

    private Receiver getReceiver(Configuration config, String systemId) throws SaxonApiException {
        PipelineConfiguration pipe = config.makePipelineConfiguration();
        pipe.setExpandAttributeDefaults(expandAttributeDefaults);

        Receiver output = (destination == null ? new Sink() : destination.getReceiver(config));
        output.setPipelineConfiguration(pipe);

        int topLevelElement = -1;
        if (documentElementName != null) {
            topLevelElement = config.getNamePool().allocate(
                    "", documentElementName.getNamespaceURI(), documentElementName.getLocalName());
        }
        Receiver receiver = config.getDocumentValidator(
                output,
                systemId,
                (lax ? Validation.LAX : Validation.STRICT) | Validation.VALIDATE_OUTPUT,
                Whitespace.NONE,
                documentElementType,
View Full Code Here

                            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);
View Full Code Here

        Controller controller = context.getController();
        XPathContext c2 = context.newMinorContext();
        c2.setOrigin(this);
        SequenceReceiver out = c2.getReceiver();
        TinyBuilder builder = new TinyBuilder();
        Receiver receiver = builder;
        PipelineConfiguration pipe = controller.makePipelineConfiguration();
        pipe.setHostLanguage(getContainer().getHostLanguage());
        receiver.setPipelineConfiguration(pipe);
        receiver.open();
        receiver.startDocument(0);
        c2.changeOutputDestination(null, receiver, false, getHostLanguage(), Validation.PRESERVE, null);
        content.process(c2);
        receiver.endDocument();
        receiver.close();
        DocumentInfo dtdRoot = (DocumentInfo)builder.getCurrentRoot();

        SequenceIterator children = dtdRoot.iterateAxis(Axis.CHILD);
        NodeInfo docType = (NodeInfo)children.next();
        if (docType == null || !("doctype".equals(docType.getLocalPart()))) {
View Full Code Here

TOP

Related Classes of net.sf.saxon.event.Receiver

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.