1 28 29 package com.caucho.xpath.pattern; 30 31 import com.caucho.xpath.ExprEnvironment; 32 33 import org.w3c.dom.Document ; 34 import org.w3c.dom.Node ; 35 36 39 public class FromRoot extends Axis { 40 public FromRoot() 41 { 42 super(null); 43 } 44 45 53 public boolean match(Node node, ExprEnvironment env) 54 { 55 return (node instanceof Document ); 56 } 57 58 65 public Node firstNode(Node node, ExprEnvironment env) 66 { 67 Node doc = node.getOwnerDocument(); 68 69 if (doc != null) 70 return doc; 71 else 72 return node; 73 } 74 75 83 public Node nextNode(Node node, Node lastNode) 84 { 85 return null; 86 } 87 88 91 public boolean isStrictlyAscending() 92 { 93 return true; 94 } 95 96 99 boolean isSingleSelect() 100 { 101 return true; 102 } 103 104 107 public boolean equals(Object b) 108 { 109 return b instanceof FromRoot; 110 } 111 112 public String toString() 113 { 114 return "/"; 115 } 116 } 117 | Popular Tags |