Package org.jdom2.output

Examples of org.jdom2.output.Format


    assertTrue(xo != xo.clone());
  }

  @Test
  public void testToString() {
    Format fmt = Format.getCompactFormat();
    fmt.setLineSeparator("\n\t ");
    XMLOutputter out = new XMLOutputter(fmt);
    assertNotNull(out.toString());
  }
View Full Code Here


    Method mstring = getMethod(methodprefix + "String", clazz);
    Method mstream = getMethod(methodprefix, clazz, OutputStream.class);
    Method mwriter = getMethod(methodprefix, clazz, Writer.class);
   
    String[] descn   = new String[] {"Raw", "Compact", "Pretty", "TrimFullWhite"};
    Format ftrimfw = Format.getPrettyFormat();
    ftrimfw.setTextMode(TextMode.TRIM_FULL_WHITE);
    Format[] formats = new Format[] {
        getFormat(setup, Format.getRawFormat()),
        getFormat(setup, Format.getCompactFormat()),
        getFormat(setup, Format.getPrettyFormat()),
        getFormat(setup, ftrimfw)};
View Full Code Here

            if (intro != null)
            {
                writer.write(intro);
            }

            Format format = Format.getRawFormat();
            format.setLineSeparator(eol);
            XMLOutputter out = new XMLOutputter(format);
            out.output(document.getRootElement(), writer);

            if (outtro != null)
            {
View Full Code Here

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

            // 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(eol);
            XMLOutputter out = new XMLOutputter(format);
            out.output(document.getRootElement(), w);

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

public class XmlRepresentationWriter implements RepresentationWriter<String> {

    public void write(ReadableRepresentation representation, Set<URI> flags, Writer writer) {
        final Element element = renderElement("self", representation, false);
        try {
            Format prettyFormat = flags.contains(RepresentationFactory.PRETTY_PRINT)
                    ? Format.getPrettyFormat()
                    : Format.getCompactFormat();

            final XMLOutputter outputter = new XMLOutputter(prettyFormat);
            outputter.output(element, writer);
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

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

            if ( intro != null )
            {
                writer.write( intro );
            }

            Format format = Format.getRawFormat();
            format.setLineSeparator( ls );
            XMLOutputter out = new XMLOutputter( format );
            out.output( document.getRootElement(), writer );

            if ( outtro != null )
            {
View Full Code Here

TOP

Related Classes of org.jdom2.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.