DOM Document Type Definition Module

Working Draft

This Version
<http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work>
Latest Version
<http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef>
Latest Working Draft
<http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work>
Previous Stable Version
<http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-20071209>
Version History
<http://suika.fam.cx/gate/cvs/markup/xml/domdtdef/domdtdef-work.en.html>
Author
<>

Abstract

The DOM Document Type Definition module is a set of DOM interfaces, including both new interfaces and modifications to existing DOM interfaces, over which DOM applications are able to access to the definitions of the document type.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents might supersede this document.

This document is a specification, produced as part of the manakai project. It might be updated, replaced, or obsoleted by other documents at any time.

Comments on this document are welcome and may be sent to the author.

Translations of this document might be available. The English version of the document is the only normative version.

Introduction

This section is non‐normative.

The DOM Document Type Definition module is a set of DOM interfaces, including both new interfaces and modifications to existing DOM interfaces, over which DOM applications are able to access to the definitions of the document type.

Interfaces defined in this document are partially modeled and inspired by early drafts of DOM Level 1 [DOM1WD], DOM Level 3 Abstract Schemas W3C Note [DOM3AS], and XML Schema API specification [XSAPI], but they are not compatible with any of them as a whole.

Conformance Requirements

Terminology

All examples and notes in this specification are non‐normative, as are all sections explicitly marked non‐normative.

Known issues are marked like this. They are non‐normative.

Everything else in this document is normative.

The key words MUST, MUST NOT, and MAY in this document are to be interpreted as described in RFC 2119 [KEYWORDS].

Conformance requirements phrased as algorithms or specific steps MAY be implemented in any manner, so long as the end result is equivalent. Requirements phrased in the imperative as part of algorithms are to be interpreted with the meaning of the key word used in introducing the algorithm.

Sometimes an exception is phrased as being required to be raised. As specified in the DOM Core specification [DOM3CORE], when the value of the strictErrorChecking attribute of the Document node is false, then the exception is not have to be raised.

Some conformance requirements are phrased as requirements on interfaces, attributes, methods, or objects. Such requirements are applied to implementations.

The construction a Foo object, where Foo is an interface, is used instead of the more accurate an object implementing the interface Foo.

The construction raise a Bar, where Bar is an exception code, is used instead of the more accurate raise an exception implementing the interface DOMException [DOM3CORE] with its code attribute set to Bar.

The terms live and setting and getting of an attribute is defined in the HTML5 specification [HTML5].

The term read‐only (node) is defined in the DOM Level 3 Core specification [DOM3CORE].

The IDL fragments in this document are to be interpreted as described in the Language Bindings for DOM Specifications specification [DOMBIND].

Some IDL fragments are presented as patch to an IDL fragment defined in another document. They are to be interpreted as an instance of InterfaceMembers [DOMBIND]. If the IDL fragment to which the patch is applied has any instance of InterfaceMember with same identifier part as that of an instance of InterfaceMember in the patch, then the former instance of InterfaceMember MUST be ignored.

Conformance Categories

There are several kinds of products that can be claim to conform to this specification:

DOM Implementation
A DOM implementation (or just written as implementation in this document) provides a way to access DOM trees for applications by implementing interfaces defined by this and other documents. Unless otherwise noted, requirements in this document are applied to DOM implementations. To implement all the features in this document, the implementation have to implement some version of DOM Core (e.g. DOM Level 3 Core [DOM3CORE]) with one or more language binding (e.g. ECMAScript and Java bindings [DOMBIND] or Perl binding [DOMPERL]). A conforming implementation MUST also be a conforming implementation of the IDL fragments in this document, as described in the Language Bindings for DOM Specifications specification [DOMBIND].
XML Parser (XML document to DOM tree converter)
A software component that converts XML 1.0 or 1.1 document [XML10, XML11] (or fragment thereof) into a DOM tree (or fragment thereof) in the context of this document. Note that this document does not define any particular way to parse an XML document or to construct an DOM document, but it defines constraints for such processing.
XML Serializer (DOM tree to XML document converter)
A software component that converts DOM tree (or fragment thereof) into an XML 1.0 or 1.1 document (or fragment thereof). Note that this document does not define any particular way to serialize a DOM tree, but it defines constraints for such processing.
XML Information Set to DOM Tree Converter
A software component that converts an XML information set [INFOSET] into a DOM tree. Note that this document does not define any particular way for the conversion, but it defines constraints for such processing.
DOM Tree to XML Information Set Converter
A software component that converts a DOM tree into an XML information set. Note that this document does not define any particular way for the conversion, but it defines constraints for such processing.

