List of usage examples for org.dom4j.tree DefaultComment DefaultComment
public DefaultComment(String text)
From source file:net.sf.saxon.option.dom4j.DOM4JWriter.java
License:Mozilla Public License
/** * Handle a comment./*w w w .j a va2 s . c om*/ */ public void comment(CharSequence chars, int locationId, int properties) throws XPathException { flush(); Comment comment = new DefaultComment(chars.toString()); ((Element) ancestors.peek()).add(comment); }
From source file:org.xwiki.rendering.renderer.printer.XMLWikiPrinter.java
License:Open Source License
/** * Print a XML comment./*from www . j a v a2s . c om*/ * * @param content the comment content * @param escape indicate if comment content has to be escaped. XML content does not support -- and - (when it's the * last character). Escaping is based on backslash. "- --\ -" give "- \-\-\\ \-\ ". */ public void printXMLComment(String content, boolean escape) { try { this.xmlWriter.write(new DefaultComment(escape ? XMLUtils.escapeXMLComment(content) : content)); } catch (IOException e) { // TODO: add error log here } }