KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > tag > common > xml > JSTLXPathImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  *
21  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22  *
23  * Portions Copyright Apache Software Foundation.
24  */

25 package org.apache.taglibs.standard.tag.common.xml;
26
27
28 import javax.xml.namespace.QName JavaDoc;
29 import javax.xml.namespace.NamespaceContext JavaDoc;
30 import javax.xml.xpath.XPathExpressionException JavaDoc;
31 import javax.xml.xpath.XPathConstants JavaDoc;
32 import javax.xml.xpath.XPathFunctionResolver JavaDoc;
33 import javax.xml.xpath.XPathVariableResolver JavaDoc;
34 import javax.xml.xpath.XPathExpression JavaDoc;
35
36 import com.sun.org.apache.xml.internal.dtm.DTM;
37 import com.sun.org.apache.xpath.internal.*;
38 import com.sun.org.apache.xpath.internal.objects.XObject;
39 import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
40 import com.sun.org.apache.xalan.internal.res.XSLMessages;
41
42 import org.w3c.dom.Node JavaDoc;
43 import org.w3c.dom.DOMImplementation JavaDoc;
44 import org.w3c.dom.Document JavaDoc;
45 import org.w3c.dom.traversal.NodeIterator;
46
47 import org.xml.sax.InputSource JavaDoc;
48 import org.xml.sax.SAXException JavaDoc;
49
50 import javax.xml.parsers.*;
51
52 import java.io.IOException JavaDoc;
53
54 /**
55  * The JSTLXPathImpl class provides implementation for the methods defined in
56  * javax.xml.xpath.XPath interface. This provide simple access to the results
57  * of an XPath expression.
58  *
59  * This class provides our own implementation of XPath, so that we can support
60  * a generic Object type in returnType arguement for XPath's evaluate instance
61  * method.
62  *
63  * Most of the implementation is exactly similar to what is already provided in
64  * com.sun.org.apache.xpath.internal.jaxp.XPathImpl.java
65  */

66 public class JSTLXPathImpl implements javax.xml.xpath.XPath JavaDoc {
67
68     // Private variables
69
private XPathVariableResolver JavaDoc variableResolver;
70     private XPathFunctionResolver JavaDoc functionResolver;
71     private XPathVariableResolver JavaDoc origVariableResolver;
72     private XPathFunctionResolver JavaDoc origFunctionResolver;
73     private NamespaceContext JavaDoc namespaceContext=null;
74     private com.sun.org.apache.xpath.internal.jaxp.JAXPPrefixResolver prefixResolver;
75     // By default Extension Functions are allowed in XPath Expressions. If
76
// Secure Processing Feature is set on XPathFactory then the invocation of
77
// extensions function need to throw XPathFunctionException
78
private boolean featureSecureProcessing = false;
79
80     JSTLXPathImpl( XPathVariableResolver JavaDoc vr, XPathFunctionResolver JavaDoc fr ) {
81         this.origVariableResolver = this.variableResolver = vr;
82         this.origFunctionResolver = this.functionResolver = fr;
83     }
84
85     JSTLXPathImpl( XPathVariableResolver JavaDoc vr, XPathFunctionResolver JavaDoc fr,
86             boolean featureSecureProcessing ) {
87         this.origVariableResolver = this.variableResolver = vr;
88         this.origFunctionResolver = this.functionResolver = fr;
89         this.featureSecureProcessing = featureSecureProcessing;
90     }
91
92     /**
93      * <p>Establishes a variable resolver.</p>
94      *
95      * @param resolver Variable Resolver
96      */

97     public void setXPathVariableResolver(XPathVariableResolver JavaDoc resolver) {
98         if ( resolver == null ) {
99             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
100                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
101                     new Object JavaDoc[] {"XPathVariableResolver"} );
102             throw new NullPointerException JavaDoc( fmsg );
103         }
104         this.variableResolver = resolver;
105     }
106
107     /**
108      * <p>Returns the current variable resolver.</p>
109      *
110      * @return Current variable resolver
111      */

112     public XPathVariableResolver JavaDoc getXPathVariableResolver() {
113         return variableResolver;
114     }
115
116     /**
117      * <p>Establishes a function resolver.</p>
118      *
119      * @param resolver XPath function resolver
120      */

121     public void setXPathFunctionResolver(XPathFunctionResolver JavaDoc resolver) {
122         if ( resolver == null ) {
123             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
124                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
125                     new Object JavaDoc[] {"XPathFunctionResolver"} );
126             throw new NullPointerException JavaDoc( fmsg );
127         }
128         this.functionResolver = resolver;
129     }
130
131     /**
132      * <p>Returns the current function resolver.</p>
133      *
134      * @return Current function resolver
135      */

