Package org.dom4j.io

Examples of org.dom4j.io.DocumentSource


    Transformer transformer = factory.newTransformer(
        new StreamSource(stylesheet)
    );

    // now lets style the given document
    DocumentSource source = new DocumentSource(doc);
    DocumentResult result = new DocumentResult();
    transformer.transform( source, result );

    // return the transformed document
    Document transformedDoc = result.getDocument();
View Full Code Here


    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new StreamSource(
        stylesheet));

    // now lets style the given document
    DocumentSource source = new DocumentSource(doc);
    DocumentResult result = new DocumentResult();
    transformer.transform(source, result);

    // return the transformed document
    Document transformedDoc = result.getDocument();
View Full Code Here

                return new StreamSource(new StringReader((String) src));
            }
        }
        else if (src instanceof org.dom4j.Document)
        {
            return new DocumentSource((org.dom4j.Document) src);
        }
        else if (src instanceof org.xml.sax.InputSource)
        {
            return new SAXSource((InputSource) src);
        }
View Full Code Here

        Transformer transformer = factory.newTransformer(new StreamSource(
                getFile(xsl)));

        // now lets create the TrAX source and result
        // objects and do the transformation
        Source source = new DocumentSource(document);
        DocumentResult result = new DocumentResult();
        transformer.transform(source, result);

        return result.getDocument();
    }
View Full Code Here

        // load a default transformer
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();

        // use dom4j document as the source
        Source source = new DocumentSource(document);

        // use pretty print format and a buffer for the result
        OutputFormat format = OutputFormat.createCompactFormat();
        StringWriter buffer = new StringWriter();
        Result result = new XMLResult(buffer, format);
View Full Code Here

        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();

        StringWriter buffer = new StringWriter();
        StreamResult streamResult = new StreamResult(buffer);
        DocumentSource documentSource = new DocumentSource(document);

        transformer.transform(documentSource, streamResult);

        // now lets parse it back again via JAXP
        DocumentResult documentResult = new DocumentResult();
View Full Code Here

            // return original document
            return document;
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();

        try
        {
            transformer.transform( source, result );
View Full Code Here

            // return original document
            return document;
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();

        try
        {
            transformer.transform( source, result );
View Full Code Here

            // return original document
            return document;
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();
       
        try
        {
            transformer.transform( source, result );
View Full Code Here

        //Setup the transformer to pretty-print the output
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
       
        try {
            transformer.transform(new DocumentSource(data.second), result);
        }
        catch (TransformerException e) {
            throw new RuntimeException("Failed to write Element to Result for: " + data.first, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.dom4j.io.DocumentSource

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.