Package org.dom4j.io

Examples of org.dom4j.io.XMLWriter


          }
        }
      }
         
          // lets write to a file
          XMLWriter writer = new XMLWriter(
              new FileOutputStream( targetDirectory+CreateLibraryPresentation.libraryFileName )
          );
          writer.write( document );
          writer.close();
     
          returnMap.put("exitValue", 0);
         
      return returnMap;
    } catch (Exception err) {
View Full Code Here


    Element step = root.addElement("step");
   
    step.addElement("stepnumber").addText(stepNo.toString());
    step.addElement("stepname").addText("Step "+stepNo);
   
    XMLWriter writer = new XMLWriter( new FileWriter( filePath ) );
        writer.write( document );
        writer.close();
   
  }
View Full Code Here

   */
  public static void writeXmlFile(Document domDoc, File outFile) throws IOException {
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile));
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setEncoding("UTF-8");
    XMLWriter xmlFileWriter = new XMLWriter(bos, format);
    xmlFileWriter.write(domDoc);
    xmlFileWriter.flush();
    xmlFileWriter.close();
  }
View Full Code Here

            LOG.info(GettextResource.gettext(i18nMessages, plugablePanel.getPluginName()+ " node environment loaded."));
          }
          BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile));
          OutputFormat format = OutputFormat.createPrettyPrint();
          format.setEncoding("UTF-8");
          XMLWriter xmlWriter = new XMLWriter(bos, format);
          xmlWriter.write(document);
          xmlWriter.flush();
          xmlWriter.close();
        }
        LOG.info(GettextResource.gettext(i18nMessages, "Environment saved."));
      }else{
        LOG.error(GettextResource.gettext(i18nMessages, "Error saving environment, output file is null."));
      }
View Full Code Here

      TextMarker textMarker = (TextMarker) iter.next();
      textMarker.addToElement(root);
    }
    OutputStream stream = textMarkerFile.getOutputStream(false);
    try {
      XMLWriter writer = new XMLWriter(stream);
      writer.write(doc);
      writer.close();
      stream.close();
    } catch (UnsupportedEncodingException e) {
      Tracing.logError("Error while saving text marker file", e, TextMarkerManagerImpl.class);
    } catch (IOException e) {
      Tracing.logError("Error while saving text marker file", e, TextMarkerManagerImpl.class);
View Full Code Here

        OutputStream os = new ByteArrayOutputStream();
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$

        // Writing the XML.
        XMLWriter writer = new XMLWriter( os, outformat );
        writer.write( document );
        writer.flush();
        writer.close();

        return os.toString();
    }
View Full Code Here

        OutputStream os = new ByteArrayOutputStream();
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$

        // Writing the XML.
        XMLWriter writer = new XMLWriter( os, outformat );
        writer.write( document );
        writer.flush();
        writer.close();

        return os.toString();
    }
View Full Code Here

   *             if there's a problem writing to the XMLWriter.
   */
  public byte[] exportUsersToByteArray() throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();

    XMLWriter writer = new XMLWriter(out, OutputFormat.createPrettyPrint());
    writer.write(exportUsers());

    return out.toByteArray();
  }
View Full Code Here

   * @throws IOException
   *             if there's a problem writing to the XMLWriter.
   */
  public String exportUsersToString() throws IOException {
    StringWriter stringWriter = new StringWriter();
    XMLWriter writer = null;
    try {
      writer = new XMLWriter(stringWriter, OutputFormat
          .createPrettyPrint());
      writer.write(exportUsers());
    } catch (IOException ioe) {
      Log.error(ioe);
      throw ioe;
    } finally {
      if (writer != null) {
        writer.close();
      }
    }

    return stringWriter.toString();
  }
View Full Code Here

      throw new RuntimeException("Error while parsing stream", e);
    }
  }

  public void serialize(Document document, OutputStream out) throws IOException {
    new XMLWriter(out, OutputFormat.createCompactFormat()).write(document);
  }
View Full Code Here

TOP

Related Classes of org.dom4j.io.XMLWriter

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.