Package org.jdom2.output

Examples of org.jdom2.output.Format


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

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

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

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

                File file = new File(layout.name + ".xml");
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                Format format = Format.getPrettyFormat();
                format.setEncoding("utf-16");
                format.setTextMode(Format.TextMode.TRIM);
                XMLOutputter outputter = new XMLOutputter(format);
                outputter.output(new Document(root), fileOutputStream);
                fileOutputStream.close();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
View Full Code Here

                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(requestPayload, jdomResult);
        return jdomResult.getDocument().getRootElement();
    }
View Full Code Here

                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(source, jdomResult);
        return jdomResult.getDocument().getRootElement();
    }
View Full Code Here

    }

    @Override
    protected Source createResponsePayload(MethodParameter returnType, Object returnValue) {
        Element returnedElement = (Element) returnValue;
        return new JDOMSource(returnedElement);
    }
View Full Code Here

    @Override
    public final Source invoke(Source request) throws Exception {
        Element requestElement = getDocumentElement(request);
        Element responseElement = invokeInternal(requestElement);
        return responseElement != null ? new JDOMSource(responseElement) : 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.