Main Page | Class Hierarchy | Class List | Class Members | Related Pages

org::jdom::Attribute Class Reference

List of all members.

Public Member Functions

 Attribute (String name, String value, Namespace namespace)
 Attribute (String name, String value, int type, Namespace namespace)
 Attribute (String name, String value)
 Attribute (String name, String value, int type)
Element getParent ()
Document getDocument ()
Attribute detach ()
String getName ()
Attribute setName (String name)
String getQualifiedName ()
String getNamespacePrefix ()
String getNamespaceURI ()
Namespace getNamespace ()
Attribute setNamespace (Namespace namespace)
String getValue ()
Attribute setValue (String value)
int getAttributeType ()
Attribute setAttributeType (int type)
String toString ()
final boolean equals (Object ob)
final int hashCode ()
Object clone ()
int getIntValue () throws DataConversionException
long getLongValue () throws DataConversionException
float getFloatValue () throws DataConversionException
double getDoubleValue () throws DataConversionException
boolean getBooleanValue () throws DataConversionException

Static Public Attributes

final int UNDECLARED_ATTRIBUTE = 0
final int CDATA_ATTRIBUTE = 1
final int ID_ATTRIBUTE = 2
final int IDREF_ATTRIBUTE = 3
final int IDREFS_ATTRIBUTE = 4
final int ENTITY_ATTRIBUTE = 5
final int ENTITIES_ATTRIBUTE = 6
final int NMTOKEN_ATTRIBUTE = 7
final int NMTOKENS_ATTRIBUTE = 8
final int NOTATION_ATTRIBUTE = 9
final int ENUMERATED_ATTRIBUTE = 10

Protected Member Functions

 Attribute ()
Attribute setParent (Element parent)

Protected Attributes

String name
String value
int type = UNDECLARED_ATTRIBUTE
Object parent

Detailed Description

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.

Author:
Brett McLaughlin

Jason Hunter

Elliotte Rusty Harold

Wesley Biggs

Version:
Revision
1.45
,
Date
2003/04/06 02:00:44


Constructor & Destructor Documentation

org::jdom::Attribute::Attribute  )  [inline, protected]
 

Default, no-args constructor for implementations to use if needed.

org::jdom::Attribute::Attribute String  name,
String  value,
Namespace  namespace
[inline]
 

This will create a new Attribute with the specified (local) name and value, and in the provided Namespace.

Parameters:
name String name of Attribute.
value String value for new attribute.
namespace Namespace namespace for new attribute.
Exceptions:
IllegalNameException if the given name is illegal as an attribute name or if if the new namespace is the default namespace. Attributes cannot be in a default namespace.
IllegalDataException if the given attribute value is illegal character data (as determined by org.jdom.Verifier#checkCharacterData).

org::jdom::Attribute::Attribute String  name,
String  value,
int  type,
Namespace  namespace
[inline]
 

This will create a new Attribute with the specified (local) name, value, and type, and in the provided Namespace.

Parameters:
name String name of Attribute.
value String value for new attribute.
type int type for new attribute.
namespace Namespace namespace for new attribute.
Exceptions:
IllegalNameException if the given name is illegal as an attribute name or if if the new namespace is the default namespace. Attributes cannot be in a default namespace.
IllegalDataException if the given attribute value is illegal character data (as determined by org.jdom.Verifier#checkCharacterData) or if the given attribute type is not one of the supported types.

org::jdom::Attribute::Attribute String  name,
String  value
[inline]
 

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).

Parameters:
name String name of Attribute.
value String value for new attribute.
Exceptions:
IllegalNameException if the given name is illegal as an attribute name.
IllegalDataException if the given attribute value is illegal character data (as determined by org.jdom.Verifier#checkCharacterData).

org::jdom::Attribute::Attribute String  name,
String  value,
int  type
[inline]
 

This will create a new Attribute with the specified (local) name, value and type, and does not place the attribute in a Namespace.

Note: This actually explicitly puts the Attribute in the "empty" Namespace (Namespace#NO_NAMESPACE).

Parameters:
name String name of Attribute.
value String value for new attribute.
type int type for new attribute.
Exceptions:
IllegalNameException if the given name is illegal as an attribute name.
IllegalDataException if the given attribute value is illegal character data (as determined by org.jdom.Verifier#checkCharacterData) or if the given attribute type is not one of the supported types.


Member Function Documentation

Object org::jdom::Attribute::clone  )  [inline]
 

This will return a clone of this Attribute.

Returns:
Object - clone of this Attribute.

Attribute org::jdom::Attribute::detach  )  [inline]
 

This detaches the Attribute from its parent, or does nothing if the Attribute has no parent.

Returns:
Attribute - this Attribute modified.

final boolean org::jdom::Attribute::equals Object  ob  )  [inline]
 

This tests for equality of this Attribute to the supplied Object.

Parameters:
ob Object to compare to.
Returns:
boolean - whether the Attribute is equal to the supplied Object.

int org::jdom::Attribute::getAttributeType  )  [inline]
 

