Package org.dom4j.io

Examples of org.dom4j.io.OutputFormat


    /**
     * writes the current configuration to file
     * @throws IOException
     */
    private void writeConfigDoc() throws IOException {
        OutputFormat format = OutputFormat.createPrettyPrint();
        XMLWriter writer = new XMLWriter(new FileWriter(_configFile), format);
        writer.write(_configDoc);
        writer.flush();
        writer.close();
    }   
View Full Code Here


        String output = "";
        try
        {
            // Try to output the xml 'pretty'
            StringWriter stringWriter = new StringWriter();
            OutputFormat outputFormat = OutputFormat.createPrettyPrint();
            outputFormat.setPadText(false);
            outputFormat.setTrimText(false);
            XMLWriter out = new XMLWriter(stringWriter, outputFormat);
           
            out.write(document);
            output = stringWriter.toString();
        }
View Full Code Here

                }

                try
                {
                    // Format the output with line breaks and tabs
                    OutputFormat format = OutputFormat.createPrettyPrint();
                    XMLWriter writer = new XMLWriter(new FileWriter(txtDestFilename.getText()),
                            format);
                    writer.write(doc);
                    writer.close();
                    JOptionPane.showMessageDialog(null, "File created successfully",
View Full Code Here

                writeBrowserConnection( root, browserConnection );
            }
        }

        // Writing the file to disk
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
        XMLWriter writer = new XMLWriter( stream, outformat );
        writer.write( document );
        writer.flush();
    }
View Full Code Here

                addServer( server, root );
            }
        }

        // Writing the file to the stream
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
        XMLWriter writer = new XMLWriter( outputStream, outformat );
        writer.write( document );
        writer.flush();
    }
View Full Code Here

    {
        org.dom4j.io.XMLWriter xmlwriter = null;

        try
        {
            OutputFormat outputFormat = OutputFormat.createPrettyPrint();
            xmlwriter = new org.dom4j.io.XMLWriter( writer, outputFormat );
            xmlwriter.write( doc );
            xmlwriter.flush();
        }
        catch ( IOException e )
View Full Code Here

       
    // Implementation methods
    //-------------------------------------------------------------------------
    protected XMLOutput createXMLOutput() throws Exception {
       
        OutputFormat format = null;
        if (prettyPrint) {
            format = OutputFormat.createPrettyPrint();
        }
        else {
            format = new OutputFormat();
        }
        if ( encoding != null ) {
            format.setEncoding( encoding );
        }          
        if ( omitXmlDeclaration ) {
            format.setSuppressDeclaration(true);
        }
                   
        OutputStream out = new FileOutputStream(name);
       
        boolean isHtml = outputMode != null && outputMode.equalsIgnoreCase( "html" );
View Full Code Here

    return document;
  }

  public static void serializetoXML(OutputStream out, String aEncodingScheme,
      Document doc) throws Exception {
    OutputFormat outformat = OutputFormat.createPrettyPrint();
    outformat.setEncoding(aEncodingScheme);
    XMLWriter writer = new XMLWriter(out, outformat);
    writer.write(doc);
    writer.flush();
  }
View Full Code Here

        httpServletResponse.setContentType("text/xml");

        // httpServletResponse.setHeader("Content-Length", ""+
        // rf.length());

        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding("UTF-8");
        XMLWriter writer = new XMLWriter(out, outformat);
        writer.write(document);
        writer.flush();

        out.flush();
View Full Code Here

            }

            File generatedFile = new File( generatedRepositoryLocation, p + ".xml" );
            generatedFile.getParentFile().mkdirs();
            writer = new FileWriter( generatedFile );
            OutputFormat format = OutputFormat.createPrettyPrint();
            XMLWriter w = new XMLWriter( writer, format );
            w.write( document );
        }
        catch ( IOException e )
        {
View Full Code Here

TOP

Related Classes of org.dom4j.io.OutputFormat

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.