DOM Document Type Definition Module

The DOM Document Type Definition module, version 3.0, introduces four interfaces: DocumentXDoctype, DocumentTypeDefinition, ElementTypeDefinition, and AttributeDefinition. In addition, it modifies existing interfaces Node, Document, DocumentType, Entity, and Notation [DOM3CORE].

Feature String

In a DOM implementation that supports the version 3.0 of the DOM Document Type Definition module, the hasFeature method of a DOMImplementation object [DOM3CORE] MUST return true when the parameters are set to http://suika.fam.cx/www/2006/feature/XDoctype and 3.0 respectively. Any method that takes one or more feature names, with or without version number, such as hasFeature or getFeature, MUST behave in a manner consistent with it.

Modifications to the Node Interface

The implementation of the Node interface MUST be modified as the following IDL fragment:

// Additions to the Node interface

// Additions to the NodeType definition group
const unsigned short ELEMENT_TYPE_DEFINITION_NODE = 81001;
const unsigned short ATTRIBUTE_DEFINITION_NODE = 81002;

This specification adds two new types (subinterfaces) of Node: element type definition (node type ELEMENT_TYPE_DEFINITION_NODE, interface ElementTypeDefinition) and attribute definition (node type ATTRIBUTE_DEFINITION_NODE, interface AttributeDefinition). For these kinds of nodes, methods and attributes in the Node interface must behave as following:

attributes, localName, namespaceURI, and prefix

On getting, the attributes MUST return null.

baseURI

On getting, the attribute MUST return the value of the baseURI attribute of the node in the ownerDocument attribute of the node. Note that the value might be null.

cloneNode

A future version of the specification is expected to define the behavior of the cloneNode method for those kinds of nodes. In addition, it might revise behavior of the method for Entity, Notation, and/or DocumentType nodes.

compareDocumentPosition

A future version of the specification is expected to define the behavior of the method for those kinds of nodes. In addition, it might revise behavior of the method for Entity, Notation, and/or DocumentType nodes.

isDefaultNamespace

When invoked, the method MUST return false.

isEqualNode

For the isEqualNode method, following items are added to the list of conditions for equality:

manakaiLocalName [MANAKAI]

On getting, the attributes MUST return null.

lookupNamespaceURI and lookupPrefix

When invoked, the methods MUST return null.

nodeName

If the node is an ElementTypeDefinition: On getting, the attribute MUST return the name of the element type definition represented by the node.

If the node is an AttributeDefinition: On getting, the attribute MUST return the name of the attribute definition represented by the node.

nodeType

On getting, the attribute returns ELEMENT_TYPE_DEFINITION_NODE (if the node is an ElementTypeDefinition) or ATTRIBUTE_DEFINITION_NODE (if the node is an AttributeDefinition).

Two constants are added to the NodeType definition group of the Node interface as following:

NameValueDescription
ELEMENT_TYPE_DEFINITION_NODE 81001The node is an ElementTypeDefinition.
ATTRIBUTE_DEFINITION_NODE 81002The node is an AttributeDefinition.
nodeValue and textContent

If the node is an ElementTypeDefinition: On getting, the attributes MUST return null.

Thus, on setting the attributes does nothing [DOM3CORE].

If the node is an AttributeDefinition: The attribute MUST behave as if the node were Attr [DOM3CORE].

normalize

When a DocumentType is normalized, any nodes in the NamedNodeMap object in the elementTypes attribute MUST be normalized as well.

When an ElementTypeDefinition node is normalized, any nodes in the NamedNodeMap object in the attributeDefinitions attribute MUST be normalized as well.

Modifications to the Document Interface

Future version of the specification is expected to define what should be done if adoptNode or importNode method have to adopt or import an ElementTypeDefinition or AttributeDefinition node. In addition it might revise behavior of those methods for Entity, Notation, and/or DocumentType nodes. Behavior of normalizeDocument method for these kinds of nodes might also be defined in some day.

The DocumentXDoctype Interface

The Document nodes MUST also implement the DocumentXDoctype interface.

An instance of the DocumentXDoctype interface MUST be able to be obtained by using binding‐specific casting methods on an instance of the Document interface (if such casting methods are available) or by using the method getFeature with parameter values http://suika.fam.cx/www/2006/feature/XDoctype and 3.0 respectively (if the Document node supports the feature Core version 3.0 [DOM3CORE]).

