Package org.dom4j.io

Examples of org.dom4j.io.OutputFormat


  }

  public static void dump(Element element) {
    try {
      // try to "pretty print" it
      OutputFormat outformat = OutputFormat.createPrettyPrint();
      XMLWriter writer = new XMLWriter( System.out, outformat );
      writer.write( element );
      writer.flush();
      System.out.println( "" );
    }
View Full Code Here


  }

  public static void dump(Element element) {
    try {
      // try to "pretty print" it
      OutputFormat outformat = OutputFormat.createPrettyPrint();
      XMLWriter writer = new XMLWriter( System.out, outformat );
      writer.write( element );
      writer.flush();
      System.out.println( "" );
    }
View Full Code Here

    private void writeDocument(Document e) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        Writer w = new PrintWriter(baos);

        try {
            XMLWriter xw = new XMLWriter(w, new OutputFormat(" ", true));
            xw.write(e);
            w.flush();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
View Full Code Here

  }

  public static void dump(Element element) {
    try {
      // try to "pretty print" it
      OutputFormat outFormat = OutputFormat.createPrettyPrint();
      XMLWriter writer = new XMLWriter( System.out, outFormat );
      writer.write( element );
      writer.flush();
      System.out.println( "" );
    }
View Full Code Here

    }

  public static void dump(Element element) {
    try {
      // try to "pretty print" it
      OutputFormat outformat = OutputFormat.createPrettyPrint();
      XMLWriter writer = new XMLWriter( System.out, outformat );
      writer.write( element );
      writer.flush();
      System.out.println( "" );
    }
View Full Code Here

      StringReader in = new StringReader(value);
      Document doc;
      try {
        doc = reader.read(in);

        OutputFormat formater = OutputFormat.createPrettyPrint();

        StringWriter out = new StringWriter();

        XMLWriter writer = new XMLWriter(out, formater);
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

                addConnection( root, connection );
            }
        }

        // 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

                addFolderConnection( root, connectionFolder );
            }
        }

        // 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

    public static void saveProjects()
    {
        try
        {
            // Saving the projects to the temp projects file
            OutputFormat outformat = OutputFormat.createPrettyPrint();
            outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
            XMLWriter writer = new XMLWriter( new FileOutputStream( getTempProjectsFile() ), outformat );
            writer.write( ProjectsExporter.toDocument( Activator.getDefault().getProjectsHandler().getProjects()
                .toArray( new Project[0] ) ) );
            writer.flush();

            // Copying the temp projects file to the final location
            String content = FileUtils.readFileToString( getTempProjectsFile(), "UTF-8" ); //$NON-NLS-1$
            FileUtils.writeStringToFile( getProjectsFile(), content, "UTF-8" ); //$NON-NLS-1$
        }
        catch ( IOException e )
        {
            // If an error occurs when saving to the temp projects file or
            // when copying the temp projects file to the final location,
            // we try to save the projects directly to the final location.
            try
            {
                OutputFormat outformat = OutputFormat.createPrettyPrint();
                outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
                XMLWriter writer = new XMLWriter( new FileOutputStream( getProjectsFile() ), outformat );
                writer.write( ProjectsExporter.toDocument( Activator.getDefault().getProjectsHandler().getProjects()
                    .toArray( new Project[0] ) ) );
                writer.flush();
            }
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.