136     public XPathFunctionResolver JavaDoc getXPathFunctionResolver() {
137         return functionResolver;
138     }
139
140     /**
141      * <p>Establishes a namespace context.</p>
142      *
143      * @param nsContext Namespace context to use
144      */

145     public void setNamespaceContext(NamespaceContext JavaDoc nsContext) {
146         if ( nsContext == null ) {
147             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
148                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
149                     new Object JavaDoc[] {"NamespaceContext"} );
150             throw new NullPointerException JavaDoc( fmsg );
151         }
152         this.namespaceContext = nsContext;
153         this.prefixResolver = new com.sun.org.apache.xpath.internal.jaxp.JAXPPrefixResolver ( nsContext );
154     }
155
156     /**
157      * <p>Returns the current namespace context.</p>
158      *
159      * @return Current Namespace context
160      */

161     public NamespaceContext JavaDoc getNamespaceContext() {
162         return namespaceContext;
163     }
164
165     private static Document JavaDoc d = null;
166     
167     private static DocumentBuilder getParser() {
168         try {
169             // we'd really like to cache those DocumentBuilders, but we can't because:
170
// 1. thread safety. parsers are not thread-safe, so at least
171
// we need one instance per a thread.
172
// 2. parsers are non-reentrant, so now we are looking at having a
173
// pool of parsers.
174
// 3. then the class loading issue. The look-up procedure of
175
// DocumentBuilderFactory.newInstance() depends on context class loader
176
// and system properties, which may change during the execution of JVM.
177
//
178
// so we really have to create a fresh DocumentBuilder every time we need one
179
// - KK
180
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
181             dbf.setNamespaceAware( true );
182             dbf.setValidating( false );
183             return dbf.newDocumentBuilder();
184         } catch (ParserConfigurationException e) {
185             // this should never happen with a well-behaving JAXP implementation.
186
throw new Error JavaDoc(e);
187         }
188     }
189
190     private static Document JavaDoc getDummyDocument( ) {
191         // we don't need synchronization here; even if two threads
192
// enter this code at the same time, we just waste a little time
193
if(d==null) {
194             DOMImplementation JavaDoc dim = getParser().getDOMImplementation();
195             d = dim.createDocument("http://java.sun.com/jaxp/xpath",
196                 "dummyroot", null);
197         }
198         return d;
199     }
200
201     
202     private XObject eval(String JavaDoc expression, Object JavaDoc contextItem)
203         throws javax.xml.transform.TransformerException JavaDoc {
204         com.sun.org.apache.xpath.internal.XPath xpath = new com.sun.org.apache.xpath.internal.XPath( expression,
205             null, prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT );
206         com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
207         if ( functionResolver != null ) {
208             com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider jep =
209                     new com.sun.org.apache.xpath.internal.jaxp.JAXPExtensionsProvider(
210                     functionResolver, featureSecureProcessing );
211             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
212         } else {
213             xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
214         }
215
216         XObject xobj = null;
217         
218         xpathSupport.setVarStack(new com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack(variableResolver));
219         
220         // If item is null, then we will create a a Dummy contextNode
221
if ( contextItem instanceof Node JavaDoc ) {
222             xobj = xpath.execute (xpathSupport, (Node JavaDoc)contextItem,
223                     prefixResolver );
224         } else {
225             xobj = xpath.execute ( xpathSupport, DTM.NULL, prefixResolver );
226         }
227  
228         return xobj;
229     }
230         
231     /**
232      * <p>Evaluate an <code>XPath</code> expression in the specified context and return the result as the specified type.</p>
233      *
234      * <p>See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
235      * for context item evaluation,
236      * variable, function and <code>QName</code> resolution and return type conversion.</p>
237      *
238      * <p>If <code>returnType</code> is not one of the types defined in {@link XPathConstants} (
239      * {@link XPathConstants#NUMBER NUMBER},
240      * {@link XPathConstants#STRING STRING},
241      * {@link XPathConstants#BOOLEAN BOOLEAN},
242      * {@link XPathConstants#NODE NODE} or
243      * {@link XPathConstants#NODESET NODESET})
244      * then an <code>IllegalArgumentException</code> is thrown.</p>
245      *
246      * <p>If a <code>null</code> value is provided for
247      * <code>item</code>, an empty document will be used for the
248      * context.
249      * If <code>expression</code> or <code>returnType</code> is <code>null</code>, then a
250      * <code>NullPointerException</code> is thrown.</p>
251      *
252      * @param expression The XPath expression.
253      * @param item The starting context (node or node list, for example).
254      * @param returnType The desired return type.
255      *
256      * @return Result of evaluating an XPath expression as an <code>Object</code> of <code>returnType</code>.
257      *
258      * @throws XPathExpressionException If <code>expression</code> cannot be evaluated.
259      * @throws IllegalArgumentException If <code>returnType</code> is not one of the types defined in {@link XPathConstants}.
260      * @throws NullPointerException If <code>expression</code> or <code>returnType</code> is <code>null</code>.
261      */

