JDOM 1.x Compatibility Note:
The Attribute class in JDOM 1.x had a number of int Constants declared to
represent different Attribute Types. JDOM2 has introduced an AttributeType
enumeration instead. To facilitate compatibility and to simplify JDOM 1.x
migrations, the replacement AttributeType enums are referenced still using
the JDOM 1.x constant names. In JDOM 1.x these names referenced constant
int values. In JDOM2 these names reference Enum constants.
| Modifier and Type | Field and Description |
|---|---|
| public static final AttributeType | CDATA_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | ENTITIES_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | ENTITY_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | ENUMERATED_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | ID_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | IDREF_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | IDREFS_TYPE
JDOM 1.x compatible reference to |
| protected String | name
The local name of the |
| protected Namespace | |
| public static final AttributeType | NMTOKEN_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | NMTOKENS_TYPE
JDOM 1.x compatible reference to |
| public static final AttributeType | NOTATION_TYPE
JDOM 1.x compatible reference to |
| protected transient Element | parent
The parent to which this Attribute belongs. |
| private static final long | serialVersionUID
JDOM 2.0.0 Serialization version. |
| protected boolean | specified
Specified attributes are part of the XML, unspecified attributes are 'defaulted' from a DTD. |
| protected AttributeType | type
The type of the |
| public static final AttributeType | UNDECLARED_TYPE
JDOM 1.x compatible reference to |
| protected String | value
The value of the |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | |
| public | Attribute(final String
String name of Attribute.String value for new attribute.int type for new attribute.Namespace namespace for new attribute.
Deprecated
Use
This will create a new Attribute(String, String, AttributeType, Namespace).
Attribute with the
specified (local) name, value, and type, and in the provided
.
|
| public | Attribute(final String
String name of Attribute.String value for new attribute.AttributeType for new attribute.Namespace namespace for new attribute.This will create a new |
| public | |
| public | Attribute(final String
String name of Attribute.String value for new attribute.AttributeType for new attribute.This will create a new |
| public | Attribute(final String
String name of Attribute.String value for new attribute.int type for new attribute.
Deprecated
Use
This will create a new Attribute(String, String, AttributeType)
Attribute with the
specified (local) name, value and type, and does not place
the attribute in a .
|
| Modifier and Type | Method and Description |
|---|---|
| public Attribute | |
| public Attribute | |
| public AttributeType | Returns: AttributeType - type for this attribute.This will return the declared type of this |
| public boolean | Returns: boolean value of attribute.This gets the effective boolean value of the attribute, or throws a
|
| public Document | Returns: The document to which this Attribute is associated, may be null.Get this Attribute's Document. |
| public double | Returns: double value of attribute.This gets the value of the attribute, in
|
| public float | Returns: float value of attribute.This gets the value of the attribute, in
|
| public int | Returns: int value of attribute.This gets the value of the attribute, in
|
| public long | Returns: long value of attribute.This gets the value of the attribute, in
|
| public String | Returns: String - name of this attribute,
without any namespace prefix.This will retrieve the local name of the
|
| public Namespace | Returns: Namespace - Namespace object for this AttributeThis will return this |
| public String | Returns: String - namespace prefix of this
attribute.This will retrieve the namespace prefix of the
|
| public List | getNamespacesInherited()
Implements org. |
| public List | getNamespacesInScope()
Implements org. |
| public List | getNamespacesIntroduced()
Implements org. |
| public String | Returns: String - namespace URI for this Attribute.This returns the URI mapped to this |
| public Element | |
| public String | Returns: String - full name for this element.This will retrieve the qualified name of the |
| public String | Returns: String - value for this attribute.This will return the actual textual value of this
|
| public boolean | |
| private static final List | |
| public Attribute | Returns: Attribute - this Attribute modified.int type for the attribute.This will set the type of the |
| public Attribute | Returns: Attribute - this Attribute modified.int type for the attribute.
Deprecated
use
This will set the type of the setAttributeType(AttributeType)
Attribute.
|
| public Attribute | |
| public Attribute | Returns: Element - the element modified.the new namespace namespace)This sets this |
| protected Attribute | |
| public void | setSpecified(boolean
The value to set the specified flag to. specified)Change the specified flag to the given value. |
| public Attribute | |
| public String | Returns: String - information about the
AttributeOverrides java. String representation of the
Attribute, suitable for debugging.
|
| CDATA_TYPE | back to summary |
|---|---|
| public static final AttributeType CDATA_TYPE JDOM 1.x compatible reference to | |
| ENTITIES_TYPE | back to summary |
|---|---|
| public static final AttributeType ENTITIES_TYPE JDOM 1.x compatible reference to | |
| ENTITY_TYPE | back to summary |
|---|---|
| public static final AttributeType ENTITY_TYPE JDOM 1.x compatible reference to | |
| ENUMERATED_TYPE | back to summary |
|---|---|
| public static final AttributeType ENUMERATED_TYPE JDOM 1.x compatible reference to | |
| ID_TYPE | back to summary |
|---|---|
| public static final AttributeType ID_TYPE JDOM 1.x compatible reference to | |
| IDREF_TYPE | back to summary |
|---|---|
| public static final AttributeType IDREF_TYPE JDOM 1.x compatible reference to | |
| IDREFS_TYPE | back to summary |
|---|---|
| public static final AttributeType IDREFS_TYPE JDOM 1.x compatible reference to | |
| name | back to summary |
|---|---|
| protected String name The local name of the | |
| namespace | back to summary |
|---|---|
| protected Namespace namespace The | |
| NMTOKEN_TYPE | back to summary |
|---|---|
| public static final AttributeType NMTOKEN_TYPE JDOM 1.x compatible reference to | |
| NMTOKENS_TYPE | back to summary |
|---|---|
| public static final AttributeType NMTOKENS_TYPE JDOM 1.x compatible reference to | |
| NOTATION_TYPE | back to summary |
|---|---|
| public static final AttributeType NOTATION_TYPE JDOM 1.x compatible reference to | |
| parent | back to summary |
|---|---|
| protected transient Element parent The parent to which this Attribute belongs. Change it with
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID JDOM 2.0.0 Serialization version. Attribute is simple | |
| specified | back to summary |
|---|---|
| protected boolean specified Specified attributes are part of the XML, unspecified attributes are 'defaulted' from a DTD. | |
| type | back to summary |
|---|---|
| protected AttributeType type The type of the | |
| UNDECLARED_TYPE | back to summary |
|---|---|
| public static final AttributeType UNDECLARED_TYPE JDOM 1.x compatible reference to | |
| value | back to summary |
|---|---|
| protected String value The value of the | |
| Attribute | back to summary |
|---|---|
| protected Attribute() Default, no-args constructor for implementations to use if needed. | |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value, final Namespace namespace) This will create a new
| |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value, final int type, final Namespace namespace)
Deprecated This will create a new
| |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value, final AttributeType type, final Namespace namespace) This will create a new
| |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value) This will create a new Note This actually explicitly puts the
| |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value, final AttributeType type) This will create a new Note This actually explicitly puts the
| |
| Attribute | back to summary |
|---|---|
| public Attribute(final String name, final String value, final int type)
Deprecated This will create a new Note This actually explicitly puts the
| |
| clone | back to summary |
|---|---|
| public Attribute clone() Overrides org. Doc from org. Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not. All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value). Subclasses of this should still call super.clone() in their clone method.
| |
| detach | back to summary |
|---|---|
| public Attribute detach() Detach this Attribute from its parent.
| |
| getAttributeType | back to summary |
|---|---|
| public AttributeType getAttributeType() This will return the declared type of this
| |
| getBooleanValue | back to summary |
|---|---|
| public boolean getBooleanValue() throws DataConversionException This gets the effective boolean value of the attribute, or throws a
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Get this Attribute's Document.
| |
| getDoubleValue | back to summary |
|---|---|
| public double getDoubleValue() throws DataConversionException This gets the value of the attribute, in
| |
| getFloatValue | back to summary |
|---|---|
| public float getFloatValue() throws DataConversionException This gets the value of the attribute, in
| |
| getIntValue | back to summary |
|---|---|
| public int getIntValue() throws DataConversionException This gets the value of the attribute, in
| |
| getLongValue | back to summary |
|---|---|
| public long getLongValue() throws DataConversionException This gets the value of the attribute, in
| |
| getName | back to summary |
|---|---|
| public String getName() This will retrieve the local name of the
To obtain the namespace prefix for this
attribute, the
| |
| getNamespace | back to summary |
|---|---|
| public Namespace getNamespace() This will return this
| |
| getNamespacePrefix | back to summary |
|---|---|
| public String getNamespacePrefix() This will retrieve the namespace prefix of the
| |
| getNamespacesInherited | back to summary |
|---|---|
| public List Implements org. Doc from org. Obtain a list of all namespaces that are in scope for this content, but were not introduced by this content. The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesIntroduced() | |
| getNamespacesInScope | back to summary |
|---|---|
| public List Implements org. Doc from org. Get the namespaces that are in-scope on this Attribute. Attribute has peculiarities that affect the in-scope Namespaces because there are conditions in which the Attribute's scope is different to its parent Element's scope. Specifically, if the parent Element is in a 'default' Namespace that is not the empty Namespace (e.g. xmlns="someurl") and this Attribute is also in the default Namespace (has no prefix - but for Attributes that means the Namespace URL is ""), then this Attribute has a different namespace scope from its parent Element because it does not include the 'someurl' Namespace.
In the above conditions (no-prefix Attribute in an Element with a
non-empty no-prefix Namespace) this Attribute effectively re-binds the ""
prefix to the "" URL, thus the Attribute 'introduces' the Namespace.
It follows then that the getNamespacesIntroduced() will return a list
with the single member Note that the Attribute's Namespace will always be reported first.
Description copied from
Obtain a list of all namespaces that are in scope for the current content. The contents of this list will always be the combination of getNamespacesIntroduced() and getNamespacesInherited().
See | |
| getNamespacesIntroduced | back to summary |
|---|---|
| public List Implements org. Doc from org. Obtain a list of all namespaces that are introduced to the XML tree by this node. Only Elements and Attributes can introduce namespaces, so all other Content types will return an empty list. The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesInherited() | |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI() This returns the URI mapped to this
| |
| getParent | back to summary |
|---|---|
| public Element getParent() This will return the parent of this
| |
| getQualifiedName | back to summary |
|---|---|
| public String getQualifiedName() This will retrieve the qualified name of the
To obtain the local name of the attribute, the
To obtain the namespace prefix for this attribute,
the
| |
| getValue | back to summary |
|---|---|
| public String getValue() This will return the actual textual value of this
| |
| isSpecified | back to summary |
|---|---|
| public boolean isSpecified() Get the 'specified' flag. True values indicate this attribute was part of an XML document, false indicates it was defaulted from a DTD.
| |
| orderFirst | back to summary |
|---|---|
| private static final List | |
| setAttributeType | back to summary |
|---|---|
| public Attribute setAttributeType(final AttributeType type) This will set the type of the
| |
| setAttributeType | back to summary |
|---|---|
| public Attribute setAttributeType(final int type)
Deprecated This will set the type of the
| |
| setName | back to summary |
|---|---|
| public Attribute setName(final String name) This sets the local name of the
| |
| setNamespace | back to summary |
|---|---|
| public Attribute setNamespace(Namespace namespace) This sets this
| |
| setParent | back to summary |
|---|---|
| protected Attribute setParent(Element parent) Set this Attribute's parent. This is not public! | |
| setSpecified | back to summary |
|---|---|
| public void setSpecified(boolean specified) Change the specified flag to the given value.
| |
| setValue | back to summary |
|---|---|
| public Attribute setValue(final String value) This will set the value of the
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. This returns a | |