The DocumentXDoctype interface MUST be implemented as the following IDL fragment:

interface DocumentXDoctype {
  DocumentType createDocumentTypeDefinition
    (in DOMString name)
    raises (DOMException);
  ElementTypeDefinition createElementTypeDefinition
    (in DOMString name)
    raises (DOMException);
  AttributeDefinition createAttributeDefinition
    (in DOMString name)
    raises (DOMException);
  Entity createGeneralEntityDefinition
    (in DOMString name)
    raises (DOMException);
  Notation createNotation
    (in DOMString name)
    raises (DOMException);
}
createDocumentTypeDefinition, method

This method creates a DocumentType node with the specified name, belonging to the document.

The name parameter is the name of the document type.

When invoked, the method MUST create and return a DocumentType node with the following attributes:

attributes, parentNode
null.
elementTypes, entities, and notations
Empty NamedNodeMap objects respectively.
childNodes
An empty NodeList object.
internalSubset, publicId, and systemId
Empty strings.
nodeName
name.
ownerDocument
The Document node over which the method is invoked.

The returned node MUST NOT be marked as read‐only.

In addition, the method MUST be marked as containing five general entity declarations: amp, lt, gt, quot, and apos.

createElementTypeDefinition, method

This method creates a ElementTypeDefinition node with the specified name, belonging to the document.

The name parameter is the name of the element type defined by the element type definition.

When invoked, the method MUST create and return an ElementTypeDefinition node with the following attributes:

attributeDefinitions
An empty NamedNodeMap object.
childNodes
An empty NodeList object.
nodeName
name.
ownerDocument
The Document node over which the method is invoked.
ownerDocumentTypeDefinition and parentNode
null.

The returned node MUST NOT be marked as read‐only.

createAttributeDefinition, method

This method creates a AttributeDefinition node with the specified name, belonging to the document.

The name parameter is the name of the attribute defined by the attribute definition.

When invoked, the method MUST create and return an AttributeDefinition node with the following attributes:

allowedTokens
An empty DOMStringList object.
childNodes
An empty NodeList object.
declaredType
NO_TYPE_ATTR.
defaultType
UNKNOWN_DEFAULT.
nodeName
name.
ownerDocument
The Document node over which the method is invoked.
ownerElementTypeDefinition and parentNode
null.

The returned node MUST NOT be marked as read‐only.

createGeneralEntity, method

This method creates a Entity node with the specified name, which represents a general entity, belonging to the document.

The name parameter is the name of the general entity.

When invoked, the method MUST create and return an Entity node with the following attributes:

childNodes
An empty NodeList object.
manakaiDeclarationBaseURI, manakaiEntityBaseURI, and manakaiEntityURI [MANAKAI]

No explicit value is set.

hasReplacementTree and isExternallyDeclared

false.

nodeName
name.

It is not an error for name matching to the name of one of predefined general parsed entities in XML or HTML. For example, name might be amp, resulting in an Entity node with its nodeName attribute set to amp.

notationName, ownerDocumentTypeDefinition, and parentNode
null.
ownerDocument
The Document node over which the method is invoked.
publicId and systemId
null.
@@ publicId and systemId should be empty string?

The returned node MUST NOT be marked as read‐only.

createNotation, method

This method creates a Notation node with the specified name, belonging to the document.

The name parameter is the name of the notation.

When invoked, the method MUST create and return a Notation node with the following attributes:

childNodes
An empty NodeList object.
manakaiDeclarationBaseURI [MANAKAI]

No explicit value is set.

nodeName
name.
ownerDocument

The Document node over which the method is invoked.

ownerDocumentTypeDefinition and parentNode
null.
publicId and systemId
null.
@@ publicId and systemId should be empty string?

The returned node MUST NOT be marked as read‐only.

These methods MUST raise an INVALID_CHARACTER_ERR if name is not a legal Name [XML10, XML11] according to the XML version specified in the xmlVersion attribute of the Document node.

Non‐XML case is intentionally left unspecified for now, since DOM Level 3 Core specification [DOM3CORE] does not define it for Document methods.

name does not have to be a namespace qualified name.

Modifications to the DocumentType Interface

A DocumentType interface MAY contain zero or more ProcessingInstruction nodes in the NodeList object contained in the childNodes attribute of the DocumentType node.