262     public Object JavaDoc evaluate(String JavaDoc expression, Object JavaDoc item, QName JavaDoc returnType)
263             throws XPathExpressionException JavaDoc {
264         if ( expression == null ) {
265             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
266                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
267                     new Object JavaDoc[] {"XPath expression"} );
268             throw new NullPointerException JavaDoc ( fmsg );
269         }
270         if ( returnType == null ) {
271             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
272                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
273                     new Object JavaDoc[] {"returnType"} );
274             throw new NullPointerException JavaDoc ( fmsg );
275         }
276         // Checking if requested returnType is supported. returnType need to
277
// be defined in XPathConstants or JSTLXPathConstants
278
if ( !isSupported ( returnType ) ) {
279             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
280                     XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE,
281                     new Object JavaDoc[] { returnType.toString() } );
282             throw new IllegalArgumentException JavaDoc ( fmsg );
283         }
284
285         try {
286  
287             XObject resultObject = eval( expression, item );
288             return getResultAsType( resultObject, returnType );
289         } catch ( java.lang.NullPointerException JavaDoc npe ) {
290             // If VariableResolver returns null Or if we get
291
// NullPointerException at this stage for some other reason
292
// then we have to reurn XPathException
293
throw new XPathExpressionException JavaDoc ( npe );
294         } catch ( javax.xml.transform.TransformerException JavaDoc te ) {
295             Throwable JavaDoc nestedException = te.getException();
296             if ( nestedException instanceof javax.xml.xpath.XPathFunctionException JavaDoc ) {
297                 throw (javax.xml.xpath.XPathFunctionException JavaDoc)nestedException;
298             } else {
299                 // For any other exceptions we need to throw
300
// XPathExpressionException ( as per spec )
301
throw new XPathExpressionException JavaDoc ( te );
302             }
303         }
304         
305     }
306
307     private boolean isSupported( QName JavaDoc returnType ) {
308         if ( ( returnType.equals( XPathConstants.STRING ) ) ||
309              ( returnType.equals( XPathConstants.NUMBER ) ) ||
310              ( returnType.equals( XPathConstants.BOOLEAN ) ) ||
311              ( returnType.equals( XPathConstants.NODE ) ) ||
312              ( returnType.equals( XPathConstants.NODESET ) ) ||
313              ( returnType.equals( JSTLXPathConstants.OBJECT ) ) ) {
314   
315             return true;
316         }
317         return false;
318      }
319
320     private Object JavaDoc getResultAsType( XObject resultObject, QName JavaDoc returnType )
321         throws javax.xml.transform.TransformerException JavaDoc {
322         // XPathConstants.STRING
323
if ( returnType.equals( XPathConstants.STRING ) ) {
324             return resultObject.str();
325         }
326         // XPathConstants.NUMBER
327
if ( returnType.equals( XPathConstants.NUMBER ) ) {
328             return new Double JavaDoc ( resultObject.num());
329         }
330         // XPathConstants.BOOLEAN
331
if ( returnType.equals( XPathConstants.BOOLEAN ) ) {
332             return new Boolean JavaDoc( resultObject.bool());
333         }
334         // XPathConstants.NODESET ---ORdered, UNOrdered???
335
if ( returnType.equals( XPathConstants.NODESET ) ) {
336             return resultObject.nodelist();
337         }
338         // XPathConstants.NODE
339
if ( returnType.equals( XPathConstants.NODE ) ) {
340             NodeIterator ni = resultObject.nodeset();
341             //Return the first node, or null
342
return ni.nextNode();
343         }
344         // JSTLXPathConstants.OBJECT
345
if ( returnType.equals( JSTLXPathConstants.OBJECT ) ) {
346             if (resultObject instanceof com.sun.org.apache.xpath.internal.objects.XNodeSet)
347                 return resultObject.nodelist();
348             else
349                 return resultObject.object();
350         }
351         String JavaDoc fmsg = XSLMessages.createXPATHMessage(
352                 XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE,
353                 new Object JavaDoc[] { returnType.toString()});
354         throw new IllegalArgumentException JavaDoc( fmsg );
355     }
356          
357             
358         
359     /**
360      * <p>Evaluate an XPath expression in the specified context and return the result as a <code>String</code>.</p>
361      *
362      * <p>This method calls {@link #evaluate(String expression, Object item, QName returnType)} with a <code>returnType</code> of
363      * {@link XPathConstants#STRING}.</p>
364      *
365      * <p>See "Evaluation of XPath Expressions" of JAXP 1.3 spec
366      * for context item evaluation,
367      * variable, function and QName resolution and return type conversion.</p>
368      *
369      * <p>If a <code>null</code> value is provided for
370      * <code>item</code>, an empty document will be used for the
371      * context.
372      * If <code>expression</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p>
373      *
374      * @param expression The XPath expression.
375      * @param item The starting context (node or node list, for example).
376      *
377      * @return The <code>String</code> that is the result of evaluating the expression and
378      * converting the result to a <code>String</code>.
379      *
380      * @throws XPathExpressionException If <code>expression</code> cannot be evaluated.
381      * @throws NullPointerException If <code>expression</code> is <code>null</code>.
382      */

