org.dom4j.VisitorSupport Java Examples
The following examples show how to use
org.dom4j.VisitorSupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationReader.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
private static List<Module> getModules(final Document document) { final List<Module> modules = new ArrayList<>(); document.accept(new VisitorSupport() { @Override public void visit(final Element node) { if (XMLTags.MODULE_TAG.equals(node.getName())) { final String name = node.attributeValue(XMLTags.NAME_TAG); final RuleMetadata metadata = MetadataFactory.getRuleMetadata(name); Module module = null; if (metadata != null) { module = new Module(metadata, true); } else { module = new Module(name); } addProperties(node, module); addMessages(node, module); addMetadata(node, module); // if the module has not metadata attached we create some // generic metadata if (module.getMetaData() == null) { MetadataFactory.createGenericMetadata(module); } modules.add(module); } } }); return modules; }
Example #2
Source File: ManifestFileUtils.java From atlas with Apache License 2.0 | 5 votes |
/** * Remove comments from XML * * @param document * @throws IOException * @throws DocumentException */ private static void removeComments(Document document) throws IOException, DocumentException { Visitor visitor = new VisitorSupport() { @Override public void visit(Comment comment) { comment.setText(" "); } }; document.accept(visitor); }