Package org.jdom2.output

Examples of org.jdom2.output.DOMOutputter.output()


      doc.getRootElement().setContent(t);
      Format format = Format.getCompactFormat().setEncoding("ISO-8859-1");
      XMLOutputter outputter = new XMLOutputter(format);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try {
        outputter.output(doc, baos);
        fail("Illegal surrogate pair output should have thrown an exception");
      }
      catch (IllegalDataException e) {
        // do nothing
      } catch (Exception e) {
View Full Code Here


            }
        }

        XMLOutputter output = new XMLOutputter();
        try {
            output.output(document, new FileOutputStream(new File("res/maps/map.xml")));
        } catch (FileNotFoundException ex) {
            Logger.getLogger(TileGrid.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(TileGrid.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

            }

            Format format = Format.getRawFormat();
            format.setLineSeparator(eol);
            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(eol);
            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

            Format prettyFormat = flags.contains(RepresentationFactory.PRETTY_PRINT)
                    ? Format.getPrettyFormat()
                    : Format.getCompactFormat();

            final XMLOutputter outputter = new XMLOutputter(prettyFormat);
            outputter.output(element, writer);
        } catch (IOException e) {
            throw new RepresentationException(e);
        }
    }
View Full Code Here

   */
  public static void saveFile(String fileName, Document document) {
   
    try {
      XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat());
      xmlOutputter.output(document, new FileOutputStream(fileName));
    }
    catch(java.io.IOException e){}
  }

}
View Full Code Here

   * @see MissionsWriter#creatTree()
   */
  public void writeDocument() {
    XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
    try {
      xout.output(xml, new FileOutputStream(fileName));
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
View Full Code Here

        //parse the document
        Document doc = parser.build(originalPomFile);
        Element versionElem = findVersionElement(doc);
        versionElem.setText(newVersion);
        xmlOutput.output(doc, writer);
        writer.flush();
        writer.close();
    }

    private Element findVersionElement(Document doc) {
View Full Code Here

    Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
    if (encoding != null) {
      format.setEncoding(encoding);
    }
    XMLOutputter outputter = new XMLOutputter(format);
    outputter.output(doc, writer);
  }

  /**
   * Creates a W3C DOM document for the given WireFeed.
   * <p>
 
View Full Code Here

            JDOMResult result = new JDOMResult();
            transformer.transform(input,result);
            Document output = result.getDocument();

            XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
            printer.output(output, writer);
            writer.flush();
        } catch (Exception ex) {
            throw new QueryResultHandlerException("error while transforming XML results to HTML",ex);
        } finally {
            //writer.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.