Code example for XPath

Methods: evaluate

public class ConeXPath { 
    public static Cone build(Node node) throws XPathExpressionException {
        final XPathFactory xPathFactory = XPathFactory.newInstance();
        final XPath xPath = xPathFactory.newXPath();
        final float r = Float.valueOf((String) xPath.evaluate("./radius/@r", node, XPathConstants.STRING));
        final Vector3D top = xPath.evaluate("./top", node, XPathConstants.NODE));
        final Vector3D bot = xPath.evaluate("./bottom", node, XPathConstants.NODE));
        return new Cone(bot, top, r);
Connect your IDE to all the code out there  Get Codota for Java