final Document document = (Document) models.get("jdom2");
final XPathFactory xpathFactory = XPathFactory.instance();
final Filter<LocatedElement> filter = Filters.fclass(LocatedElement.class);
Namespace mavenNamespace = Namespace.getNamespace("m", "http://maven.apache.org/POM/4.0.0");
final XPathExpression<LocatedElement> dependenciesXpath = xpathFactory.compile("/m:project/m:dependencies/m:dependency", filter, null, mavenNamespace);
final XPathExpression<LocatedElement> managedDependenciesXpath = xpathFactory.compile("/m:project/m:dependencyManagement/m:dependency", filter, null, mavenNamespace);
final List<LocatedElement> dependencies = dependenciesXpath.evaluate(document);
final List<LocatedElement> managedDependencies = managedDependenciesXpath.evaluate(document);