383     public String JavaDoc evaluate(String JavaDoc expression, Object JavaDoc item)
384         throws XPathExpressionException JavaDoc {
385         return (String JavaDoc)this.evaluate( expression, item, XPathConstants.STRING );
386     }
387
388     /**
389      * <p>Compile an XPath expression for later evaluation.</p>
390      *
391      * <p>If <code>expression</code> contains any {@link XPathFunction}s,
392      * they must be available via the {@link XPathFunctionResolver}.
393      * An {@link XPathExpressionException} will be thrown if the <code>XPathFunction</code>
394      * cannot be resovled with the <code>XPathFunctionResolver</code>.</p>
395      *
396      * <p>If <code>expression</code> is <code>null</code>, a <code>NullPointerException</code> is thrown.</p>
397      *
398      * @param expression The XPath expression.
399      *
400      * @return Compiled XPath expression.
401
402      * @throws XPathExpressionException If <code>expression</code> cannot be compiled.
403      * @throws NullPointerException If <code>expression</code> is <code>null</code>.
404      */

405     public XPathExpression JavaDoc compile(String JavaDoc expression)
406         throws XPathExpressionException JavaDoc {
407         // This is never used in JSTL
408
if ( expression == null ) {
409             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
410                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
411                     new Object JavaDoc[] {"XPath expression"} );
412             throw new NullPointerException JavaDoc ( fmsg );
413         }
414         return null;
415         /*
416         try {
417             com.sun.org.apache.xpath.internal.XPath xpath = new XPath (expression, null,
418                     prefixResolver, com.sun.org.apache.xpath.internal.XPath.SELECT );
419             // Can have errorListener
420             com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl ximpl =
421                     new com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl (xpath,
422                     prefixResolver, functionResolver, variableResolver,
423                     featureSecureProcessing );
424             return ximpl;
425         } catch ( javax.xml.transform.TransformerException te ) {
426             throw new XPathExpressionException ( te ) ;
427         }
428          **/

429     }
430
431
432     /**
433      * <p>Evaluate an XPath expression in the context of the specified <code>InputSource</code>
434      * and return the result as the specified type.</p>
435      *
436      * <p>This method builds a data model for the {@link InputSource} and calls
437      * {@link #evaluate(String expression, Object item, QName returnType)} on the resulting document object.</p>
438      *
439      * <p>See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
440      * for context item evaluation,
441      * variable, function and QName resolution and return type conversion.</p>
442      *
443      * <p>If <code>returnType</code> is not one of the types defined in {@link XPathConstants},
444      * then an <code>IllegalArgumentException</code> is thrown.</p>
445      *
446      * <p>If <code>expression</code>, <code>source</code> or <code>returnType</code> is <code>null</code>,
447      * then a <code>NullPointerException</code> is thrown.</p>
448      *
449      * @param expression The XPath expression.
450      * @param source The input source of the document to evaluate over.
451      * @param returnType The desired return type.
452      *
453      * @return The <code>Object</code> that encapsulates the result of evaluating the expression.
454      *
455      * @throws XPathExpressionException If expression cannot be evaluated.
456      * @throws IllegalArgumentException If <code>returnType</code> is not one of the types defined in {@link XPathConstants}.
457      * @throws NullPointerException If <code>expression</code>, <code>source</code> or <code>returnType</code>
458      * is <code>null</code>.
459      */