This will return the actual declared type of this Attribute.

Returns:
int - type for this attribute.

boolean org::jdom::Attribute::getBooleanValue  )  throws DataConversionException [inline]
 

This gets the value of the attribute, in boolean form, and if no conversion can occur, throws a DataConversionException

Returns:
boolean value of attribute.
Exceptions:
DataConversionException when conversion fails.

Document org::jdom::Attribute::getDocument  )  [inline]
 

This retrieves the owning Document for this Attribute, or null if not a currently a member of a Document.

Returns:
Document owning this Attribute, or null.

double org::jdom::Attribute::getDoubleValue  )  throws DataConversionException [inline]
 

This gets the value of the attribute, in double form, and if no conversion can occur, throws a DataConversionException

Returns:
double value of attribute.
Exceptions:
DataConversionException when conversion fails.

float org::jdom::Attribute::getFloatValue  )  throws DataConversionException [inline]
 

This gets the value of the attribute, in float form, and if no conversion can occur, throws a DataConversionException

Returns:
float value of attribute.
Exceptions:
DataConversionException when conversion fails.

int org::jdom::Attribute::getIntValue  )  throws DataConversionException [inline]
 

This gets the value of the attribute, in int form, and if no conversion can occur, throws a DataConversionException

Returns:
int value of attribute.
Exceptions:
DataConversionException when conversion fails.

long org::jdom::Attribute::getLongValue  )  throws DataConversionException [inline]
 

This gets the value of the attribute, in long form, and if no conversion can occur, throws a DataConversionException

Returns:
long value of attribute.
Exceptions:
DataConversionException when conversion fails.

String org::jdom::Attribute::getName  )  [inline]
 

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.

Returns:
String - name of this attribute, without any namespace prefix.

Namespace org::jdom::Attribute::getNamespace  )  [inline]
 

This will return this Attribute's Namespace.

Returns:
Namespace - Namespace object for this Attribute

String org::jdom::Attribute::getNamespacePrefix  )  [inline]
 

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.

Returns:
String - namespace prefix of this attribute.

String org::jdom::Attribute::getNamespaceURI  )  [inline]
 

This returns the URI mapped to this Attribute's prefix. If no mapping is found, an empty String is returned.

Returns:
String - namespace URI for this Attribute.

Element org::jdom::Attribute::getParent  )  [inline]
 

This will return the parent of this Attribute. If there is no parent, then this returns null.

Returns:
parent of this Attribute

String org::jdom::Attribute::getQualifiedName  )  [inline]
 

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.

Returns:
String - full name for this element.

String org::jdom::Attribute::getValue  )  [inline]
 

This will return the actual textual value of this Attribute. This will include all text within the quotation marks.

Returns:
String - value for this attribute.

final int org::jdom::Attribute::hashCode  )  [inline]
 

This returns the hash code for this Attribute.

Returns:
int - hash code.

Attribute org::jdom::Attribute::setAttributeType int  type  )  [inline]
 

