Package javax.xml.transform.stream

Examples of javax.xml.transform.stream.StreamResult


  public static void writeXmlFile(Document doc, File file, boolean indent, String encoding) throws TransformerFactoryConfigurationError, TransformerException {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);

    // Prepare the output file
    Result result = new StreamResult(file);

    Transformer xformer = TransformerFactory.newInstance().newTransformer();

    xformer.setOutputProperty(OutputKeys.ENCODING, encoding);
   
View Full Code Here


  public static void writeXmlFile(Document doc, File file, Entry<String,String>... outputKeys) throws TransformerFactoryConfigurationError, TransformerException {
    // Prepare the DOM document for writing
    Source source = new DOMSource(doc);

    // Prepare the output file
    Result result = new StreamResult(file);

    // Write the DOM document to the file
    Transformer xformer = TransformerFactory.newInstance().newTransformer();

    if(outputKeys != null){
View Full Code Here

    public byte[] evaluateAsBytes(Exchange exchange) throws Exception {
        initialize(exchange);

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        Result result = new StreamResult(buffer);
        getExpression().pull(createDynamicContext(exchange), result, properties);
        byte[] bytes = buffer.toByteArray();
        return bytes;
    }
View Full Code Here

    }

    public void save(OutputStream stream) throws IOException {
        try {
            AttributesImpl attrs = new AttributesImpl();
            StreamResult result = new StreamResult(stream);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory
                    .newInstance();
            TransformerHandler handler = factory.newTransformerHandler();
            Transformer serializer = handler.getTransformer();
            serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
View Full Code Here

                    return Status.CANCEL_STATUS;
                }
                try {
                    {
                        TransformerHandler handler = mySelectedStylesheet.createTitlePageHandler();
                        handler.setResult(new StreamResult(outputFile));
                        serialize(handler, outputFile);
                        resultFiles.add(outputFile);
                    }
                    //
                    {
                        TransformerHandler handler = mySelectedStylesheet.createTasksPageHandler();
                        File tasksPageFile = appendSuffixBeforeExtension(outputFile, "-tasks");
                        handler.setResult(new StreamResult(tasksPageFile));
                        serialize(handler, outputFile);
                        resultFiles.add(tasksPageFile);
                    }
                    {
                        TransformerHandler handler = mySelectedStylesheet.createGanttChartPageHandler();
                        File chartPageFile = appendSuffixBeforeExtension(outputFile, "-chart");
                        handler.setResult(new StreamResult(chartPageFile));
                        serialize(handler, outputFile);
                        resultFiles.add(chartPageFile);      
                    }
                    {
                        TransformerHandler handler = mySelectedStylesheet.createResourcesPageHandler();
                        File resourcesPageFile = appendSuffixBeforeExtension(outputFile, "-resources");
                        handler.setResult(new StreamResult(resourcesPageFile));
                        serialize(handler, outputFile);
                        resultFiles.add(resourcesPageFile);           
                       
                    }
                    monitor.worked(1);
View Full Code Here

    }

    public void saveFile() {
        try {
            AttributesImpl attrs = new AttributesImpl();
            StreamResult result = new StreamResult(os);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory
                    .newInstance();
            TransformerHandler handler = factory.newTransformerHandler();
            Transformer serializer = handler.getTransformer();
            serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
View Full Code Here

    }

    public void saveFilesFromLoaded(ArrayList tasks) {
        try {
            AttributesImpl attrs = new AttributesImpl();
            StreamResult result = new StreamResult(os);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory
                    .newInstance();
            TransformerHandler handler = factory.newTransformerHandler();
            Transformer serializer = handler.getTransformer();
            serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
View Full Code Here

            Transformer serializer = handler.getTransformer();
            serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
            serializer.setOutputProperty(
                    "{http://xml.apache.org/xslt}indent-amount", "4");
            handler.setResult(new StreamResult(file));
            handler.startDocument();
            // handler.startDTD("ganttproject.sourceforge.net",
            // "-//GanttProject.org//DTD GanttProject-1.x//EN",
            // "http://ganttproject.sourceforge.net/dtd/ganttproject.dtd");
            // handler.endDTD();
View Full Code Here

        SAXTransformerFactory factory = getTransformerFactory();

        TransformerHandler serializer = factory.newTransformerHandler();
        serializer.getTransformer().setOutputProperties(format);
        serializer.setResult(new StreamResult(outFile));

        this.parser = new ExtendedDirectParserProcessor();
        this.parser.setLog(log);
        this.parser.setFlatten(this.flatten);
View Full Code Here

        SAXTransformerFactory factory = getTransformerFactory();

        TransformerHandler serializer = factory.newTransformerHandler();
        serializer.getTransformer().setOutputProperties(format);
        serializer.setResult(new StreamResult(outFile));

        if (this.parserautomaton!=null// && (this.parser==null))
        {
          this.parser = new ParserProcessor();
          this.parser.setLog(log);
View Full Code Here

TOP

Related Classes of javax.xml.transform.stream.StreamResult

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.