Check out example codes for "how to get all the elements in xpath java". It will help you in understanding the concepts better.

Code Example 1

XPathExpression expr = xpath.compile("//Yourpath");
NodeList list= (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
for (int i = 0; i < list.getLength(); i++) {
    Node node = list.item(i);
    System.out.println(node.getTextContent());

Learn ReactJs, React Native from akashmittal.com