Code example for XPath

Methods: evaluate

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