nu.xom

Class Attribute.Type

Object
  extended by nu.xom.Attribute.Type
Enclosing class:
Attribute

public static final class Attribute.Type
extends Object

Uses the type-safe enumeration design pattern to represent attribute types, as specified by XML DTDs.

XOM enforces well-formedness, but it does not enforce validity. Thus it is possible for a single element to have multiple ID type attributes, or ID type attributes on different elements to have the same value, or NMTOKEN type attributes that don't contain legal XML name tokens, and so forth.

Version:
1.0
Author:
Elliotte Rusty Harold

Field Summary
static Attribute.TypeCDATA

           The type of attributes declared to have type CDATA in the DTD.
static Attribute.TypeENTITIES

           The type of attributes declared to have type ENTITIES in the DTD.
static Attribute.TypeENTITY

           The type of attributes declared to have type ENTITY in the DTD.
static Attribute.TypeENUMERATION

           The type of attributes declared by an enumeration in the DTD.
static Attribute.TypeID

           The type of attributes declared to have type ID in the DTD.
static Attribute.TypeIDREF

           The type of attributes declared to have type IDREF in the DTD.
static Attribute.TypeIDREFS

           The type of attributes declared to have type IDREFS in the DTD.
static Attribute.TypeNMTOKEN

           The type of attributes declared to have type NMTOKEN in the DTD.
static Attribute.TypeNMTOKENS

           The type of attributes declared to have type NMTOKENS in the DTD.
static Attribute.TypeNOTATION

           The type of attributes declared to have type NOTATION in the DTD.
static Attribute.TypeUNDECLARED

           The type of attributes not declared in the DTD.
 
Method Summary
 booleanequals(Object o)

           Tests for type equality.
 StringgetName()

           Returns the string name of this type as might be used in a DTD; for example, "ID", "CDATA", etc.
 inthashCode()

           Returns a unique identifier for this type.
 StringtoString()

           Returns a string representation of the type suitable for debugging and diagnosis.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CDATA

public static final Attribute.Type CDATA

The type of attributes declared to have type CDATA in the DTD. The most general attribute type. All well-formed attribute values are valid for attributes of type CDATA.


ID

public static final Attribute.Type ID

The type of attributes declared to have type ID in the DTD. In order to be valid, an ID type attribute must contain an XML name which is unique among other ID type attributes in the document. Furthermore, each element may contain no more than one ID type attribute. However, XOM does not enforce such validity constraints.


IDREF

public static final Attribute.Type IDREF

The type of attributes declared to have type IDREF in the DTD. In order to be valid, an IDREF type attribute must contain an XML name which is also the value of ID type attribute of some element in the document. However, XOM does not enforce such validity constraints.


IDREFS

public static final Attribute.Type IDREFS

The type of attributes declared to have type IDREFS in the DTD. In order to be valid, an IDREFS type attribute must contain a white space separated list of XML names, each of which is also the value of ID type attribute of some element in the document. However, XOM does not enforce such validity constraints.


NMTOKEN

public static final Attribute.Type NMTOKEN

The type of attributes declared to have type NMTOKEN in the DTD. In order to be valid, a NMTOKEN type attribute must contain a single XML name token. However, XOM does not enforce such validity constraints.


NMTOKENS

public static final Attribute.Type NMTOKENS

The type of attributes declared to have type NMTOKENS in the DTD. In order to be valid, a NMTOKENS type attribute must contain a white space separated list of XML name tokens. However, XOM does not enforce such validity constraints.


NOTATION

public static final Attribute.Type NOTATION

The type of attributes declared to have type NOTATION in the DTD. In order to be valid, a NOTATION type attribute must contain the name of a notation declared in the DTD. However, XOM does not enforce such validity constraints.


ENTITY

public static final Attribute.Type ENTITY

The type of attributes declared to have type ENTITY in the DTD. In order to be valid, a ENTITY type attribute must contain the name of an unparsed entity declared in the DTD. However, XOM does not enforce such validity constraints.


ENTITIES

public static final Attribute.Type ENTITIES

The type of attributes declared to have type ENTITIES in the DTD. In order to be valid, an ENTITIES type attribute must contain a white space separated list of names of unparsed entities declared in the DTD. However, XOM does not enforce such validity constraints.


ENUMERATION

public static final Attribute.Type ENUMERATION

The type of attributes declared by an enumeration in the DTD. In order to be valid, a enumeration type attribute must contain exactly one of the names given in the enumeration in the DTD. However, XOM does not enforce such validity constraints.

Most parsers report attributes of type enumeration as having type NMTOKEN. In this case, XOM will not distinguish NMTOKEN and enumerated attributes.


UNDECLARED

public static final Attribute.Type UNDECLARED

The type of attributes not declared in the DTD. This type only appears in invalid documents. This is the default type for all attributes in documents without DTDs.

Most parsers report attributes of undeclared type as having type CDATA. In this case, XOM will not distinguish CDATA and undeclared attributes.

Method Detail

getName

public String getName()

Returns the string name of this type as might be used in a DTD; for example, "ID", "CDATA", etc.

Returns:
an XML string representation of this type

hashCode

public int hashCode()

Returns a unique identifier for this type.

Overrides:
hashCode in class Object
Returns:
a unique identifier for this type
See Also:
Object.hashCode()

equals

public boolean equals(Object o)

Tests for type equality. This is only necessary, to handle the case where two Type objects are loaded by different class loaders.

Overrides:
equals in class Object
Parameters:
o - the object compared for equality to this type
Returns:
true if and only if o represents the same type
See Also:
Object.equals(Object)

toString

public String toString()

Returns a string representation of the type suitable for debugging and diagnosis.

Overrides:
toString in class Object
Returns:
a non-XML string representation of this type
See Also:
Object.toString()


Copyright 2002-2010 Elliotte Rusty Harold

elharo@ibiblio.org