org.dom4j

Interface Attribute

public interface Attribute extends Node

Attribute defines an XML attribute. An attribute may have a name, an optional namespace and a value.

Version: $Revision: 1.9 $

Author: James Strachan

Method Summary
ObjectgetData()

Accesses the data of this attribute which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText.

NamespacegetNamespace()

Returns the Namespace of this element if one exists otherwise null is returned returned.

StringgetNamespacePrefix()

Returns the namespace prefix of this element if one exists otherwise an empty String is returned.

StringgetNamespaceURI()

Returns the URI mapped to the namespace of this element if one exists otherwise an empty String is returned.

QNamegetQName()

Returns the QName of this attribute which represents the local name, the qualified name and the Namespace.

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 calls setTextif it doesn't.

voidsetNamespace(Namespace namespace)

Sets the Namespace of this element or if this element is read only then an UnsupportedOperationException is thrown.

voidsetValue(String value)

Sets the value of this attribute or this method will throw an UnsupportedOperationException if it is read-only.

Method Detail

getData

public Object getData()

Accesses the data of this attribute which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText.

Returns: the attribute data

getNamespace

public Namespace getNamespace()

Returns the Namespace of this element if one exists otherwise null is returned returned.

Returns: the Namespace associated with this node

getNamespacePrefix

public String getNamespacePrefix()

Returns the namespace prefix of this element if one exists otherwise an empty String is returned.

Returns: the prefix of the Namespace of this element or an empty String

getNamespaceURI

public String getNamespaceURI()

Returns the URI mapped to the namespace of this element if one exists otherwise an empty String is returned.

Returns: the URI for the Namespace of this element or an empty String

getQName

public QName getQName()

Returns the QName of this attribute which represents the local name, the qualified name and the Namespace.

Returns: the QName associated with this attribute

getQualifiedName

public String getQualifiedName()

Returns the fully qualified name of this element.

This will be the same as the value returned from getName if this element has no namespace attached to this element or an expression of the form

 getNamespacePrefix() + ":" + getName()
 
will be returned.

Returns: the fully qualified name of the element

getValue

public String getValue()

Returns the value of the attribute. This method returns the same value as the getTextmethod.

Returns: the value of the attribute

setData

public void setData(Object data)

Sets the data value of this attribute if this element supports data binding or calls setTextif it doesn't.

Parameters: data the attribute data

setNamespace

public void setNamespace(Namespace namespace)

Sets the Namespace of this element or if this element is read only then an UnsupportedOperationException is thrown.

Parameters: namespace is the Namespace to associate with this element

setValue

public void setValue(String value)

Sets the value of this attribute or this method will throw an UnsupportedOperationException if it is read-only.

Parameters: value is the new value of this attribute

Copyright B) 2005 MetaStuff Ltd. All Rights Reserved. Hosted by

SourceForge