1
2
3
4
5
6
7
8
9
10 package org.dom4j;
11
12 /***<p><code>Attribute</code> defines an XML attribute.
13 * An attribute may have a name, an optional namespace and a value.</p>
14 *
15 * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
16 * @version $Revision: 1.7 $
17 */
18 public interface Attribute extends Node {
19
20 /*** <p>Returns the <code>QName</code> of this attribute which represents
21 * the local name, the qualified name and the <code>Namespace</code>.</p>
22 *
23 * @return the <code>QName</code> associated with this attribute
24 */
25 public QName getQName();
26
27 /*** <p>Returns the <code>Namespace</code> of this element if one exists
28 * otherwise null is returned returned.</p>
29 *
30 * @return the <code>Namespace</code> associated with this node
31 */
32 public Namespace getNamespace();
33
34 /*** <p>Sets the <code>Namespace</code> of this element or if this element
35 * is read only then an <code>UnsupportedOperationException</code>
36 * is thrown.</p>
37 *
38 * @param namespace is the <code>Namespace</code> to associate with this
39 * element
40 */
41 public void setNamespace(Namespace namespace);
42
43 /*** <p>Returns the namespace prefix of this element if one exists
44 * otherwise an empty <code>String</code> is returned.</p>
45 *
46 * @return the prefix of the <code>Namespace</code> of this element
47 * or an empty <code>String</code>
48 */
49 public String getNamespacePrefix();
50
51 /*** <p>Returns the URI mapped to the namespace of this element
52 * if one exists otherwise an empty <code>String</code> is returned.</p>
53 *
54 * @return the URI for the <code>Namespace</code> of this element
55 * or an empty <code>String</code>
56 */
57 public String getNamespaceURI();
58
59 /*** <p>Returns the fully qualified name of this element.
60 * This will be the same as the value returned from {@link #getName}
61 * if this element has no namespace attached to this element or an
62 * expression of the form
63 * <pre>
64 * getNamespacePrefix() + ":" + getName()
65 * </pre>
66 * will be returned.
67 *
68 * @return the fully qualified name of the element.
69 */
70 public String getQualifiedName();
71
72 /*** <p>Returns the value of the attribute. This method
73 * returns the same value as the {@link #getText} method.
74 *
75 * @return the value of the attribute.
76 */
77 public String getValue();
78
79 /*** <p>Sets the value of this attribute or this method will
80 * throw an <code>UnsupportedOperationException</code> if it is
81 * read-only.</p>
82 *
83 * @param value is the new value of this attribute
84 */
85 public void setValue(String value);
86
87 /*** Accesses the data of this attribute which may implement data typing
88 * bindings such as XML Schema or
89 * Java Bean bindings or will return the same value as {@link #getText}
90 */
91 public Object getData();
92
93 /*** Sets the data value of this attribute if this element supports data
94 * binding or calls {@link #setText} if it doesn't
95 */
96 public void setData(Object data);
97
98 }
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146