1 package net.sf.saxon.expr; 2 import net.sf.saxon.om.Item; 3 import net.sf.saxon.om.NamePool; 4 import net.sf.saxon.om.NodeInfo; 5 import net.sf.saxon.trans.XPathException; 6 7 import java.io.PrintStream ; 8 9 12 13 public class ParentNodeExpression extends SingleNodeExpression { 14 15 20 21 public NodeInfo getNode(XPathContext context) throws XPathException { 22 Item item = context.getContextItem(); 23 if (item==null) { 24 dynamicError("The context item is not set", context); 25 } 26 if (item instanceof NodeInfo) { 27 return ((NodeInfo)item).getParent(); 28 } else { 29 return null; 30 } 31 } 32 33 38 43 46 47 public boolean equals(Object other) { 48 return (other instanceof ParentNodeExpression); 49 } 50 51 54 55 public int hashCode() { 56 return "ParentNodeExpression".hashCode(); 57 } 58 59 60 63 64 public void display(int level, NamePool pool, PrintStream out) { 65 out.println(ExpressionTool.indent(level) + ".."); 66 } 67 68 } 69 70 | Popular Tags |