If the DocumentType node is created during the process to create a DOM from an XML document, the NodeList object in the childNodes object MUST contains the ProcessingInstruction nodes representing the processing instructions in the document type definition of the document processed [XML10, XML11] by the XML processor. If the DocumentType node is marked as read‐only, then all the child nodes MUST also be marked as read‐only.

If a DocumentType node is created from a document type declaration information item [INFOSET], the NodeList object in the childNodes attribute of the node MUST contain the ProcessingInstruction nodes created from any processing instruction information items in the list in the [children] property of the document type declaration item in the same order.

If a DocumentType node is mapped to a document type declaration information item, the list in the [children] property MUST contain the processng instruction information items created from the ProcessingInstruction nodes in the NodeList object in the childNodes attribute of the DocumentType node.

The implementation of the DocumentType interface MUST be modified as the following IDL fragment:

// Modifications to the DocumentType interface
  attribute DOMString publicId;
  attribute DOMString systemId;

  attribute DOMString internalSubset;

The publicId attribute and the systemId attribute of DocumentType, Entity, and Notation interfaces are no longer read‐only.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the node is read‐only. Otherwise, it MUST set the specified value as the value associated to the attribute. No normalization, relative reference resolution, or lexical validation is performed. @@ If the new value is null, should an empty string be set?

Setting an invalid identifier might make the node unserializable. Setting a public identifier while leaving system identifier unspecified would also make the DocumentType or Entity node unserializable.

ISSUE: In HTML5, Firefox 1.5, and Opera 9, not specifying public or system identifier results in empty strings.

The internalSubset attribute of the DocumentType interface is no longer read‐only.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the node is read‐only. Otherwise, it MUST set the specified value as the value associated to the attribute. No normalization, or lexical validation is performed. @@ If the new value is null, should an empty string be set?

The DocumentTypeDefinition Interface

The DocumentType nodes MUST also implement the DocumentTypeDefinition interface.

An instance of the DocumentTypeDefinition interface MUST be able to be obtained by using binding‐specific casting methods on an instance of the DocumentType interface (if such casting methods are available) or by using the method getFeature with parameter values http://suika.fam.cx/www/2006/feature/XDoctype and 3.0 respectively (if the DocumentType node supports the feature Core version 3.0 [DOM3CORE]).

The DocumentTypeDefinition interface MUST be implemented as the following IDL fragment:

interface DocumentTypeDefinition {
  readonly attribute NamedNodeMap elementTypes;
  readonly attribute NamedNodeMap generalEntities;
  readonly attribute NamedNodeMap notations;

  ElementTypeDefinition getElementTypeDefinitionNode
    (in DOMString name);
  Entity getGeneralEntityNode
    (in DOMString name);
  Notation getNotationNode
    (in DOMString name);

  void setElementTypeDefinitionNode
    (in DOMString node)
    raises (DOMException);
  void setGeneralEntityNode
    (in DOMString node)
    raises (DOMException);
  void setNotationNode
    (in DOMString node)
    raises (DOMException);
}
elementTypes of type NamedNodeMap, read‐only

A live NamedNodeMap object that contains all the element type definitions belonging to the DocumentType node.

On getting, the attribute MUST return the NamedNodeMap object that contains all the ElementTypeDefinition nodes belonging to the DocumentType node. The NamedNodeMap object MUST be read‐only if and only if the node is read‐only. The NamedNodeMap object MUST be live.

If the DocumentType node is created during the process to create a DOM from an XML document, the following requirements are applied: The NamedNodeMap object in the elementType attribute MUST be so transformed that the object contains the ElementTypeDefinition nodes for the element types whose name is presented as the Name of the element type or attribute definition list declarations processed [XML10, XML11] by the XML processor. If there are more than one element type declarations for an element type, then the declarations other than the first one MUST be ignored for the purpose of constructing the NamedNodeMap object.

generalEntities of type NamedNodeMap, read‐only

A live NamedNodeMap object that contains all the general entities belonging to the DocumentType node.

On getting, the attribute MUST return the same value as the entities attribute (defined in the DocumentType interface) of the same node.

This attribute is part of the interface for historical reason.

notations of type NamedNodeMap, read‐only

A live NamedNodeMap object that contains all the notations belonging to the DocumentType node.

On getting, the attribute MUST return the same value as the notations attribute (defined in the DocumentType interface) of the same node.

