01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.xml;
18:
19: import java.io.Serializable;
20:
21: /**
22: * A wrapper for an Xml Object. Used with XSEM to support mapping between Xml
23: * and Search Engine. The Xml Object can be an Xml element/attribute/... .
24: *
25: * @author kimchy
26: */
27: public interface XmlObject extends Serializable {
28:
29: /**
30: * Returns the name of the xml object. Should be the element/attribute name.
31: */
32: String getName();
33:
34: /**
35: * Returns the value of the xml object.
36: */
37: String getValue();
38:
39: /**
40: * Returns a list of xml objects matching the given xpath expression.
41: * Note, that the actual xml implementation might support only xpath
42: * expression compliation, so it is ok not to implement this method.
43: *
44: * @param path The xpath expression
45: * @return A list of xml objects matching the given xpath expression
46: * @throws Exception
47: */
48: XmlObject[] selectPath(String path) throws Exception;
49:
50: /**
51: * Returns <code>true</code> of the xml object supports xpath expression
52: * compilation.
53: */
54: boolean canCompileXpath();
55:
56: /**
57: * Compiles the given xpath expression.
58: *
59: * @param path The xpath expression
60: * @return The compiled xpath expression
61: * @throws Exception
62: */
63: XmlXPathExpression compile(String path) throws Exception;
64: }
|