Example usage for org.dom4j.io HTMLWriter HTMLWriter

List of usage examples for org.dom4j.io HTMLWriter HTMLWriter

Introduction

In this page you can find the example usage for org.dom4j.io HTMLWriter HTMLWriter.

Prototype

public HTMLWriter(OutputStream out) throws UnsupportedEncodingException 

Source Link

Usage

From source file:com.xebia.mojo.dashboard.util.TidyXmlUtil.java

License:Apache License

/** {@inheritDoc} */
public void writeDocument(Document document, File file) throws MojoExecutionException {
    try {/*from www.  ja v  a2  s.  c om*/
        HTMLWriter writer = new HTMLWriter(new OutputStreamWriter(new FileOutputStream(file), "ISO-8859-1"));
        writer.setEscapeText(false);
        writer.write(document);
        writer.close();
    } catch (UnsupportedEncodingException e1) {
    } catch (IOException e) {
    }
}

From source file:org.dom4j.samples.HTMLWriterDemo.java

License:Open Source License

/**
 * A Factory Method to create an <code>XMLWriter</code> instance allowing
 * derived classes to change this behaviour
 *//*from  w w w .j a v a  2 s . co m*/
protected XMLWriter createXMLWriter() throws Exception {
    return new HTMLWriter(System.out);
}

From source file:org.kie.appformer.formmodeler.codegen.view.impl.html.util.HTMLTemplateFormatter.java

License:Apache License

public String formatHTMLCode(String htmlTemplate) {
    try {/*w w  w  . j a  v a 2s.co m*/
        Document document = DocumentHelper.parseText(htmlTemplate);
        StringWriter sw = new StringWriter();
        HTMLWriter writer = new HTMLWriter(sw);
        writer.write(document);
        return sw.toString();
    } catch (Exception e) {
        log.warn("Error formatting html template: ", e);
    }
    return null;
}