This attribute is part of the interface for historical reason.

Implementations are not required to implement the notations attribute twice (for DocumentType and DocumentTypeDefinition interfaces); they share exactly same definition.

getElementTypeDefinitionNode, method

Returns the ElementTypeDefinition node with the specified name.

The name parameter is the name of the element type.

When invoked, the method MUST return the ElementTypeDefinition node, whose nodeName is equal to name, in the NamedNodeMap object in the elementTypes attribute of the node. If there is no such node, it MUST return null.

getGeneralEntityNode, method

Returns the Entity node with the specified name.

The name parameter is the name of the general entity.

When invoked, the method MUST return the Entity node, whose nodeName is equal to name, in the NamedNodeMap object in the entities attribute of the node. If there is no such node, it MUST return null.

getNotationNode, method

Returns the Notation node with the specified name.

The name parameter is the name of the notation.

When invoked, the method MUST return the Notation node, whose nodeName is equal to name, in the NamedNodeMap object in the notations attribute of the node. If there is no such node, it MUST return null.

setElementTypeDefinitionNode, method

Associate an ElementTypeDefinition node with the DocumentType node.

The node parameter is the node to associate.

When invoked, the method MUST follow the rules to attach a node, where n is the DocumentType node, l is the elementTypes attribute value of the DocumentType node, node is the node, and owner-attr is the ownerDocumentTypeDefinition attribute.

setGeneralEntityNode, method

Associate an Entity node with the DocumentType node.

The node parameter is the node to associate.

When invoked, the method MUST follow the rules to attach a node, where n is the DocumentType node, l is the entities attribute value of the DocumentType node, node is the node, and owner-attr is the ownerDocumentTypeDefinition attribute.

setNotationNode, method

Associate an Notation node with the DocumentType node.

The node parameter is the node to associate.

When invoked, the method MUST follow the rules to attach a node, where n is the DocumentType node, l is the notations attribute value of the DocumentType node, node is the node, and owner-attr is the ownerDocumentTypeDefinition attribute.

When a node is attached, the rules below, with parameters n, l, node, and owner-attr, MUST be followed:

  1. Let r be the node in l whose nodeName attribute value is equal to the nodeName attribute value of node, if any.

  2. If r is different from null and r is same node as node, then abort these steps.

  3. If n is read‐only, then raise a NO_MODIFICATION_ALLOWED_ERR and abort these steps.

  4. If the ownerDocument attribute value of node is different from that of n, then raise a WRONG_DOCUMENT_ERR and abort these steps.

  5. If the value of the attribute owner-attr of node is different from null, then raise a HIERARCHY_REQUEST_ERR and abort these steps.

  6. If r is a node, then remove it from r.

    By the removal of r, the attribute owner-attr of r is set to null.

  7. Add node to l.

    By the addition of node, the attribute owner-attr of node is set to n.

A future version of this interface might define the parameterEntities and getter/setter for parameter entities.

The ElementTypeDefinition Interface

The nodes of type ELEMENT_TYPE_DEFINITION_NODE represents an element type definition. Such a node MUST implement the ElementTypeDefinition interface, which extends the Node interface.

An element type definition represents a definition of the element type. It is corresponding to the element type declaration in DTD. However, an ElementTypeDefinition node does not represent the element type definition in DTD itself. Even if there are more than one element type declarations for an element type in DTD, the result DOM will contain only an ElementTypeDefinition node for that element type. In addition, if there are attribute definition declarations for an element type, even when there is no element type declaration for that element type, the DOM will contain an ElementTypeDefinition node for that element type.

An ElementTypeDefinition node cannot be a child of any node. An ElementTypeDefinition node cannot have any child node.

The ElementTypeDefinition interface MUST be implemented as the following IDL fragment:

interface ElementTypeDefinition : Node {
  readonly attribute DocumentType ownerDocumentTypeDefinition;

  readonly attribute NamedNodeMap attributeDefinitions;
  AttributeDefinition getAttributeDefinitionNode
    (in DOMString name);
  void setAttributeDefinitionNode
    (in AttributeDefinition node)
    raises (DOMException);
}
ownerDocumentTypeDefinition of type DocumentType, read‐only

The ownerDocumentTypeDefinition attribute of ElementTypeDefinition, Entity, and Notation interfaces contain the DocumentType node to which the node is attached.

