Package org.dom4j.io

Examples of org.dom4j.io.DocumentResult


        DocumentSource documentSource = new DocumentSource(document);

        transformer.transform(documentSource, streamResult);

        // now lets parse it back again via JAXP
        DocumentResult documentResult = new DocumentResult();
        StreamSource streamSource = new StreamSource(new StringReader(buffer
                .toString()));

        transformer.transform(streamSource, documentResult);

        Document newDocument = documentResult.getDocument();

        // lets ensure names are same
        newDocument.setName(document.getName());

        assertDocumentsEqual(document, newDocument);
View Full Code Here


            return document;
        }

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

        try
        {
            transformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            // return original document
            return document;
        }

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

            return document;
        }

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

        try
        {
            transformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            // return original document
            return document;
        }

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

            return document;
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();
       
        try
        {
            transformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            // return original document
            return document;
        }

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

        transformer = factory
            .newTransformer( new StreamSource( ApacheDSConfigurationPlugin.class.getResourceAsStream( "template.xslt" ) ) );

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

        transformer.transform( source, result );

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

            e1.printStackTrace();
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();
        try
        {
            transformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

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

            // Will never occur
        }

        // now lets style the given document
        DocumentSource source = new DocumentSource( document );
        DocumentResult result = new DocumentResult();
        try
        {
            transformer.transform( source, result );
        }
        catch ( TransformerException e )
        {
            // Will never occur
        }

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

   */
  private String transform(String input) throws DocumentException, TransformerException {
    SAXReader reader = new SAXReader();
    org.dom4j.Document nexmlDocument = reader.read( new ByteArrayInputStream(input.getBytes()) );
           
    DocumentResult cdaoResult = new DocumentResult();
   
    Transformer cdaoTransformer = TransformerFactory.newInstance().newTransformer( new StreamSource( "http://www.nexml.org/nexml/xslt/nexml2cdao.xsl"  ) );   
    cdaoTransformer.transform( new DocumentSource( nexmlDocument ), cdaoResult );
       
    org.dom4j.Document cdaoDoc = cdaoResult.getDocument();
    return cdaoDoc.asXML();   
  }
View Full Code Here

                    xslFile));

            long start = System.currentTimeMillis();
            for (ii = 0; ii < kk; ii++) {
                Source source = new DocumentSource(xmlDoc);
                DocumentResult result = new DocumentResult();
                transformer.transform(source, result);

                // output the transformed document
            }
            long end = System.currentTimeMillis();
View Full Code Here

                    xslFile));

            long start = System.currentTimeMillis();
            for (ii = 0; ii < kk; ii++) {
                Source source = new DocumentSource(xmlDoc);
                DocumentResult result = new DocumentResult();
                transformer.transform(source, result);

                // output the transformed document
            }
            long end = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.dom4j.io.DocumentResult

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.