Package org.dom4j
Interface Attribute
- 
- All Known Implementing Classes:
 AbstractAttribute,BeanAttribute,DatatypeAttribute,DefaultAttribute,DOMAttribute,FlyweightAttribute,UserDataAttribute
public interface Attribute extends Node
Attributedefines an XML attribute. An attribute may have a name, an optional namespace and a value. 
- 
- 
Field Summary
- 
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE 
 - 
 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectgetData()Accesses the data of this attribute which may implement data typing bindings such asXML SchemaorJava Beanbindings or will return the same value asNode.getText().NamespacegetNamespace()Returns theNamespaceof this element if one exists otherwise null is returned returned.StringgetNamespacePrefix()Returns the namespace prefix of this element if one exists otherwise an emptyStringis returned.StringgetNamespaceURI()Returns the URI mapped to the namespace of this element if one exists otherwise an emptyStringis returned.QNamegetQName()Returns theQNameof this attribute which represents the local name, the qualified name and theNamespace.StringgetQualifiedName()Returns the fully qualified name of this element.StringgetValue()Returns the value of the attribute.voidsetData(Object data)Sets the data value of this attribute if this element supports data binding or callsNode.setText(String)if it doesn't.voidsetNamespace(Namespace namespace)Sets theNamespaceof this element or if this element is read only then anUnsupportedOperationExceptionis thrown.voidsetValue(String value)Sets the value of this attribute or this method will throw anUnsupportedOperationExceptionif it is read-only.- 
Methods inherited from interface org.dom4j.Node
accept, asXML, asXPathResult, clone, createXPath, detach, getDocument, getName, getNodeType, getNodeTypeName, getParent, getPath, getPath, getStringValue, getText, getUniquePath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getQName
QName getQName()
Returns theQNameof this attribute which represents the local name, the qualified name and theNamespace.- Returns:
 - the 
QNameassociated with this attribute 
 
- 
getNamespace
Namespace getNamespace()
Returns theNamespaceof this element if one exists otherwise null is returned returned.- Returns:
 - the 
Namespaceassociated with this node 
 
- 
setNamespace
void setNamespace(Namespace namespace)
Sets theNamespaceof this element or if this element is read only then anUnsupportedOperationExceptionis thrown.- Parameters:
 namespace- is theNamespaceto associate with this element
 
- 
getNamespacePrefix
String getNamespacePrefix()
Returns the namespace prefix of this element if one exists otherwise an emptyStringis returned.- Returns:
 - the prefix of the 
Namespaceof this element or an emptyString 
 
- 
getNamespaceURI
String getNamespaceURI()
Returns the URI mapped to the namespace of this element if one exists otherwise an emptyStringis returned.- Returns:
 - the URI for the 
Namespaceof this element or an emptyString 
 
- 
getQualifiedName
String getQualifiedName()
Returns the fully qualified name of this element. This will be the same as the value returned fromNode.getName()if this element has no namespace attached to this element or an expression of the formgetNamespacePrefix() + ":" + getName()
will be returned.- Returns:
 - the fully qualified name of the element
 
 
- 
getValue
String getValue()
Returns the value of the attribute. This method returns the same value as theNode.getText()method.- Returns:
 - the value of the attribute
 
 
- 
setValue
void setValue(String value)
Sets the value of this attribute or this method will throw anUnsupportedOperationExceptionif it is read-only.- Parameters:
 value- is the new value of this attribute
 
- 
getData
Object getData()
Accesses the data of this attribute which may implement data typing bindings such asXML SchemaorJava Beanbindings or will return the same value asNode.getText().- Returns:
 - the attribute data
 
 
- 
setData
void setData(Object data)
Sets the data value of this attribute if this element supports data binding or callsNode.setText(String)if it doesn't.- Parameters:
 data- the attribute data
 
 - 
 
 -