Package org.jdom2.output

Examples of org.jdom2.output.XMLOutputter


                writer.write( intro );
            }

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

            if ( outtro != null )
            {
                writer.write( outtro );
            }
View Full Code Here


            // 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 )
            {
                intro = content.substring( 0, index );
View Full Code Here

    }

    public ModuleDescriptorBuilder writeTo(final File target) throws IOException {
      final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(target));
      try {
        new XMLOutputter(Format.getPrettyFormat()).output(this.doc, out);
        out.flush();
      } finally {
        Closeables.closeQuietly(out);
      }
      return this;
View Full Code Here

      return this;
    }

    @Override
    public String toString() {
      return new XMLOutputter(Format.getPrettyFormat()).outputString(this.doc);
    }
View Full Code Here

                writer.write( intro );
            }

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

            if ( outtro != null )
            {
                writer.write( outtro );
            }
View Full Code Here

            // 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 )
            {
                intro = content.substring( 0, index );
View Full Code Here

    private LinkedList<String> doFilter(String in, Set<String> xpaths) throws IOException {
        LinkedList<String> result = new LinkedList<String>();
        try {
            Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(new StringReader(in));
            XMLOutputter out = new XMLOutputter();

            for (String xp : xpaths) {
                XPathExpression<Content> xpath = XPathFactory.instance().compile(xp, Filters.content());
                for (Content node : xpath.evaluate(doc)) {
                    if(node instanceof Element)
                        result.add(out.outputString((Element) node));
                    else if(node instanceof Text)
                        result.add(out.outputString((Text) node));
                }
            }
            return result;
        } catch (JDOMException xpe) {
            throw new IllegalArgumentException("error while processing xpath expressions: '" + xpaths + "'", xpe);
View Full Code Here

    }

    public ModuleDescriptorBuilder writeTo(final File target) throws IOException {
      final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(target));
      try {
        new XMLOutputter(Format.getPrettyFormat()).output(this.doc, out);
        out.flush();
      } finally {
        Closeables.close(out, true);
      }
      return this;
View Full Code Here

      return this;
    }

    @Override
    public String toString() {
      return new XMLOutputter(Format.getPrettyFormat()).outputString(this.doc);
    }
View Full Code Here

    sbroot.addContent(teams);
    sbroot.addContent(objectives);

    try
    {
      XMLOutputter xmlout = new XMLOutputter(Format.getPrettyFormat());
      File dataFolder = new File(primaryWorld.getWorldFolder(), "data");
      xmlout.output(sbroot, new FileOutputStream(new File(dataFolder, "scoreboard.xml")));
    }
    catch (java.io.IOException e)
    { AutoReferee.log("Could not save scoreboard data: " + primaryWorld.getName()); }
  }
View Full Code Here

TOP

Related Classes of org.jdom2.output.XMLOutputter

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.