Package org.dom4j.io

Examples of org.dom4j.io.XMLWriter


    if (logger.isDebugEnabled()) {
      try {
        StringWriter sw = new StringWriter();
        OutputFormat of = OutputFormat.createPrettyPrint();
        of.setSuppressDeclaration(true);
        new XMLWriter(sw, of).write(DocumentHelper.parseText(routesXML));
        logger.debug("adding routes [" + sw.toString().replaceAll("&", "&") + "]");
      } catch (Exception e) {
        logger.warn("problem pretty-printing routes: " + e.getMessage());
        logger.debug("adding routes [" + routesXML.replaceAll("&", "&") + "]");
      }
View Full Code Here


        return sw.toString();
    }

    private void copy( Node node, Writer writer )
    {
        XMLWriter xw = new XMLWriter( writer );

        try
        {
            xw.write( node );
        }
        catch( Exception  ee )
        {
        }
        finally
        {
            try
            {
                xw.flush();
            }
            catch( Exception eee)
                {}
        }
    }
View Full Code Here

  /**
   * Saves the file listing
   * @throws IOException
   */
  public void saveHFiles() throws IOException{
    XMLWriter wr = new XMLWriter(new FileWriter(hfile));
    wr.write(current);
    wr.close();
  }
View Full Code Here

            modules.addText( "\n    " );
            modules.addElement( "module" ).setText( artifactId );
            modules.addText( "\n  " );

            XMLWriter writer = new XMLWriter( fileWriter );
            writer.write( document );
        }
        return !found;
    }
View Full Code Here

                modules.addText( "\n    " );
                modules.addElement( "module" ).setText( artifactId );
                modules.addText( "\n  " );

                XMLWriter xmlWriter = new XMLWriter( writer );
                xmlWriter.write( document );

                FileUtils.fileWrite( pom.getAbsolutePath(), writer.toString() );
            } // end if
        }
        finally
View Full Code Here

        }
       
        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 '"
                            + person.getUserName() + "' to the DEBUG log", t);
            }
            log.debug("Layout for user:  " + person.getUserName()
View Full Code Here

    // if the object is a Document, convert it to XML
    if (obj instanceof Document) {
      Document document = (Document) model.get(xmlKey);
     
      try {
        XMLWriter writer = new XMLWriter(out);
        writer.write(document);
        writer.flush();
      } catch (IOException ex) {
        logger.error("IOException writing XML",ex);
      }
     
    }
View Full Code Here

         }

         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();
      }
      catch(IOException e)
      {
         e.printStackTrace();
View Full Code Here

  }

  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

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.