Package org.jdom2.output

Examples of org.jdom2.output.XMLOutputter


    private void replaceVersion(File originalPomFile, File newPomFile, String newVersion) throws IOException, JDOMException {

        //we assume that the version of "internal" dependencies are declared with ${project.version}
        FileWriter writer = new FileWriter(newPomFile);
        SAXBuilder parser = new SAXBuilder();
        XMLOutputter xmlOutput = new XMLOutputter();
        // display nice nice
        xmlOutput.setFormat(Format.getPrettyFormat());

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


    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

    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

    String value = null;
    String type = getAttributeValue(e, "type");
    type = (type != null) ? type : Content.TEXT;
    if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
      // XHTML content needs special handling
      XMLOutputter outputter = new XMLOutputter();
      List eContent = e.getContent();
      Iterator i = eContent.iterator();
      while (i.hasNext()) {
        org.jdom2.Content c = (org.jdom2.Content) i.next();
        if (c instanceof Element) {
          Element eC = (Element) c;
          if (eC.getNamespace().equals(getAtomNamespace())) {
            ((Element) c).setNamespace(Namespace.NO_NAMESPACE);
          }
        }
      }
      value = outputter.outputString(eContent);
    } else {
      // Everything else comes in verbatim
      value = e.getText();
    }
    return value;
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

            logDir.setAttribute("includes","**");

            pack.addContent(logDir);
        }

        XMLOutputter writer = new XMLOutputter(Format.getPrettyFormat());
        writer.output(installation,out);

    }
View Full Code Here

        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

        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

        return module;
    }
   
    protected String getXmlInnerText(Element e) {
        StringBuffer sb = new StringBuffer();
        XMLOutputter xo = new XMLOutputter();
        List children = e.getContent();
        sb.append(xo.outputString(children));
       
        return sb.toString();
    }
View Full Code Here

            logDir.setAttribute("includes","**");

            pack.addContent(logDir);
        }

        XMLOutputter writer = new XMLOutputter(Format.getPrettyFormat());
        writer.output(installation,out);

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