Frank,

here's the implementation of document.selectNodes():

    public List selectNodes(String xpathExpression) {
        XPath xpath = createXPath(xpathExpression);
        return xpath.selectNodes(this);
    }

Looks a lot like your alternative!

My suggestion: use document.selectNodes() unless you intend
to use the same XPath expression multiple times.

Silvain

> Can anyone supply the pros/cons on which of the following code 
> snippets is better to use?
> 
>   List list = document.selectNodes( "//foo/bar" );
> 
> or
> 
>   XPath xpathSelector = DocumentHelper.createXPath( "//foo/bar" );
>   List results = xpathSelector.selectNodes(document);
> 
> Thanks,
> Frank
> 
> 
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to