Package org.jdom.output

Examples of org.jdom.output.Format


        XMLOutputter output = new XMLOutputter();
       
        StringWriter out = new StringWriter();
       
        Format fmt = Format.getRawFormat();
        fmt.setExpandEmptyElements( false );
        fmt.setLineSeparator( LINEBREAK );

        output.setFormat( fmt );
        output.outputElementContent( m_document.getRootElement(), out );
       
        return out.toString();
View Full Code Here


     */
    public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException
    {
        try
        {
            Format outformat = Format.getRawFormat();
            outformat.setEncoding("UTF-8");

            // Setup the destination
            String script;

            // Using XSLT to convert to a stream. Setup the source
View Full Code Here

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

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

            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

        IOUtils.closeQuietly(bufferedLineOutputStream);
        return sortedXml;
    }

    private Format createPrettyFormat() {
        final Format prettyFormat = Format.getPrettyFormat();
        prettyFormat.setExpandEmptyElements(expandEmptyElements);
        prettyFormat.setEncoding(encoding);
        prettyFormat.setLineSeparator("\n");
        prettyFormat.setIndent(indentCharacters);
        return prettyFormat;
    }
View Full Code Here

    public void write( Model project, Document document, OutputStream stream )
        throws java.io.IOException
    {
        updateModel( project, "project", new Counter( 0 ), document.getRootElement() );
        XMLOutputter outputter = new XMLOutputter();
        Format format = Format.getPrettyFormat();
        format.setIndent( "    " ).setLineSeparator( System.getProperty( "line.separator" ) );
        outputter.setFormat( format );
        outputter.output( document, stream );
    } // -- void write(Model, Document, OutputStream)
View Full Code Here

     * @param document
     */
    public void write( Model project, Document document, OutputStreamWriter writer )
        throws java.io.IOException
    {
        Format format = Format.getRawFormat();
        format.setEncoding( writer.getEncoding() ).setLineSeparator( System.getProperty( "line.separator" ) );
        write( project, document, writer, format );
    } // -- void write(Model, Document, OutputStreamWriter)
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

      }
    }

    final Document doc = new WireFeedOutput().outputJDom(feed);

    final Format format = debug ? Format.getPrettyFormat() : Format.getRawFormat();
    format.setOmitDeclaration(true);
    format.setOmitEncoding(true);

    final XMLOutputter outputter = new XMLOutputter(format);
    return outputter.outputString(doc);
  }
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.