01: // Copyright 2004, 2005 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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: package org.apache.hivemind;
16:
17: import java.util.List;
18:
19: /**
20: * Simplified read-only thread safe DOM.
21: * Currently, no support for namespaces, but that may come.
22: *
23: * @author Howard Lewis Ship
24: */
25: public interface Element extends Locatable {
26: /**
27: * Returns the name of the element, as in, the name of the tag for the element.
28: */
29: public String getElementName();
30:
31: /**
32: * Returns an unmodifiable list of {@link Attribute} for this element.
33: * May return an empty list, but won't return null. The attributes
34: * are in no specific order.
35: */
36: public List getAttributes();
37:
38: /**
39: * Returns the value for an attribute, or null if the attribute is not specified.
40: */
41:
42: public String getAttributeValue(String attributeName);
43:
44: /**
45: * Returns true if this element contains no other elements.
46: */
47: public boolean isEmpty();
48:
49: /**
50: * Returns an unmodifiable list of {@link Element} directly contained
51: * by this element. May return an empty list, but won't return null.
52: * The elements are returned in the order in which they were encountered
53: * in the XML.
54: */
55: public List getElements();
56:
57: /**
58: * Returns the content of the element. This is a concatination of
59: * all the text directly enclosed by the element. Ignorable whitespace
60: * is ignored. The content is trimmed of leading and trailing whitespace.
61: */
62:
63: public String getContent();
64: }
|