Search in sources :

Example 1 with Visitor

use of org.dom4j.Visitor in project atlas by alibaba.

the class ManifestFileUtils method removeComments.

/**
     * 移除xml中的注释
     *
     * @param document
     * @throws IOException
     * @throws DocumentException
     */
private static void removeComments(Document document) throws IOException, DocumentException {
    Visitor visitor = new VisitorSupport() {

        public void visit(Comment comment) {
            comment.setText(" ");
        }
    };
    document.accept(visitor);
}
Also used : Comment(org.dom4j.Comment) Visitor(org.dom4j.Visitor) VisitorSupport(org.dom4j.VisitorSupport)

Aggregations

Comment (org.dom4j.Comment)1 Visitor (org.dom4j.Visitor)1 VisitorSupport (org.dom4j.VisitorSupport)1