1 package com.icl.saxon.pattern; 2 import com.icl.saxon.om.NodeInfo; 3 import com.icl.saxon.expr.XPathException; 4 5 11 12 public class NodeTypeTest extends NodeTest { 13 14 private short type; 15 16 public NodeTypeTest(short nodeType) { 17 type = nodeType; 18 switch (nodeType) { 19 case NodeInfo.ROOT: 20 originalText = "/"; 21 break; 22 case NodeInfo.ELEMENT: 23 case NodeInfo.ATTRIBUTE: 24 originalText = "*"; 25 break; 26 case NodeInfo.COMMENT: 27 originalText = "comment()"; 28 break; 29 case NodeInfo.TEXT: 30 originalText = "text()"; 31 break; 32 case NodeInfo.PI: 33 originalText = "processing-instruction()"; 34 break; 35 case NodeInfo.NAMESPACE: 36 originalText = "namespace()"; 37 break; 38 } 39 } 40 41 44 45 public final boolean matches(NodeInfo node) { 46 return type==node.getNodeType(); 47 } 48 49 54 55 public boolean matches(short nodeType, int fingerprint) { 56 return (type == nodeType); 57 } 58 59 62 63 public final double getDefaultPriority() { 64 return -0.5; 65 } 66 67 71 72 public short getNodeType() { 73 return type; 74 } 75 76 } 77 78 | Popular Tags |