Package net.sf.saxon.event

Examples of net.sf.saxon.event.SerializerFactory


    public void serialize(PullProvider in, OutputStream out) throws XPathException, IOException {
        Properties props = new Properties();
        props.setProperty(OutputKeys.METHOD, "xml");
        props.setProperty(OutputKeys.INDENT, "yes");
        SerializerFactory sf = config.getSerializerFactory();
        Receiver receiver = sf.getReceiver(new StreamResult(out),
                                                        in.getPipelineConfiguration(),
                                                        props);
        new PullPushCopier(in, receiver).copy();
    }
View Full Code Here


        if (props == null) {
            props = new Properties();
        }
        props = SaxonXQSequence.setDefaultProperties(props);
        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

    protected Receiver getReceiver(Configuration config,
                                   Controller controller,
                                   Properties predefinedProperties) throws SaxonApiException {
        try {
            SerializerFactory sf = config.getSerializerFactory();
            PipelineConfiguration pipe =
                    (controller == null ? config.makePipelineConfiguration() :
                                          controller.makePipelineConfiguration());
                    // A controller is needed for processing character maps
            Properties props  = new Properties();
            for (Property p : properties.keySet()) {
                String value = properties.get(p);
                props.setProperty(p.toString(), value);
            }
            if (predefinedProperties != null) {
                Enumeration eps = predefinedProperties.propertyNames();
                while (eps.hasMoreElements()) {
                    String name = (String)eps.nextElement();
                    String value = predefinedProperties.getProperty(name);
                    if (props.getProperty(name) == null) {
                        props.setProperty(name, value);
                    } else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) || name.equals(SaxonOutputKeys.SUPPRESS_INDENTATION)) {
                        props.setProperty(name, props.getProperty(name) + " " + value);
                    }
                }
            }
            return sf.getReceiver(result, pipe, props);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
    }
View Full Code Here

        writeItemToResult(result, new Properties());
    }

    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

            result = new StreamResult(System.out);
        }
        try {
            Properties props = controller.getOutputProperties();
            PipelineConfiguration pipe = controller.makePipelineConfiguration();
            SerializerFactory sf = getConfiguration().getSerializerFactory();
            setReceiver(sf.getReceiver(result, pipe, props));
            setPipelineConfiguration(pipe);
        } catch (XPathException err) {
            throw new SAXException(err);
        }
        super.startDocument();
View Full Code Here

     * @return a receiver to which XML events will be sent
     */

    public Receiver getReceiver(Configuration config) throws SaxonApiException {
        try {
            SerializerFactory sf = config.getSerializerFactory();
            PipelineConfiguration pipe = config.makePipelineConfiguration();
            Properties props  = new Properties();
            for (Property p : properties.keySet()) {
                String value = properties.get(p);
                props.setProperty(p.toString(), value);
            }
            return sf.getReceiver(result, pipe, props);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
    }
View Full Code Here

TOP

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

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.