Answer the question
In order to leave comments, you need to log in
How to make friends XPath and custom XML tree?
There is a custom xml parser. As a result of parsing, a tree is obtained, all the nodes of the tree are in ListMultimap<String, Node>
, where the key is the path to the node, for example, "/project/dependencies/dependency".
The tree provides the ability to make 2 types of requests:
1. Go for the text content of a particular node
String artifactId = xmlTree.selectText("/project/artifactId");
List<Node> dependencies = xmlTree.selectNodes("/project/dependencies/dependency");
List<Node> testDeps = tree.selectNodes("/project/dependencies/dependency[scope=test]");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question