| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Attribute
defines behavior for an XML
attribute, modeled in Java. Methods allow the user
to obtain the value of the attribute as well as
namespace information.
Constructor Summary | |
Attribute(String name, String value, Namespace namespace) This will create a new Attribute with the
specified (local) name and value, and in the provided
Namespace . | |
Attribute(String name, String prefix, String uri, String value) This will create a new Attribute with the
specified (local) name and value, and place it in
the specified namespace (with prefix). | |
Attribute(String name, String value) This will create a new Attribute with the
specified (local) name and value, and does not place
the attribute in a Namespace . |
Method Summary | |
Object | clone() This will return a clone of this Attribute . |
final boolean | equals(Object ob) This tests for equality of this Attribute to the supplied
Object . |
boolean | getBooleanValue() This gets the value of the attribute, in boolean form, and if no conversion
can occur, throws a
DataConversionException
|
double | getDoubleValue() This gets the value of the attribute, in double form, and if no conversion
can occur, throws a
DataConversionException
|
float | getFloatValue() This gets the value of the attribute, in float form, and if no conversion
can occur, throws a
DataConversionException
|
int | getIntValue() This gets the value of the attribute, in int form, and if no conversion
can occur, throws a
DataConversionException
|
long | getLongValue() This gets the value of the attribute, in long form, and if no conversion
can occur, throws a
DataConversionException
|
String | getName() This will retrieve the local name of the Attribute . |
Namespace | getNamespace() This will return this Attribute 's
Namespace . |
String | getNamespacePrefix() This will retrieve the namespace prefix of the Attribute . |
String | getNamespaceURI() This returns the URI mapped to this Attribute 's
prefix. |
Element | getParent() This will return the parent of this Attribute . |
String | getQualifiedName() This will retrieve the qualified name of the Attribute . |
final String | getSerializedForm() This will return the Attribute in XML format,
usable in an XML document. |
String | getValue() This will return the actual textual value of this Attribute . |
final int | hashCode() This returns the hash code for this Attribute . |
Attribute | setValue(String value) This will set the value of the Attribute . |
String | toString() This returns a String representation of the
Attribute , suitable for debugging. |
Constructor Detail |
public Attribute(String name, String value, Namespace namespace)
This will create a new Attribute
with the
specified (local) name and value, and in the provided
Namespace
.
String
name of Attribute
.String
value for new attribute.public Attribute(String name, String prefix, String uri, String value)
This will create a new Attribute
with the
specified (local) name and value, and place it in
the specified namespace (with prefix).
String
name of Attribute
.String
prefix for Attribute
.String
URI for namespace this
Attribute
is in.String
value for new attribute.public Attribute(String name, String value)
This will create a new Attribute
with the
specified (local) name and value, and does not place
the attribute in a Namespace
.
Note: This actually explicitly puts the
Attribute
in the "empty" Namespace
(Namespace.NO_NAMESPACE
).
String
name of Attribute
.String
value for new attribute.Method Detail |
public Object clone()
This will return a clone of this Attribute
.
Object
- clone of this Attribute
.public final boolean equals(Object ob)
This tests for equality of this Attribute
to the supplied
Object
.
Object
to compare to.boolean
- whether the Attribute
is
equal to the supplied Object
.public boolean getBooleanValue()
throws DataConversionException
This gets the value of the attribute, in
boolean
form, and if no conversion
can occur, throws a
DataConversionException
boolean
value of attribute.DataConversionException
- - when conversion fails.public double getDoubleValue()
throws DataConversionException
This gets the value of the attribute, in
double
form, and if no conversion
can occur, throws a
DataConversionException
double
value of attribute.DataConversionException
- - when conversion fails.public float getFloatValue()
throws DataConversionException
This gets the value of the attribute, in
float
form, and if no conversion
can occur, throws a
DataConversionException
float
value of attribute.DataConversionException
- - when conversion fails.public int getIntValue()
throws DataConversionException
This gets the value of the attribute, in
int
form, and if no conversion
can occur, throws a
DataConversionException
int
value of attribute.DataConversionException
- - when conversion fails.public long getLongValue()
throws DataConversionException
This gets the value of the attribute, in
long
form, and if no conversion
can occur, throws a
DataConversionException
long
value of attribute.DataConversionException
- - when conversion fails.public String getName()
This will retrieve the local name of the
Attribute
. For any XML attribute
which appears as
[namespacePrefix]:[attributeName]
,
the local name of the attribute would be
[attributeName]
. When the attribute
has no namespace, the local name is simply the attribute
name.
To obtain the namespace prefix for this
attribute, the
getNamespacePrefix()
method should be used.
String
- name of this attribute,
without any namespace prefix.public Namespace getNamespace()
This will return this Attribute
's
Namespace
.
Namespace
- Namespace object for this Attribute
public String getNamespacePrefix()
This will retrieve the namespace prefix of the
Attribute
. For any XML attribute
which appears as
[namespacePrefix]:[attributeName]
,
the namespace prefix of the attribute would be
[namespacePrefix]
. When the attribute
has no namespace, an empty String
is returned.
String
- namespace prefix of this
attribute.public String getNamespaceURI()
This returns the URI mapped to this Attribute
's
prefix. If no
mapping is found, an empty String
is returned.
String
- namespace URI for this Attribute
.public Element getParent()
This will return the parent of this Attribute
.
If there is no parent, then this returns null
.
Attribute
public String getQualifiedName()
This will retrieve the qualified name of the Attribute
.
For any XML attribute whose name is
[namespacePrefix]:[elementName]
,
the qualified name of the attribute would be
everything (both namespace prefix and
element name). When the attribute has no
namespace, the qualified name is simply the attribute's
local name.
To obtain the local name of the attribute, the
getName()
method should be used.
To obtain the namespace prefix for this attribute,
the getNamespacePrefix()
method should be used.
String
- full name for this element.public final String getSerializedForm()
This will return the Attribute
in XML format,
usable in an XML document.
String
- the serialized form of the
Attribute
.public String getValue()
This will return the actual textual value of this
Attribute
. This will include all text
within the quotation marks.
String
- value for this attribute.public final int hashCode()
This returns the hash code for this Attribute
.
int
- hash code.public Attribute setValue(String value)
This will set the value of the Attribute
.
String
value for the attribute.Attribute
- this Attribute modified.public String toString()
This returns a String
representation of the
Attribute
, suitable for debugging. If the XML
representation of the Attribute
is desired,
getSerializedForm()
should be used.
String
- information about the
Attribute
Association Links |
Attribute
to Class org.jdom.Namespace
{@link Namespace}
of the Attribute
to Class java.lang.String
Attribute
to Class org.jdom.Element
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |