

* The [CODE(DOMi)@en[DocumentTypeDefinition]] Interface

[[manakai//DOM Extensions]] > [[DOM XML Document Type Definition]]
module > New Interfaces > The [CODE(DOMi)@en[[[DocumentTypeDefinition]]]]
Interface

[1] In an implementation that supports the 
[CODE(URI)@en[[[http://suika.fam.cx/www/2006/feature/XDoctype]]]]
feature, a [CODE(DOMi)@en[[[DocumentType]]]] node
must implement the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]]
interface.  See [[DOM XML Document Type Definition]>>3] for
details.


** Children

[2] The [DFN@en[[CODE(DOMa)@en[[[elementTypes]]]] attribute]]
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that 
contains all element types belongs to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]]
node.  The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]].
The attribute is read-only.

What are contained in this collection depends on how
the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node was created.  If the
node was created as the result of parsing of an XML document,
it [['''MUST''']]  contain all element types whose element type and / or 
attribute definition list declaration are encountered by and provided for the DOM
implementation from the XML processor.  Note that the XML processor might not 
provide a part of or entire such information depending on the configuration.
If more than one declarations for an element type or an attribute is available 
at the time of the definition node construction, then declarations other than 
the first ones [['''MUST''']] be discarded.

The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]]
object that contains all the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] nodes
belong to the node.  The returned [CODE(DOMi)@en[[[NamedNodeMap]]]] object
[['''MUST''']] be read-only if and only if the node is read-only.
Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live
and therefore any change of read-only flag on the node is immediately
reflected by that of the object.

[3] The [DFN@en[[CODE(DOMa)@en[[[generalEntities]]]] attribute]]
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that contains all the
general entities belong to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node.
The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]].
The attribute is read-only.

All entities declared in the document type definition
contained in or referenced from the document entity
might not be exposed through this collection, depending
on the information provided by the XML processor for
the DOM implementation.  In particular, it might not
contain any entity if entity references are expanded
at the parse time.  An implementation [['''MUST NOT''']]
expose an [CODE(DOMi)@en[[[Entity]]]] node whose [CODE(DOMa)@en[[[nodeName]]]]
is equal to the name of one of five predefined general entities in
XML through the collection as the result of parsing of an XML
document that has no error.  Duplicate entity declarations are also discarded.

The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]]
object that contains all the [CODE(DOMi)@en[[[Entity]]]] nodes
representing general entities belong to the node.  The returned 
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if 
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live
and therefore any change of read-only flag on the node is immediately
reflected by that of the object.

The attribute [['''MUST''']] return the same value as the
[CODE(DOMa)@en[[[entites]]]] attribute of the 
[CODE(DOMi)@en[[[DocumentType]]]] interface on the same node.

[4] The [DFN@en[[CODE(DOMa)@en[[[notations]]]] attribute]]
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that contains
all the notations belong to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]]
node.  The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]].
The attribute is read-only.

If the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node is
created from an XML document, duplicate notation declarations, if any, in DTD 
[['''MUST NOT''']] result in a node in the [CODE(DOMi)@en[[[NamedNodeMap]]]]
object and only the first declaration [['''MUST''']] be
made available as a [CODE(DOMi)@en[[[Notation]]]] node.

;; This definition is based on one for the 
[CODE(DOMa)@en[[[notations]]]] attribute of the
[CODE(DOMi)@en[[[DocumentType]]]] interface in DOM XML module.
Since duplication is violation to the Validity Constraint,
XML parsers might vary on how notations are notified to
the application.  In particular, [CODE(InfoProp)@en[[[notations]]]]
property of the document information item in XML Information Set
is so defined that in case ''any'' notation is declared for 
multiple times then the property has no value.

The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]]
object that contains all the [CODE(DOMi)@en[[[Notation]]]] nodes
representing notations belong to the node.  The returned 
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if 
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live
and therefore any change of read-only flag on the node is immediately
reflected by that of the object.

A DOM implementation is not required to implement the
[CODE(DOMa)@en[[[notations]]]] attribute twice
for the [CODE(DOMi)@en[[[DocumentType]]]] and
the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interfaces;
the latter is defined to contain the same value as the former.


** Open Issues (informative)

[5] A future version of the interface might define the
[CODE(DOMa)@en[[[parameterEntities]]]] attribute and 
getter/setter for parameter entities.


* memo

[6]
This interface is implemented by manakai; see <http://suika.fam.cx/gate/cvs/messaging/manakai/lib/Message/DOM/DocumentType.pm> for its source code.
