Code example for XPath

Methods: evaluate

0
 */ 
public class SphereXPath { 
    public static Primitive build(Node node) throws XPathExpressionException {
        final XPathFactory xPathFactory = XPathFactory.newInstance();
        final XPath xPath = xPathFactory.newXPath();
        final Vector3D pos = VectorXPath.build((Node) xPath.evaluate("./pos", node, XPathConstants.NODE));
        final float specularPow = Float.valueOf((String) xPath.evaluate("./radius/@r", node, XPathConstants.STRING));
 
        return new Sphere(specularPow, pos);
    } 
}