On getting, the attribute MUST return a DocumentType node. It MUST be such a node that whose elementTypes (for an ElementTypeDefinition node), entities (for an Entity node), or notations (for a Notation node) attribute contains the NamedNodeMap object that contains the node. If there is no such a DocumentType node, then null MUST be returned.

attributeDefinitions of type NamedNodeMap, read‐only

A live NamedNodeMap object that contains all the attribute definitions belonging to the ElementTypeDefinition node.

On getting, the attribute MUST return the NamedNodeMap object that contains all the AttributeDefinition node belonging to the ElementTypeDefinition node. The NamedNodeMap object MUST be read‐only if and only if the node is read‐only. The NamedNodeMap object MUST be live.

If the ElementTypeDefinition node is created during the process to create a DOM from an XML document, the following requirements are applied: The NamedNodeMap object in the attributeDefinitions attribute MUST be so transformed that the object contains the AttributeDefinition node corresponding to the attribute definitions in the attribute definition list declarations processed [XML10, XML11] by the XML processor and associated to the element type represented by the node. If there are more than one attribute definitions for an attribute, then the definitions other than the first one MUST be ignored for the purpose of constructing the NamedNodeMap object.

getAttributeDefinitionNode, method

Return the AttributeDefinition node with the specified name.

The name parameter is the name of the attribute.

When invoked, the method MUST return the AttributeDefinition node, whose nodeName attribute value is equal to name, in the NamedNodeMap in the attributeDefinitions attribute of the node. If there is no such node, it MUST return null.

setAttributeDefinitionNode, method

Associate an AttributeDefinition node with the ElementTypeDefinition node.

The node parameter is the node to associate.

When invoked, the method MUST follow the rules to attach a node, where n is the ElementTypeDefinition node, l is the attributeDefinitions attribute value of the ElementTypeDefinition node, node is the node, and owner-attr is the ownerElementTypeDefinition attribute.

A future version of the specification might define a set of attributes and methods for representing and accessing to the content model of the element type.

The AttributeDefinition Interface

The nodes of type ATTRIBUTE_DEFINITION_NODE represents an attribute definition. Such a node MUST implement the AttributeDefinition interface, which extends the Node interface.

An attribute definition represents a definition of the attribute associated to an element type. It is corresponding to the attribute definition in the attribute list declaration in DTD. However, an AttributeDefinition node does not represent the attribute definition in DTD itself. Even if there are more than one attribute definitions for an attribute of an element type in DTD, the result DOM will contain only an AttributeDefinition node for that attribute.

An AttributeDefinition node cannot be a child of any node. An AttributeDefinition node can have zero or more child nodes of same kinds as those allowed for Attr nodes [DOM3CORE].

The AttributeDefinition interface MUST be implemented as the following IDL fragment:

interface AttributeDefinition : Node {
  // DeclaredValueType
  const unsigned short NO_TYPE_ATTR = 0;
  const unsigned short CDATA_ATTR = 1;
  const unsigned short ID_ATTR = 2;
  const unsigned short IDREF_ATTR = 3;
  const unsigned short IDREFS_ATTR = 4;
  const unsigned short ENTITY_ATTR = 5;
  const unsigned short ENTITIES_ATTR = 6;
  const unsigned short NMTOKEN_ATTR = 7;
  const unsigned short NMTOKENS_ATTR = 8;
  const unsigned short NOTATION_ATTR = 9;
  const unsigned short ENUMERATION_ATTR = 10;
  const unsigned short UNKNOWN_ATTR = 11;

  // DefaultValueType
  const unsigned short UNKNOWN_DEFAULT = 0;
  const unsigned short FIXED_DEFAULT = 1;
  const unsigned short REQUIRED_DEFAULT = 2;
  const unsigned short IMPLIED_DEFAULT = 3;
  const unsigned short EXPLICIT_DEFAULT = 4;
  
  readonly attribute ElementTypeDefinition ownerElementTypeDefinition;

  readonly attribute unsigned short declaredType;
  readonly attribute DOMStringList allowedTokens;
  readonly attribute unsigned short defaultType;
}
ownerElementTypeDefinition of type ElementTypeDefinition, read‐only

The ElementTypeDefinition to which the AttributeDefinition node belongs.

On getting, the attribute MUST return an ElementTypeDefinition node. It MUST be such a node that whose attributeDefinitions attribute contains the NamedNodeMap object that contains the AttributeDefinition node. If there is no such an ElementTypeDefinition node, then null MUST be returned.

