1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /** 6 * Licensed to the Apache Software Foundation (ASF) under one 7 * or more contributor license agreements. See the NOTICE file 8 * distributed with this work for additional information 9 * regarding copyright ownership. The ASF licenses this file 10 * to you under the Apache License, Version 2.0 (the 11 * "License"); you may not use this file except in compliance 12 * with the License. You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, 17 * software distributed under the License is distributed on an 18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19 * KIND, either express or implied. See the License for the 20 * specific language governing permissions and limitations 21 * under the License. 22 */ 23 package com.sun.org.apache.xml.internal.security.utils; 24 25 import javax.xml.transform.TransformerException; 26 27 import org.w3c.dom.Node; 28 import org.w3c.dom.NodeList; 29 30 /** 31 * An interface to abstract XPath evaluation 32 */ 33 public interface XPathAPI { 34 35 /** 36 * Use an XPath string to select a nodelist. 37 * XPath namespace prefixes are resolved from the namespaceNode. 38 * 39 * @param contextNode The node to start searching from. 40 * @param xpathnode 41 * @param str 42 * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. 43 * @return A NodeIterator, should never be null. 44 * 45 * @throws TransformerException 46 */ 47 NodeList selectNodeList( 48 Node contextNode, Node xpathnode, String str, Node namespaceNode 49 ) throws TransformerException; 50 51 /** 52 * Evaluate an XPath string and return true if the output is to be included or not. 53 * @param contextNode The node to start searching from. 54 * @param xpathnode The XPath node 55 * @param str The XPath expression 56 * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces. 57 */ 58 boolean evaluate(Node contextNode, Node xpathnode, String str, Node namespaceNode) 59 throws TransformerException; 60 61 /** 62 * Clear any context information from this object 63 */ 64 void clear(); 65 66 }