Package org.dom4j.io

Examples of org.dom4j.io.XMLWriter


  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( "" );
    }
    catch( Throwable t ) {
      // otherwise, just dump it
      System.out.println( element.asXML() );
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

            @Override
            public void close() {
                writer[0].close();
            }
        };
        writer[0] = new Dom4JXmlWriter(new XMLWriter(filter, outputFormat), getNameCoder());
        return writer[0];
    }
View Full Code Here

            {
                pluginInfo.addElement("description");
            }
            pluginInfo.element("description").setText(description);

            new XMLWriter( zout, OutputFormat.createPrettyPrint() ).write(doc);
        }
        catch (DocumentException e)
        {
            throw new IOException("Unable to create new forked descriptor", e);
        }
View Full Code Here

        if (log.isDebugEnabled())
        {
            StringWriter out = new StringWriter();
            OutputFormat format = OutputFormat.createPrettyPrint();
            XMLWriter writer = new XMLWriter( out, format );
            try
            {
                writer.write(userElement);
            }
            catch (IOException e)
            {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
View Full Code Here

            entry.addElement("summary", NS).setText(plugin.getPlugin().getPluginInformation().getDescription());
        }
        StringWriter writer = new StringWriter();
        try
        {
            new XMLWriter(writer, OutputFormat.createPrettyPrint()).write(doc);
        }
        catch (IOException e)
        {
            throw new RuntimeException("Unable to create Atom XML", e);
        }
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

    configType = delegateElement.attributeValue("config-type");
    if ( delegateElement.hasContent() ) {
      try {
        StringWriter stringWriter = new StringWriter();
        // when parsing, it could be to store the config in the database, so we want to make the configuration compact
        XMLWriter xmlWriter = new XMLWriter( stringWriter, OutputFormat.createCompactFormat() );
        Iterator iter = delegateElement.content().iterator();
        while (iter.hasNext()) {
          Object node = iter.next();
          xmlWriter.write( node );
        }
        xmlWriter.flush();
        configuration = stringWriter.toString();
      } catch (IOException e) {
        jpdlReader.addWarning("io problem while parsing the configuration of "+delegateElement.asXML());
      }
    }
View Full Code Here

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

        try
        {
          StringWriter sw = new StringWriter();
          OutputFormat of = OutputFormat.createPrettyPrint();
          of.setSuppressDeclaration(true);
          new XMLWriter(sw, of).write(DocumentHelper.parseText(xml.replaceAll("&", "&")));
          logger.debug("created ChangeSet XML [" + sw.toString().replaceAll("&", "&") + "]");
        }
        catch (Exception e)
        {
          logger.warn("problem pretty-printing ChangeSet: " + e.getMessage());
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.