declaredType of type unsigned short

The declared type [XML10, XML11] of the attribute. It is expected that this attribute contains a value from the definition group DeclaredValueType.

On getting, the attribute MUST return the value associated to this attribute.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the AttributeDefinition node is read‐only. Otherwise, it MUST set the specified value as the value associated to this attribute.

If the AttributeDefinition node is created during the process to create a DOM from an XML document, an appropriate value from the DeclaredValueType constant group MUST be set to the attribute.

The definition group DeclaredValueType contains integers indicating the declared type of attributes. The definition group contains the following constants:

NameValueDescription
NO_TYPE_ATTR 0No value [INFOSET].
CDATA_ATTR 1CDATA [XML10, XML11].
ID_ATTR 2ID [XML10, XML11].
IDREF_ATTR 3IDREF [XML10, XML11].
IDREFS_ATTR 4IDREFS [XML10, XML11].
ENTITY_ATTR 5ENTITY [XML10, XML11].
ENTITIES_ATTR 6ENTITIES [XML10, XML11].
NMTOKEN_ATTR 7NMTOKEN [XML10, XML11].
NMTOKENS_ATTR 8NMTOKENS [XML10, XML11].
NOTATION_ATTR 9NOTATION [XML10, XML11].
ENUMERATION_ATTR 10Enumeration [XML10, XML11].
UNKNOWN_ATTR 11Unknown, because no declaration for the attribute has been read but the [all declaration processed] property [INFOSET] would be false.

If no attribute type information is available, or if the source of the information does not distinguish no value and unknown [INFOSET], then the value NO_TYPE_ATTR MUST be used.

An AttributeDefinition node created by the createAttributeDefinition method has its declaredType attribute set to NO_TYPE_ATTR.

If the source of the information does not distinguish no value and/or unknown [INFOSET] and CDATA [XML10, XML11], then the value CDATA_ATTR MUST be used.

In Perl binding [DOMPERL], the Attr nodes MUST implement the DeclaredValueType definition group.

allowedTokens of type DOMStringList, read‐only

The list of allowed attribute values.

On getting, the attribute MUST return the DOMStringList object associated to this attribute. The object MAY contain zero or more ordered strings, consist of zero or more characters respectively, possibly with duplications. The object MUST be read‐only if and only if the node is read‐only.

If the AttributeDefinition node is created during the process to create a DOM from an XML document, the object MUST contain the names or name tokens allowed for the attribute defined by the node. If the document is well‐formed, the object will be empty unless the declaredType is ENUMERATION_ATTR or NOTATION_ATTR.

If the declaredType is different from ENUMERATION_ATTR or NOTATION_ATTR, this attribute MUST be ignored for the purpose of serializing into (part of) XML document.

When serializing the node it should be noted that the object might be empty, might contain duplications, and might contain strings that are not names or name tokens.

defaultType of type unsigned short

The type of the default for the attribute. It is expected that this attribute contains a value from the definition group DefaultValueType.

On getting, the attribute MUST return the value associated to this attribute.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the AttributeDefinition node is read‐only. Otherwise, it MUST set the specified value as the value associated to this attribute.

If the AttributeDefinition node is created during the process to create a DOM from an XML document, an appropriate value from the DefaultValueType definition group MUST be set to the attribute.

The definition group DefaultValueType contains integers indicating the type of the default for the attribute. The definition group contains the following constants:

NameValueDescription
UNKNOWN_DEFAULT 0Unknown.
FIXED_DEFAULT 1Provided explicitly and only the value is allowed. [XML10, XML11].
REQUIRED_DEFAULT 2No default value and the attribute have to be explicitly specified.
IMPLIED_DEFAULT 3Implied [XML10, XML11].
EXPLICIT_DEFAULT 4Provided explicitly.

If the source of the default type does not distinguish implied and unknown default types, then the value IMPLIED_DEFAULT MUST be used.

An AttributeDefinition node created by the createAttributeDefinition method has its defaultType attribute set to UNKNOWN_DEFAULT.

Modifications to the Entity Interface

The implementation of the Entity interface MUST be modified as the following IDL fragment:

// Modifications to the Entity interface
  attribute DOMString publicId;
  attribute DOMString systemId;
  attribute DOMString notationName;

  // Additions to the Entity interface
  attribute DOMString hasReplacementTree;
  readonly attribute DocumentType ownerDocumentTypeDefinition;

  attribute boolean isExternallyDeclared;

