Package org.jdom.output

Examples of org.jdom.output.Format


                    || encoding.equals("8859-1") || encoding.equals("8859_1"))
                {
                    encoding = "ISO-8859-1";
                }

                Format f = Format.getRawFormat();
                f.setEncoding(encoding);

                OutputWrapper ow = new OutputWrapper(f);

                context.put ("root", root.getRootElement());
                context.put ("xmlout", ow );
View Full Code Here


          StandardLocation.SOURCE_OUTPUT, "", targetFacesConfigFile);
      info("Writing to file: " + resource.toUri());
      writer = resource.openWriter();

      final StringWriter facesConfig = new StringWriter(1024);
      final Format format = Format.getPrettyFormat();
      format.setLineSeparator(SEPARATOR);
      final XMLOutputter out = new XMLOutputter(format);
      out.output(document, facesConfig);
      writer.append(facesConfig.toString());

    } finally {
View Full Code Here

      return "";
    }

    try {
      Document doc = new SAXBuilder().build( new StringReader( xml ) );
      Format format = Format.getPrettyFormat();
      format.setLineSeparator( "\n" );
      return new XMLOutputter( format ).outputString( doc );
    } catch ( Exception e ) {
      throw new RuntimeException( e );
    }
  }
View Full Code Here

           
        } catch (URISyntaxException ex) {
            System.out.println("OrcaApi.java: " + ex);
        }
       
        Format format = outputter.getFormat();
        format.setEncoding("UTF-8");
        format.setLineSeparator("\n");
        format.setIndent("  ");
        outputter.setFormat(format);
    }
View Full Code Here

           
        } catch (URISyntaxException ex) {
            System.out.println("OrcaApi.java: " + ex);
        }
       
        Format format = outputter.getFormat();
        format.setEncoding("UTF-8");
        format.setLineSeparator("\n");
        format.setIndent("  ");
        outputter.setFormat(format);
       
        logger = ClientContext.getBootLogger();
    }
View Full Code Here

            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");
            try {
                XMLOutputter outputter = new XMLOutputter();
                String eol = eolDetectingStream.getEol();
                if (!"".equals(eol)) {
                    Format format = outputter.getFormat();
                    format.setLineSeparator(eol);
                    format.setTextMode(Format.TextMode.PRESERVE);
                    outputter.setFormat(format);
                }
                outputter.output(document, outputStreamWriter);
            } finally {
                Closeables.closeQuietly(outputStreamWriter);
View Full Code Here

     *
     */
    public String outputString(WireFeed feed, boolean prettyPrint) throws IllegalArgumentException,FeedException {
        Document doc = outputJDom(feed);
        String encoding = feed.getEncoding();
        Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
        if (encoding!=null) {
            format.setEncoding(encoding);
        }
        XMLOutputter outputter = new XMLOutputter(format);
        return outputter.outputString(doc);
    }
View Full Code Here

     *
     */
    public void output(WireFeed feed,Writer writer,boolean prettyPrint) throws IllegalArgumentException,IOException, FeedException {
        Document doc = outputJDom(feed);
        String encoding = feed.getEncoding();
        Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
        if (encoding!=null) {
            format.setEncoding(encoding);
        }
        XMLOutputter outputter = new XMLOutputter(format);
        outputter.output(doc,writer);
    }
View Full Code Here

  }

  @NotNull
  public static XMLOutputter createOutputter(String lineSeparator) {
    XMLOutputter xmlOutputter = new MyXMLOutputter();
    Format format = Format.getCompactFormat().
      setIndent("  ").
      setTextMode(Format.TextMode.NORMALIZE).
      setEncoding(ENCODING).
      setOmitEncoding(false).
      setOmitDeclaration(false).
View Full Code Here

            // per section 2.11 of the XML spec)
            normaliseLineEndings( document );

            // rewrite DOM as a string to find differences, since text outside the root element is not tracked
            StringWriter w = new StringWriter();
            Format format = Format.getRawFormat();
            format.setLineSeparator( ls );
            XMLOutputter out = new XMLOutputter( format );
            out.output( document.getRootElement(), w );

            int index = content.indexOf( w.toString() );
            if ( index >= 0 )
View Full Code Here

TOP

Related Classes of org.jdom.output.Format

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.