📄 navigator.java
字号:
package org.jaxen;/* * $Header: /home/projects/jaxen/scm/jaxen/src/java/main/org/jaxen/Navigator.java,v 1.30 2006/06/03 20:07:19 elharo Exp $ * $Revision: 1.30 $ * $Date: 2006/06/03 20:07:19 $ * * ==================================================================== * * Copyright 2000-2005 bob mcwhirter & James Strachan. * All rights reserved. * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of the Jaxen Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ==================================================================== * This software consists of voluntary contributions made by many * individuals on behalf of the Jaxen Project and was originally * created by bob mcwhirter <bob@werken.com> and * James Strachan <jstrachan@apache.org>. For more information on the * Jaxen Project, please see <http://www.jaxen.org/>. * * $Id: Navigator.java,v 1.30 2006/06/03 20:07:19 elharo Exp $*/import java.io.Serializable;import java.util.Iterator;import org.jaxen.saxpath.SAXPathException;/** Interface for navigating around an arbitrary object * model, using XPath semantics. * * <p> * There is a method to obtain a <code>java.util.Iterator</code>, * for each axis specified by XPath. If the target object model * does not support the semantics of a particular axis, an * {@link UnsupportedAxisException} is to be thrown. If there are * no nodes on that axis, an empty iterator should be returned. * </p> * * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a> * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> * * @version $Id: Navigator.java,v 1.30 2006/06/03 20:07:19 elharo Exp $ */public interface Navigator extends Serializable{ // ---------------------------------------------------------------------- // Axis Iterators // ---------------------------------------------------------------------- /** Retrieve an <code>Iterator</code> matching the <code>child</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the child axis are * not supported by this object model */ Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>descendant</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the desscendant axis are * not supported by this object model */ Iterator getDescendantAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>parent</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the parent axis are * not supported by this object model */ Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>ancestor</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the ancestor axis are * not supported by this object model */ Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the * <code>following-sibling</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the following-sibling axis are * not supported by this object model */ Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the * <code>preceding-sibling</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the preceding-sibling axis are * not supported by this object model */ Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>following</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the following axis are * not supported by this object model */ Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>preceding</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the preceding axis are * not supported by this object model */ Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>attribute</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the attribute axis are * not supported by this object model */ Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>namespace</code> * XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the namespace axis are * not supported by this object model */ Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the <code>self</code> XPath * axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the self axis are * not supported by this object model */ Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the * <code>descendant-or-self</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the descendant-or-self axis are * not supported by this object model */ Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException; /** Retrieve an <code>Iterator</code> matching the * <code>ancestor-or-self</code> XPath axis. * * @param contextNode the original context node * * @return an Iterator capable of traversing the axis, not null * * @throws UnsupportedAxisException if the semantics of the ancestor-or-self axis are * not supported by this object model */ Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException; // ---------------------------------------------------------------------- // Extractors // ---------------------------------------------------------------------- /** Loads a document from the given URI * * @param uri the URI of the document to load * * @return the document * * @throws FunctionCallException if the document could not be loaded */ Object getDocument(String uri) throws FunctionCallException; /** Returns the document node that contains the given context node. * * @see #isDocument(Object) * * @param contextNode the context node * * @return the document of the context node */ Object getDocumentNode(Object contextNode); /** Returns the parent of the given context node. * * <p> * The parent of any node must either be a document * node or an element node. * </p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -