Package org.dom4j.io

Examples of org.dom4j.io.OutputFormat


        }
       
        if (log.isDebugEnabled()) {
            // Write out this version of the layout to the log for dev purposes...
            StringWriter str = new StringWriter();
            XMLWriter xml = new XMLWriter(str, new OutputFormat("  ", true));
            try {
                xml.write(layoutDoc);
                xml.close();
            } catch (Throwable t) {
                throw new RuntimeException("Failed to write the layout for user '"
View Full Code Here


            info.writeXML(root);
         }

         File versionsXml = new File(jbossHome, "jar-versions.xml");
         FileWriter versionInfo = new FileWriter(versionsXml);
         OutputFormat outformat = OutputFormat.createPrettyPrint();
         XMLWriter writer = new XMLWriter(versionInfo, outformat);
         writer.setEscapeText(true);
         writer.write(doc);
         writer.flush();
         versionInfo.close();
View Full Code Here

    t.commit();
    s.close();
  }

  public static void print(Element elt) throws Exception {
    OutputFormat outformat = OutputFormat.createPrettyPrint();
    // outformat.setEncoding(aEncodingScheme);
    XMLWriter writer = new XMLWriter( System.out, outformat );
    writer.write( elt );
    writer.flush();
    // System.out.println( elt.asXML() );
View Full Code Here

  }

  private void prettyPrint(Element element) {
    //System.out.println( element.asXML() );
    try {
      OutputFormat format = OutputFormat.createPrettyPrint();
      new XMLWriter( System.out, format ).write( element );
      System.out.println();
    }
    catch ( Throwable t ) {
      System.err.println( "Unable to pretty print element : " + t );
View Full Code Here

    }

    public void testOutputOptions()
    {
        XmlPrettyPrinter t = new XmlPrettyPrinter();
        OutputFormat f = t.getOutputFormat();
        assertEquals(2, f.getIndent().length());
        assertTrue(f.isPadText());

        t.setIndentSize(4);
        t.setPadText(true);
        assertEquals(4, f.getIndent().length());
        assertTrue(f.isPadText());
    }
View Full Code Here

            throws IOException, FPDLSerializerException {

        Document document = workflowProcessToDom(workflowProcess);

        // write the document to the output stream
        OutputFormat format = new OutputFormat("    ", true);
        format.setEncoding("UTF-8");

        XMLWriter writer = new XMLWriter(out, format);

        writer.write(document);
        out.flush();
View Full Code Here

     * @throws FPDLSerializerException
     */
    public String workflowProcessToXMLString(WorkflowProcess workflowProcess)
            throws IOException, FPDLSerializerException {
        Document dom = workflowProcessToDom(workflowProcess);
        OutputFormat format = new OutputFormat("    ", true);
        format.setEncoding("utf-8");
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        XMLWriter writer = new XMLWriter(out, format);

        writer.write(dom);
View Full Code Here

            if (file.exists()) {
                file.delete();
            }
            // Create new version.xml with returned data
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            OutputFormat prettyPrinter = OutputFormat.createPrettyPrint();
            XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter);
            xmlWriter.write(xmlResponse);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
View Full Code Here

            if (file.exists()) {
                file.delete();
            }
            // Create new version.xml with returned data
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            OutputFormat prettyPrinter = OutputFormat.createPrettyPrint();
            XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter);
            xmlWriter.write(xml);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
View Full Code Here

        File tempFile = null;
        Writer writer = null;
        try {
            tempFile = new File(file.getParentFile(), file.getName() + ".tmp");
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "UTF-8"));
            OutputFormat prettyPrinter = OutputFormat.createPrettyPrint();
            XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter);
            xmlWriter.write(document);
        }
        catch (Exception e) {
            Log.error(e.getMessage(), 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.