Code example for XPath

Methods: evaluate

0
 */ 
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 = VectorXPath.build((Node) xPath.evaluate("./top", node, XPathConstants.NODE));
        final Vector3D bot = VectorXPath.build((Node) xPath.evaluate("./bottom", node, XPathConstants.NODE));
 
        return new Cone(bot, top, r);
    } 
}