View Javadoc

1   /*
2    $Id: NamedAccessNavigator.java 1128 2006-02-05 21:49:04Z elharo $
3   
4    Copyright 2003 The Werken Company. All Rights Reserved.
5    
6   Redistribution and use in source and binary forms, with or without
7   modification, are permitted provided that the following conditions are
8   met:
9   
10    * Redistributions of source code must retain the above copyright
11      notice, this list of conditions and the following disclaimer.
12  
13    * Redistributions in binary form must reproduce the above copyright
14      notice, this list of conditions and the following disclaimer in the
15      documentation and/or other materials provided with the distribution.
16  
17    * Neither the name of the Jaxen Project nor the names of its
18      contributors may be used to endorse or promote products derived 
19      from this software without specific prior written permission.
20  
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  
33   */
34  package org.jaxen;
35  
36  import java.util.Iterator;
37  
38  /** 
39   * Interface for navigating around an arbitrary object model
40   * accessing certain parts by name for performance.
41   * <p>
42   * This interface must only be implemented by those models that
43   * can support this named access behavior.
44   *
45   * @author Stephen Colebourne
46   */
47  public interface NamedAccessNavigator extends Navigator {
48  
49      /**
50       * Retrieve an <code>Iterator</code> that returns the <code>child</code>
51       * XPath axis where the names of the children match the supplied name
52       * and optional namespace.
53       * <p>
54       * This method must only return element nodes with the correct name.
55       * <p>
56       * If the namespaceURI is null, no namespace should be used.
57       * The prefix will never be null.
58       *
59       * @param contextNode  the origin context node
60       * @param localName  the local name of the children to return, always present
61       * @param namespacePrefix  the prefix of the namespace of the children to return
62       * @param namespaceURI  the namespace URI of the children to return
63       *
64       * @return an Iterator capable of traversing the named children, or null if none
65       *
66       * @throws UnsupportedAxisException if the child axis is
67       *         not supported by this object model
68       */
69      Iterator getChildAxisIterator(
70          Object contextNode, 
71          String localName, String namespacePrefix, String namespaceURI)
72              throws UnsupportedAxisException;
73  
74      /**
75       * Retrieve an <code>Iterator</code> that returns the <code>attribute</code>
76       * XPath axis where the names of the attributes match the supplied name
77       * and optional namespace.
78       * <p>
79       * This method must only return attribute nodes with the correct name.
80       * <p>
81       * If the namespaceURI is null, no namespace should be used.
82       * The prefix will never be null.
83       *
84       * @param contextNode  the origin context node
85       * @param localName  the local name of the attributes to return, always present
86       * @param namespacePrefix  the prefix of the namespace of the attributes to return
87       * @param namespaceURI  the URI of the namespace of the attributes to return
88       *
89       * @return an Iterator capable of traversing the named attributes, or null if none
90       *
91       * @throws UnsupportedAxisException if the attribute axis is
92       *         not supported by this object model
93       */
94      Iterator getAttributeAxisIterator(
95          Object contextNode, 
96          String localName, String namespacePrefix, String namespaceURI)
97              throws UnsupportedAxisException;
98  
99  }