The notationName attribute of the Entity interface is no longer read‐only.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the node is read‐only. Otherwise, it MUST set the specified value as the value associated to the attribute. No lexical validation is performed. The new value MAY be null.

hasReplacementTree of type boolean

Whether the structure of the replacement text of the entity is available via the NodeList object in the childNodes attribute of the entity.

On getting, the attribute MUST return the value associated to this attribute.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the node is read‐only. Otherwise, it MUST set the specified value as the value associated to this attribute.

The attribute can be set to false even if the Entity node has any child node. If the attribute is set to false, then any child node of the Entity node ought to be ignored, say, for the purpose of serialization.

When an EntityReference node is created by cloning the replacement subtree of the Entity node, if the attribute is set to false, then any descendant of the node MUST be ignored.

If the Entity node is created during the process to create a DOM from an XML document, the following requirements are applied: If the entity is an unparsed entity, then the attribute MUST be set to false. Otherwise, if the entity is an external entity whose replacement text is not available, or whose replacement text is not converted to a replacement tree, then the attribute MUST be set to false. Otherwise, the attribute MUST be set to true.

An Entity node created by the createGeneralEntity method has its hasReplacementTree attribute set to false.

isExternallyDeclared of type boolean

Whether the entity is declared by an external entity declaration or not. If the value is true, the entity is declared in an entity declaration in the external subset entity or in an external parameter entity. If the value is false, the entity is declared in an entity declaration in the internal subset, or the node is created in memory.

On getting, the attribute MUST return the value associated to this attribute.

On setting, the attribute MUST raise a NO_MODIFICATION_ALLOWED_ERR if the node is read‐only. Otherwise, it MUST set the specified value as the value associated to this attribute.

If the Entity node is created during the process to create a DOM from an XML document, the following requirements are applied: If the entity is an unparsed entity, then the attribute MUST be set to false. Otherwise, i.e. the entity is a parsed entity, then the attribute MUST be set to the value of whether the entity is declared by an external markup declaration or not.

Modifications to the Notation Interface

The implementation of the Notation interface MUST be modified as the following IDL fragment:

// Modifications to the Notation interface
  attribute DOMString publicId;
  attribute DOMString systemId;

  // Addition to the Notation interface
  readonly attribute DocumentType ownerDocumentTypeDefinition;

References

Normative References

DOM3CORE
Document Object Model (DOM) Level 3 Core Specification, Version 1.0, W3C Recommendation, . This version of the specification is referenced. The latest version of the specification is available at <http://www.w3.org/TR/DOM-Level-3-Core>.
DOMBIND
Language Bindings for DOM Specifications, W3C Working Draft, . This version of the specification is referenced. The latest version of the specification is available at <http://www.w3.org/TR/DOM-Bindings/>.
DOMPERL
manakai's DOM Perl Binding, editor's draft. Work in progress.
HTML5
HTML 5, WHATWG Working Draft. Work in progress.
INFOSET
XML Information Set (Second Edition), W3C Recommendation, . This version of the specification is referenced. The latest version of the specification is available at <http://www.w3.org/TR/xml-infoset>.
KEYWORDS
Key words for use in RFCs to Indicate Requirement Levels, IETF BCP 14, RFC 2119, . This version of the specification is referenced.
MANAKAI
manakai's DOM Extensions, editor's draft. Work in progress.
XML10
Extensible Markup Language (XML) 1.0 (Fourth Edition), W3C Recommendation, , edited in place . This version of the specification is referenced. The latest version of the specification is available at <http://www.w3.org/TR/xml>.
XML11
Extensible Markup Language (XML) 1.1 (Second Edition), W3C Recommendation, , edited in place . This version of the specification is referenced. The latest version of the specification is available at <http://www.w3.org/TR/xml11>.

Non‐normative References

DOM1WD
Document Object Model Specification, W3C Working Draft, .
Document Object Model Specification, W3C Working Draft, .
Document Object Model Specification, Version 1.0, W3C Working Draft, .
DOM3AS
Document Object Model (DOM) Level 3 Abstract Schemas Specification, Version 1.0, W3C Note, . The latest version of the specification is available at <http://www.w3.org/TR/DOM-Level-3-AS>.
XSAPI
XML Schema API, W3C Member Submission, . The latest version of the specification is available at <http://www.w3.org/Submission/xmlschema-api/>.