This will set the type of the Attribute.

Parameters:
type int type for the attribute.
Returns:
Attribute - this Attribute modified.
Exceptions:
IllegalDataException if the given attribute type is not one of the supported types.

Attribute org::jdom::Attribute::setName String  name  )  [inline]
 

This sets the local name of the Attribute.

Returns:
Attribute - the attribute modified.
Exceptions:
IllegalNameException if the given name is illegal as an attribute name.

Attribute org::jdom::Attribute::setNamespace Namespace  namespace  )  [inline]
 

This sets this Attribute's Namespace. If the provided namespace is null, the attribute will have no namespace. The namespace must have a prefix.

Returns:
Element - the element modified.
Exceptions:
IllegalNameException if the new namespace is the default namespace. Attributes cannot be in a default namespace.

Attribute org::jdom::Attribute::setParent Element  parent  )  [inline, protected]
 

This will set the parent of this Attribute.

Parameters:
parent Element to be new parent.
Returns:
this Attribute modified.

Attribute org::jdom::Attribute::setValue String  value  )  [inline]
 

This will set the value of the Attribute.

Parameters:
value String value for the attribute.
Returns:
Attribute - this Attribute modified.
Exceptions:
IllegalDataException if the given attribute value is illegal character data (as determined by org.jdom.Verifier#checkCharacterData).

String org::jdom::Attribute::toString  )  [inline]
 

This returns a String representation of the Attribute, suitable for debugging.

Returns:
String - information about the Attribute


Member Data Documentation

final int org::jdom::Attribute::CDATA_ATTRIBUTE = 1 [static]
 

Attribute type: the attribute value is a string.

See also:
getAttributeType

final int org::jdom::Attribute::ENTITIES_ATTRIBUTE = 6 [static]
 

Attribute type: the attribute value is a list of entity names.

See also:
getAttributeType

final int org::jdom::Attribute::ENTITY_ATTRIBUTE = 5 [static]
 

Attribute type: the attribute value is the name of an entity.

See also:
getAttributeType

final int org::jdom::Attribute::ENUMERATED_ATTRIBUTE = 10 [static]
 

Attribute type: the attribute value is a name token from an enumeration.

See also:
getAttributeType

final int org::jdom::Attribute::ID_ATTRIBUTE = 2 [static]
 

Attribute type: the attribute value is a unique identifier.

See also:
getAttributeType

final int org::jdom::Attribute::IDREF_ATTRIBUTE = 3 [static]
 

Attribute type: the attribute value is a reference to a unique identifier.

See also:
getAttributeType

final int org::jdom::Attribute::IDREFS_ATTRIBUTE = 4 [static]
 

Attribute type: the attribute value is a list of references to unique identifiers.

See also:
getAttributeType

String org::jdom::Attribute::name [protected]
 

The local name of the Attribute

final int org::jdom::Attribute::NMTOKEN_ATTRIBUTE = 7 [static]
 

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 ENUMERATED_ATTRIBUTE.

See also:
getAttributeType

final int org::jdom::Attribute::NMTOKENS_ATTRIBUTE = 8 [static]
 

Attribute type: the attribute value is a list of name tokens.

See also:
getAttributeType

final int org::jdom::Attribute::NOTATION_ATTRIBUTE = 9 [static]
 

Attribute type: the attribute value is the name of a notation.

See also:
getAttributeType

Object org::jdom::Attribute::parent [protected]
 

Parent element, or null if none

int org::jdom::Attribute::type = UNDECLARED_ATTRIBUTE [protected]
 

The type of the Attribute

final int org::jdom::Attribute::UNDECLARED_ATTRIBUTE = 0 [static]
 

Attribute type: the attribute has not been declared or type is unknown.

See also:
getAttributeType

String org::jdom::Attribute::value [protected]
 

The value of the Attribute


The documentation for this class was generated from the following file:
Generated on Tue Oct 26 18:17:01 2004 for JDOM by  doxygen 1.3.9.1