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