* Specification

[[manakai//DOM Extensions]] > 
[[DOM XML Document Type Definition]] module > 
The [CODE(DOMi)@en[[[AttributeDefinition]]]] interface

** Modifications to [CODE(DOMi)@en[[[Node]]]] members

[3] The getter of the [CODE(DOMa)@en[[[attributes]]]] attribute
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object
[['''MUST''']] return [CODE(IDL)@en[[[null]]]].

[9] The getter of the [CODE(DOMa)@en[[[baseURI]]]] attribute
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object
[['''MUST''']] return the [CODE(DOMa)@en[[[baseURI]]]]
of the [CDOE(DOMa)@en[[[ownerDocument]]]] of the
[CODE(DOMi)@en[[[AttributeDefinition]]]] object.
Note that it might be [CODE(IDL)@en[[[null]]]].

[1] The getter of the [CODE(DOMa)@en[[[nodeName]]]] attribute
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object
[['''MUST''']] return the name of the attribute.

[2] The getter of the [CODE(DOMa)@en[[[nodeValue]]]] attribute
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object
[['''MUST''']] return the normalized default value
of the attribute.

@@

[4] The getter of the [CODE(DOMa)@en[[[textContent]]]]
attribute of an [CODE(DOMi)@en[[[AttributeDefinition]]]] 
object [['''MUST''']] behave as if it were an
[CODE(DOMi)@en[[[Attr]]]] object.

The setter of the [CODE(DOMa)@en[[[textContent]]]] attribute
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object
[['''MUST''']] behave as if the following algorithm
is performed:
= If the [CODE(DOMi)@en[[[AttributeDefinition]]]]
object is read-only, then throw an
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]].
= Remove any child node the node has.
= If the new value is not empty and not [CODE(IDL)@en[[[null]]]],
then create a [CODE(DOMi)@en[[[Text]]]] node
whose [CODE(DOMa)@en[[[data]]]] is the new value
and append it to the [CODE(DOMi)@en[[[AttributeDefinition]]]].

** Definition groups

[6] The
[DFN@en[definition group [CODE(DOM)@en[[[DeclaredValueType]]]]]]
contains integers indicating the type of 
attribute value:
,[CODE(DOMc)@en[[[NO_TYPE_ATTR]]]],[CODE(IDL)[[[0]]]],The attribute value type corresponding to [[no value]] in XML Information Set.
,[CODE(DOMc)@en[[[CDATA_ATTR]]]],[CODE(IDL)[[[1]]]],The attribute value type is [CODE(XML)@en[[[CDATA]]]].
,[CODE(DOMc)@en[[[ID_ATTR]]]],[CODE(IDL)[[[2]]]],The attribute value type is [CODE(XML)@en[[[ID]]]].
,[CODE(DOMc)@en[[[IDREF_ATTR]]]],[CODE(IDL)[[[3]]]],The attribute value type is [CODE(XML)@en[[[IDREF]]]].
,[CODE(DOMc)@en[[[IDREFS_ATTR]]]],[CODE(IDL)[[[4]]]],The attribute value type is [CODE(XML)@en[[[IDREFS]]]].
,[CODE(DOMc)@en[[[ENTITY_ATTR]]]],[CODE(IDL)[[[5]]]],The attribute value type is [CODE(XML)@en[[[ENTITY]]]].
,[CODE(DOMc)@en[[[ENTITIES_ATTR]]]],[CODE(IDL)[[[6]]]],The attribute value type is [CODE(XML)@en[[[ENTITIES]]]].
,[CODE(DOMc)@en[[[NMTOKEN_ATTR]]]],[CODE(IDL)[[[7]]]],The attribute value type is [CODE(XML)@en[[[NMTOKEN]]]].
,[CODE(DOMc)@en[[[NMTOKENS_ATTR]]]],[CODE(IDL)[[[8]]]],The attribute value type is [CODE(XML)@en[[[NMTOKENS]]]].
,[CODE(DOMc)@en[[[NOTATION_ATTR]]]],[CODE(IDL)[[[9]]]],The attribute value type is [CODE(XML)@en[[[NOTATION]]]].
,[CODE(DOMc)@en[[[ENUMERATION_ATTR]]]],[CODE(IDL)[[[10]]]],The attribute value is enumeration type.
,[CODE(DOMc)@en[[[UNKNOWN_ATTR]]]],[CODE(IDL)[[[11]]]],"The attribute value type is unknown, because no declaration for the attribute has been read but not [CODE(InfoProp)@en[[[all declarations processed]]]] property would be false."

The type of these constants are 
[CODE(IDL)@en[[[unsigned]] [[short]]]].

If no attribute type information is provided,
or if the source of that information does not 
distinguish [[no value]] and [[unknown]] as in
XML Information Set, then the 
[CODE(DOMc)@en[[[NO_TYPE_ATTR]]]] value 
[['''MUST''']] be used.

;; A newly created [CODE(DOMi)@en[[[AttributeDefinition]]]]
object by [CODE(DOMm)@en[[[createAttributeDefinition]]]]
method has [CODE(DOMa)@en[[[declaredType]]]] attribute
set to [CODE(DOMc)@en[[[NO_TYPE_ATTR]]]].

