1 /*
2 * Copyright 2010 Capgemini
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 package org.xmlfield.core.api;
17
18 import org.xmlfield.core.exception.XmlFieldXPathException;
19 import org.xmlfield.core.internal.NamespaceMap;
20
21 /**
22 * The XPath selector interface used to select xpath expression on an xml field
23 * node.
24 *
25 * @author Guillaume Mary <guillaume.mary@capgemini.com>
26 *
27 */
28 public interface XmlFieldSelector {
29
30 /**
31 * Select xpath expression to an xml field node and return the result as a
32 * boolean.
33 *
34 * @param namespaces
35 * xml namespaces
36 * @param xpath
37 * xpath expression
38 * @param node
39 * xml field node
40 * @return result of the xpath evaluation
41 * @throws XmlFieldXPathException
42 * exception thrown when the xpath evaluation failed
43 */
44 Boolean selectXPathToBoolean(NamespaceMap namespaces, String xpath,
45 XmlFieldNode node) throws XmlFieldXPathException;
46
47 /**
48 * Select xpath expression to an xml field node and return the result as an
49 * xml field node.
50 *
51 * @param namespaces
52 * xml namespaces
53 * @param xpath
54 * xpath expression
55 * @param node
56 * xml field node
57 * @return result of the xpath evaluation
58 * @throws XmlFieldXPathException
59 * exception thrown when the xpath evaluation failed
60 */
61 XmlFieldNode selectXPathToNode(NamespaceMap namespaces, String xpath,
62 XmlFieldNode node) throws XmlFieldXPathException;
63
64 /**
65 * Select xpath expression to an xml field node and return the result as an
66 * xml field node list.
67 *
68 * @param namespaces
69 * xml namespaces
70 * @param xpath
71 * xpath expression
72 * @param node
73 * xml field node
74 * @return result of the xpath evaluation
75 * @throws XmlFieldXPathException
76 * exception thrown when the xpath evaluation failed
77 */
78 XmlFieldNodeList selectXPathToNodeList(NamespaceMap namespaces,
79 String xpath, XmlFieldNode node) throws XmlFieldXPathException;
80
81 /**
82 * Select xpath expression to an xml field node and return the result as a
83 * double.
84 *
85 * @param namespaces
86 * xml namespaces
87 * @param xpath
88 * xpath expression
89 * @param node
90 * xml field node
91 * @return result of the xpath evaluation
92 * @throws XmlFieldXPathException
93 * exception thrown when the xpath evaluation failed
94 */
95 Double selectXPathToNumber(NamespaceMap namespaces, String xpath,
96 XmlFieldNode node) throws XmlFieldXPathException;
97
98 /**
99 * Select xpath expression to an xml field node and return the result as a
100 * string.
101 *
102 * @param namespaces
103 * xml namespaces
104 * @param xpath
105 * xpath expression
106 * @param node
107 * xml field node
108 * @return result of the xpath evaluation
109 * @throws XmlFieldXPathException
110 * exception thrown when the xpath evaluation failed
111 */
112 String selectXPathToString(NamespaceMap namespaces, String xpath,
113 XmlFieldNode node) throws XmlFieldXPathException;
114 }