Class Attribute.Type
- Enclosing class:
Attribute
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
FieldsModifier and TypeFieldDescriptionstatic final Attribute.Type
The type of attributes declared to have type CDATA in the DTD.static final Attribute.Type
The type of attributes declared to have type ENTITIES in the DTD.static final Attribute.Type
The type of attributes declared to have type ENTITY in the DTD.static final Attribute.Type
The type of attributes declared by an enumeration in the DTD.static final Attribute.Type
The type of attributes declared to have type ID in the DTD.static final Attribute.Type
The type of attributes declared to have type IDREF in the DTD.static final Attribute.Type
The type of attributes declared to have type IDREFS in the DTD.static final Attribute.Type
The type of attributes declared to have type NMTOKEN in the DTD.static final Attribute.Type
The type of attributes declared to have type NMTOKENS in the DTD.static final Attribute.Type
The type of attributes declared to have type NOTATION in the DTD.static final Attribute.Type
The type of attributes not declared in the DTD. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests for type equality.getName()
Returns the string name of this type as might be used in a DTD; for example, "ID", "CDATA", etc.int
hashCode()
Returns a unique identifier for this type.toString()
Returns a string representation of the type suitable for debugging and diagnosis.
-
Field Details
-
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
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
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
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
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
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
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
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
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
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
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 Details
-
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.
-
equals
Tests for type equality. This is only necessary, to handle the case where two
Type
objects are loaded by different class loaders. -
toString
Returns a string representation of the type suitable for debugging and diagnosis.
-