why this is not giving out put? 

Configuration config = new Configuration();
        config.setLineNumbering(true);
        XPathEvaluator xpath = new net.sf.saxon.xpath.XPathEvaluator(config);
        NodeInfo contextNode = net.sf.saxon.event.Builder.build(new StreamSource((new File(xmlFileToLoad))), null, config);
       
        List list = xpath.evaluate("//pubname");
        for (int i=0; i<list.size(); i++) {
            NodeInfo element = (NodeInfo)list;
            System.out.println("Element " + element.getDisplayName() + " at line " + element.getLineNumber());
        }

it returns exception like

net.sf.saxon.trans.DynamicError: Finding root of tree: the context item is undefined
; Line#: 1; Column#: -1
net.sf.saxon.trans.DynamicError: Finding root of tree: the context item is undefined
        at net.sf.saxon.expr.ComputedExpression.dynamicError(ComputedExpression.java:591)
        at net.sf.saxon.expr.RootExpression.getNode(RootExpression.java:76)
        at net.sf.saxon.expr.SingleNodeExpression.iterate(SingleNodeExpression.java:112)
        at net.sf.saxon.expr.PathExpression.iterate(PathExpression.java:754)
        at net.sf.saxon.xpath.XPathEvaluator.evaluate(XPathEvaluator.java:206)
        at testforxpath.DOMSaxon_EvalXPath.evalXPath(DOMSaxon_EvalXPath.java:106)
        at testforxpath.DOMSaxon_EvalXPath.main(DOMSaxon_EvalXPath.java:69)

can i know the reason for this.and what actually this NodeInfo contextNode have?