460     public Object JavaDoc evaluate(String JavaDoc expression, InputSource JavaDoc source,
461             QName JavaDoc returnType) throws XPathExpressionException JavaDoc {
462         // Checking validity of different parameters
463
if( source== null ) {
464             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
465                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
466                     new Object JavaDoc[] {"source"} );
467             throw new NullPointerException JavaDoc ( fmsg );
468         }
469         if ( expression == null ) {
470             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
471                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
472                     new Object JavaDoc[] {"XPath expression"} );
473             throw new NullPointerException JavaDoc ( fmsg );
474         }
475         if ( returnType == null ) {
476             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
477                     XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
478                     new Object JavaDoc[] {"returnType"} );
479             throw new NullPointerException JavaDoc ( fmsg );
480         }
481
482         //Checking if requested returnType is supported.
483
//returnType need to be defined in XPathConstants
484
if ( !isSupported ( returnType ) ) {
485             String JavaDoc fmsg = XSLMessages.createXPATHMessage(
486                     XPATHErrorResources.ER_UNSUPPORTED_RETURN_TYPE,
487                     new Object JavaDoc[] { returnType.toString() } );
488             throw new IllegalArgumentException JavaDoc ( fmsg );
489         }
490         
491         try {
492
493             Document JavaDoc document = getParser().parse( source );
494
495             XObject resultObject = eval( expression, document );
496             return getResultAsType( resultObject, returnType );
497         } catch ( SAXException JavaDoc e ) {
498             throw new XPathExpressionException JavaDoc ( e );
499         } catch( IOException JavaDoc e ) {
500             throw new XPathExpressionException JavaDoc ( e );
501         } catch ( javax.xml.transform.TransformerException JavaDoc te ) {
502             Throwable JavaDoc nestedException = te.getException();
503             if ( nestedException instanceof javax.xml.xpath.XPathFunctionException JavaDoc ) {
504                 throw (javax.xml.xpath.XPathFunctionException JavaDoc)nestedException;
505             } else {
506                 throw new XPathExpressionException JavaDoc ( te );
507             }
508         }
509
510     }
511  
512
513
514
515     /**
516      * <p>Evaluate an XPath expression in the context of the specified <code>InputSource</code>
517      * and return the result as a <code>String</code>.</p>
518      *
519      * <p>This method calls {@link #evaluate(String expression, InputSource source, QName returnType)} with a
520      * <code>returnType</code> of {@link XPathConstants#STRING}.</p>
521      *
522      * <p>See "Evaluation of XPath Expressions" section of JAXP 1.3 spec
523      * for context item evaluation,
524      * variable, function and QName resolution and return type conversion.</p>
525      *
526      * <p>If <code>expression</code> or <code>source</code> is <code>null</code>,
527      * then a <code>NullPointerException</code> is thrown.</p>
528      *
529      * @param expression The XPath expression.
530      * @param source The <code>InputSource</code> of the document to evaluate over.
531      *
532      * @return The <code>String</code> that is the result of evaluating the expression and
533      * converting the result to a <code>String</code>.
534      *
535      * @throws XPathExpressionException If expression cannot be evaluated.
536      * @throws NullPointerException If <code>expression</code> or <code>source</code> is <code>null</code>.
537      */

538     public String JavaDoc evaluate(String JavaDoc expression, InputSource JavaDoc source)
539         throws XPathExpressionException JavaDoc {
540         return (String JavaDoc)this.evaluate( expression, source, XPathConstants.STRING );
541     }
542
543     /**
544      * <p>Reset this <code>XPath</code> to its original configuration.</p>
545      *
546      * <p><code>XPath</code> is reset to the same state as when it was created with
547      * {@link XPathFactory#newXPath()}.
548      * <code>reset()</code> is designed to allow the reuse of existing <code>XPath</code>s
549      * thus saving resources associated with the creation of new <code>XPath</code>s.</p>
550      *
551      * <p>The reset <code>XPath</code> is not guaranteed to have the same
552      * {@link XPathFunctionResolver}, {@link XPathVariableResolver}
553      * or {@link NamespaceContext} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}.
554      * It is guaranteed to have a functionally equal <code>XPathFunctionResolver</code>,
555      * <code>XPathVariableResolver</code>
556      * and <code>NamespaceContext</code>.</p>
557      */

558     public void reset() {
559         this.variableResolver = this.origVariableResolver;
560         this.functionResolver = this.origFunctionResolver;
561         this.namespaceContext = null;
562     }
563  
564 }
565
Popular Tags