If the source of the attribute type information
does not distinguish [[no value]] and / or [[unknown]]
and [CODE(XML)@en[[[CDATA]]]], then the
[CODE(DOMc)@en[[[CDATA_ATTR]]]] value [['''MUST''']]
be used.

[11]
In Perl binding, the objects implementing the 
[CODE(DOMi)@en[[[Attr]]]] interface [['''MUST''']]
also implement the [CODE(DOM)@en[[[DeclaredValueType]]]]
constant group.

[7] The
[DFN@en[definition group [CODE(DOM)@en[[[DefaultValueType]]]]]]
contains integers indicating the type of 
default attribute value:
,[CODE(DOMc)@en[[[UNKNOWN_DEFAULT]]]],[CODE(IDL)[[[0]]]],The default value is unknown.
,[CODE(DOMc)@en[[[FIXED_DEFAULT]]]],[CODE(IDL)[[[1]]]],The default value is provided and the attribute is [CODE(XML)@en[#[[FIXED]]]] to that value.
,[CODE(DOMc)@en[[[REQUIRED_DEFAULT]]]],[CODE(IDL)[[[2]]]],An attribute specification is [CODE(XML)@en[#[[REQUIRED]]]] for the attribute.
,[CODE(DOMc)@en[[[IMPLIED_DEFAULT]]]],[CODE(IDL)[[[3]]]],The default value is [CODE(XML)@en[#[[IMPLIED]]]].
,[CODE(DOMc)@en[[[EXPLICIT_DEFAULT]]]],[CODE(IDL)[[[4]]]],The default value is provided but the attribute is not fixed to it.

The type of these constants are 
[CODE(IDL)@en[[[unsigned]] [[short]]]].

If the source of the attribute default value type
does not distinguish the [CODE(XML)@en[#[[IMPLIED]]]]
default and unknown default, then the 
[CODE(DOMc)@en[[[IMPLIED_DEFAULT]]]] value
[['''MUST''']] be used.

;; A newly created [CODE(DOMi)@en[[[AttributeDefinition]]]]
object by [CODE(DOMm)@en[[[createAttributeDefinition]]]]
method has [CODE(DOMa)@en[[[declaredType]]]] attribute
set to [CODE(DOMc)@en[[[NO_TYPE_ATTR]]]].

** Tree-relationship Attributes

[10] 
The 
[DFN@en[[CODE(DOMa)@en[[[ownerElementTypeDefinition]]]] attribute]]
of the [CODE(DOMi)@en[[[AttributeDefinition]]]] interface
is read-only and of type 
[CODE(DOMi)@en[[[ElementTypeDefinition]]]].
It is the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] node
which the [CODE(DOMi)@en[[[AttributeDefinition]]]] node
belong to.

If the [CODE(DOMi)@en[[[AttributeDefinition]]]] node
is included in the [CODE(DOMa)@en[[[attributeDefinitions]]]]
list of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] node,
then the attribute [['''MUST''']] return the
[CODE(DOMi)@en[[[ElementTypeDefinition]]]] node.
Otherwise, it [['''MUST''']] return [CODE(DOM)@en[[[null]]]].

;; This attribute is analogue to the
[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute
for [CODE(DOMi)@en[[[ElementTypeDefinition]]]],
[CODE(DOMi)@en[[[Entity]]]], and [CODE(DOMi)@en[[[Notation]]]]
nodes, or the [CODE(DOMa)@en[[[ownerElement]]]]
attribute for [CODE(DOMi)@en[[[Attr]]]] nodes.

** Attributes

[5]
The [DFN@en[[CODE(DOMa)@en[[[declaredType]]]] attribute]]
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object 
represents the type of the attribute value.

This attribute is read-write.
The type of the attribute is 
[CODE(IDL)@en[[[unsigned]] [[short]]]].  It is expected 
that this attribute has a value from the definition group
[CODE(DOM)@en[[[DeclaredValueType]]]].

The getter [['''MUST''']] return a value associated
to this attribute.

The setter [['''MUST''']]
throw a [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[AttributeDefinition]]]] object is read-only.
Otherwise, the setter [['''MUST''']] set the specified
value as the value associated to this attribute.

If a parser create an [CODE(DOMi)@en[[[AttributeDefinition]]]]
object, then it [['''MUST''']] set a value 
from the [CODE(DOM)@en[[[DeclaredValueType]]]] 
definition group.

[8]
The [DFN@en[[CODE(DOMa)@en[[[defaultType]]]] attribute]]
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object 
represents the type of the attribute default value.

This attribute is read-write.
The type of the attribute is 
[CODE(IDL)@en[[[unsigned]] [[short]]]].  It is expected 
that this attribute has a value from the definition group
[CODE(DOM)@en[[[DefaultValueType]]]].

The getter [['''MUST''']] return a value associated
to this attribute.

The setter [['''MUST''']]
throw a [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[AttributeDefinition]]]] object is read-only.
Otherwise, the setter [['''MUST''']] set the specified
value as the value associated to this attribute.

If a parser create an [CODE(DOMi)@en[[[AttributeDefinition]]]]
object, then it [['''MUST''']] set a value 
from the [CODE(DOM)@en[[[DefaultValueType]]]] 
definition group.

* memo
