1 28 29 package com.caucho.xpath.pattern; 30 31 import com.caucho.xpath.ExprEnvironment; 32 import com.caucho.xpath.XPathException; 33 34 import org.w3c.dom.Node ; 35 36 39 public class FromNamespace extends Axis { 40 public FromNamespace(AbstractPattern parent) 41 { 42 super(parent); 43 44 if (parent == null) 45 throw new RuntimeException (); 46 } 47 48 51 public boolean match(Node node, ExprEnvironment env) 52 throws XPathException 53 { 54 if (node == null) 55 return false; 56 57 if (! (node instanceof NamespaceNode)) 58 return false; 59 60 return _parent.match(node.getParentNode(), env); 61 } 62 63 64 73 public NodeIterator createNodeIterator(Node node, ExprEnvironment env, 74 AbstractPattern match) 75 throws XPathException 76 { 77 NodeIterator parentIter; 78 parentIter = _parent.createNodeIterator(node, env, _parent.copyPosition()); 79 80 return new NamespaceIterator(node, parentIter, env, match); 81 } 82 83 public String toString() 84 { 85 return getPrefix() + "namespace::"; 86 } 87 } 88 | Popular Tags |