All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.jdom.Attribute
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.
Attribute type: the attribute value is a string.
Attribute type: the attribute value is a list of entity names.
Attribute type: the attribute value is the name of an entity.
Attribute type: the attribute value is a name token from an enumeration.
Attribute type: the attribute value is a unique identifier.
Attribute type: the attribute value is a reference to a unique identifier.
Attribute type: the attribute value is a list of references to unique identifiers.
Attribute
{
-
NMTOKEN_ATTRIBUTE
-
Attribute type: the attribute value is a name token.
-
NMTOKENS_ATTRIBUTE
-
Attribute type: the attribute value is a list of name tokens.
-
NOTATION_ATTRIBUTE
-
Attribute type: the attribute value is the name of a notation.
-
parent
- Parent element, or null if none
-
type
- The type of the
Attribute
-
UNDECLARED_ATTRIBUTE
-
Attribute type: the attribute has not been declared or type
is unknown.
-
value
- The value of the
Attribute
Default, no-args constructor for implementations to use if needed.
This will create a new
This will create a new
This will create a new
This will create a new Attribute
with the
specified (local) name and value, and does not place
the attribute in a {
Attribute(String, String, int)
Attribute
with the
specified (local) name, value and type, and does not place
the attribute in a {
Attribute(String, String, int, Namespace)
Attribute
with the
specified (local) name, value, and type, and in the provided
{
Attribute(String, String, Namespace)
Attribute
with the
specified (local) name and value, and in the provided
{
This will return a clone of this Attribute
.
This detaches the Attribute
from its parent, or does
nothing if the Attribute
has no parent.
This tests for equality of this Attribute
to the supplied
Object
.
This will return the actual declared type of this
Attribute
.
This gets the value of the attribute, in
This retrieves the owning
This gets the value of the attribute, in
This gets the value of the attribute, in
This gets the value of the attribute, in
This gets the value of the attribute, in
This will retrieve the local name of the
This will return this
This will retrieve the namespace prefix of the
This returns the URI mapped to this
This will return the parent of this
This will retrieve the qualified name of the
This will return the actual textual value of this
This returns the hash code for this
This will set the type of the
This sets the local name of the
This sets this
This will set the parent of this
This will set the value of the
This returns a boolean
form, and if no conversion
can occur, throws a
{
getDocument()
{
getDoubleValue()
double
form, and if no conversion
can occur, throws a
{
getFloatValue()
float
form, and if no conversion
can occur, throws a
{
getIntValue()
int
form, and if no conversion
can occur, throws a
{
getLongValue()
long
form, and if no conversion
can occur, throws a
{
getName()
Attribute
.
getNamespace()
Attribute
's
{
getNamespacePrefix()
Attribute
.
getNamespaceURI()
Attribute
's
prefix.
getParent()
Attribute
.
getQualifiedName()
Attribute
.
getValue()
Attribute
.
hashCode()
Attribute
.
setAttributeType(int)
Attribute
.
setName(String)
Attribute
.
setNamespace(Namespace)
Attribute
's {
setParent(Element)
Attribute
.
setValue(String)
Attribute
.
toString()
String
representation of the
Attribute
, suitable for debugging.
public static final int UNDECLARED_ATTRIBUTE
Attribute type: the attribute has not been declared or type is unknown.
public static final int CDATA_ATTRIBUTE
Attribute type: the attribute value is a string.
public static final int ID_ATTRIBUTE
Attribute type: the attribute value is a unique identifier.
public static final int IDREF_ATTRIBUTE
Attribute type: the attribute value is a reference to a unique identifier.
public static final int IDREFS_ATTRIBUTE
Attribute type: the attribute value is a list of references to unique identifiers.
public static final int ENTITY_ATTRIBUTE
Attribute type: the attribute value is the name of an entity.
public static final int ENTITIES_ATTRIBUTE
Attribute type: the attribute value is a list of entity names.
public static final int NMTOKEN_ATTRIBUTE
Attribute type: the attribute value is a name token.
According to SAX 2.0 specification, attributes of enumerated types should be reported as "NMTOKEN" by SAX parsers. But the major parsers (Xerces and Crimson) provide specific values that permit to recognize them as {@link #ENUMERATED_ATTRIBUTE}.
public static final int NMTOKENS_ATTRIBUTE
Attribute type: the attribute value is a list of name tokens.
public static final int NOTATION_ATTRIBUTE
Attribute type: the attribute value is the name of a notation.
public static final int ENUMERATED_ATTRIBUTE
Attribute type: the attribute value is a name token from an enumeration.
protected String name
Attribute
protected transient Namespace namespace
{@link Namespace}
of the Attribute
protected String value
Attribute
protected int type
Attribute
protected Object parent
protected Attribute()
Default, no-args constructor for implementations to use if needed.
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
{@link Namespace}
.
String
name of Attribute
.
String
value for new attribute.
Namespace
namespace for new attribute.
public Attribute(String name, String value, int type, Namespace namespace)
This will create a new Attribute
with the
specified (local) name, value, and type, and in the provided
{@link Namespace}
.
String
name of Attribute
.
String
value for new attribute.
int
type for new attribute.
Namespace
namespace 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 {@link Namespace}
.
Note: This actually explicitly puts the
Attribute
in the "empty" Namespace
({@link Namespace#NO_NAMESPACE}
).
String
name of Attribute
.
String
value for new attribute.
public Attribute(String name, String value, int type)
This will create a new Attribute
with the
specified (local) name, value and type, and does not place
the attribute in a {@link Namespace}
.
Note: This actually explicitly puts the
Attribute
in the "empty" Namespace
({@link Namespace#NO_NAMESPACE}
).
String
name of Attribute
.
String
value for new attribute.
int
type for new attribute.
public Element getParent()
This will return the parent of this Attribute
.
If there is no parent, then this returns null
.
Attribute
public Document getDocument()
This retrieves the owning {@link Document}
for
this Attribute, or null if not a currently a member of a
{@link Document}
.
Document
owning this Attribute, or null.
protected Attribute setParent(Element parent)
This will set the parent of this Attribute
.
Element
to be new parent.
Attribute
modified.
public Attribute detach()
This detaches the Attribute
from its parent, or does
nothing if the Attribute
has no parent.
Attribute
- this Attribute
modified.
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
{@link #getNamespacePrefix()}
method should be used.
String
- name of this attribute,
without any namespace prefix.
public Attribute setName(String name)
This sets the local name of the Attribute
.
Attribute
- the attribute modified.
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
{@link #getName()}
method should be used.
To obtain the namespace prefix for this attribute,
the {@link #getNamespacePrefix()}
method should be used.
String
- full name for this element.
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 Namespace getNamespace()
This will return this Attribute
's
{@link Namespace}
.
Namespace
- Namespace object for this Attribute
public Attribute setNamespace(Namespace namespace)
This sets this Attribute
's {@link Namespace}
.
If the provided namespace is null, the attribute will have no namespace.
The namespace must have a prefix.
Element
- the element modified.
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 Attribute setValue(String value)
This will set the value of the Attribute
.
String
value for the attribute.
Attribute
- this Attribute modified.
public int getAttributeType()
This will return the actual declared type of this
Attribute
.
int
- type for this attribute.
public Attribute setAttributeType(int type)
This will set the type of the Attribute
.
int
type for the attribute.
Attribute
- this Attribute modified.
public String toString()
This returns a String
representation of the
Attribute
, suitable for debugging.
String
- information about the
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 final int hashCode()
This returns the hash code for this Attribute
.
int
- hash code.
public Object clone()
This will return a clone of this Attribute
.
Object
- clone of this Attribute
.
public int getIntValue() throws DataConversionException
This gets the value of the attribute, in
int
form, and if no conversion
can occur, throws a
{@link DataConversionException}
int
value of attribute.
public long getLongValue() throws DataConversionException
This gets the value of the attribute, in
long
form, and if no conversion
can occur, throws a
{@link DataConversionException}
long
value of attribute.
public float getFloatValue() throws DataConversionException
This gets the value of the attribute, in
float
form, and if no conversion
can occur, throws a
{@link DataConversionException}
float
value of attribute.
public double getDoubleValue() throws DataConversionException
This gets the value of the attribute, in
double
form, and if no conversion
can occur, throws a
{@link DataConversionException}
double
value of attribute.
public boolean getBooleanValue() throws DataConversionException
This gets the value of the attribute, in
boolean
form, and if no conversion
can occur, throws a
{@link DataConversionException}
boolean
value of attribute.
All Packages Class Hierarchy This Package Previous Next Index