01: /*
02: * ============================================================================
03: * GNU Lesser General Public License
04: * ============================================================================
05: *
06: * JasperReports - Free Java report-generating library.
07: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22: *
23: * JasperSoft Corporation
24: * 303 Second Street, Suite 450 North
25: * San Francisco, CA 94107
26: * http://www.jaspersoft.com
27: */
28: package net.sf.jasperreports.engine.util.xml;
29:
30: import net.sf.jasperreports.engine.JRException;
31: import net.sf.jasperreports.engine.data.JRXmlDataSource;
32:
33: import org.w3c.dom.Node;
34: import org.w3c.dom.NodeList;
35:
36: /**
37: * An XPath expression executer.
38: * <p/>
39: * {@link JRXmlDataSource XML data sources} delegate XPath executions to implementations
40: * of this interface.
41: *
42: * @author Lucian Chirita (lucianc@users.sourceforge.net)
43: * @version $Id: JRXPathExecuter.java 1756 2007-06-14 16:11:20Z lucianc $
44: * @see JRXPathExecuterFactory
45: * @see JRXPathExecuterUtils
46: */
47: public interface JRXPathExecuter {
48:
49: /**
50: * Selects a node list by evaluating an XPath expression on a context node.
51: *
52: * @param contextNode the context node (a document can also be used)
53: * @param expression the XPath expression
54: * @return the selected node list
55: * @throws JRException if the XPath evaluation failed
56: */
57: NodeList selectNodeList(Node contextNode, String expression)
58: throws JRException;
59:
60: /**
61: * Selects an object by evaluating an XPath expression on a context node.
62: * <p/>
63: * If the expression evaluates to a node list, the first node in the list should be returned.
64: * Otherwise, the primitive value resulted from the evaluation should be returned as a
65: * <code>java.lang.String</code>, <code>java.lang.Number</code> or <code>java.lang.Boolean</code>.
66: *
67: * @param contextNode the context node (a document can also be used)
68: * @param expression the XPath expression
69: * @return the selected node or value
70: * @throws JRException if the XPath evaluation failed
71: */
72: Object selectObject(Node contextNode, String expression)
73: throws JRException;
74:
75: }
|