29 September, 2000

Appendix B: IDL Definitions

This appendix contains the complete OMG IDL for the Level 1 Document Object Model definitions. The definitions are divided into Core, HTML.

The IDL files are also available as: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/idl.zip

Unfortunately the OMG IDL for the Document Object Model HTML is not compliant because of problems in the validator that was used to validate Level 1. The readOnly attribute on the HTMLInputElement and HTMLTextAreaElement interfaces, as well as the object attribute on the HTMLAppletElement interface, are not compliant with OMG IDL 2.2.

B.1: Document Object Model Level 1 Core

This section contains the OMG IDL definitions for the interfaces in the Core Document Object Model specification, including the extended (XML) interfaces.

dom.idl:

// File: dom.idl

#ifndef _DOM_IDL_
#define _DOM_IDL_

#pragma prefix "w3c.org"
module dom
{

  typedef sequence<unsigned short> DOMString;

  interface NodeList;
  interface NamedNodeMap;
  interface Document;

  exception DOMException {
    unsigned short   code;
  };
  // ExceptionCode
  const unsigned short      INDEX_SIZE_ERR                 = 1;
  const unsigned short      DOMSTRING_SIZE_ERR             = 2;
  const unsigned short      HIERARCHY_REQUEST_ERR          = 3;
  const unsigned short      WRONG_DOCUMENT_ERR             = 4;
  const unsigned short      INVALID_CHARACTER_ERR          = 5;
  const unsigned short      NO_DATA_ALLOWED_ERR            = 6;
  const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;
  const unsigned short      NOT_FOUND_ERR                  = 8;
  const unsigned short      NOT_SUPPORTED_ERR              = 9;
  const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;


  interface DOMImplementation {
    boolean            hasFeature(in DOMString feature, 
                                  in DOMString version);
  };

  interface Node {

    // NodeType
    const unsigned short      ELEMENT_NODE                   = 1;
    const unsigned short      ATTRIBUTE_NODE                 = 2;
    const unsigned short      TEXT_NODE                      = 3;
    const unsigned short      CDATA_SECTION_NODE             = 4;
    const unsigned short      ENTITY_REFERENCE_NODE          = 5;
    const unsigned short      ENTITY_NODE                    = 6;
    const unsigned short      PROCESSING_INSTRUCTION_NODE    = 7;
    const unsigned short      COMMENT_NODE                   = 8;
    const unsigned short      DOCUMENT_NODE                  = 9;
    const unsigned short      DOCUMENT_TYPE_NODE             = 10;
    const unsigned short      DOCUMENT_FRAGMENT_NODE         = 11;
    const unsigned short      NOTATION_NODE                  = 12;

    readonly attribute DOMString        nodeName;
             attribute DOMString        nodeValue;
                                        // raises(DOMException) on setting
                                        // raises(DOMException) on retrieval

    readonly attribute unsigned short   nodeType;
    readonly attribute Node             parentNode;
    readonly attribute NodeList         childNodes;
    readonly attribute Node             firstChild;
    readonly attribute Node             lastChild;
    readonly attribute Node             previousSibling;
    readonly attribute Node             nextSibling;
    readonly attribute NamedNodeMap     attributes;
    readonly attribute Document         ownerDocument;
    Node               insertBefore(in Node newChild, 
                                    in Node refChild)
                                        raises(DOMException);
    Node               replaceChild(in Node newChild, 
                                    in Node oldChild)
                                        raises(DOMException);
    Node               removeChild(in Node oldChild)
                                        raises(DOMException);
    Node               appendChild(in Node newChild)
                                        raises(DOMException);
    boolean            hasChildNodes();
    Node               cloneNode(in boolean deep)
                                        raises(DOMException);
  };

  interface NodeList {
    Node               item(in unsigned long index);
    readonly attribute unsigned long    length;
  };

  interface NamedNodeMap {
    Node               getNamedItem(in DOMString name);
    Node               setNamedItem(in Node arg)
                                        raises(DOMException);
    Node               removeNamedItem(in DOMString name)
                                        raises(DOMException);
    Node               item(in unsigned long index);
    readonly attribute unsigned long    length;
  };

  interface CharacterData : Node {
             attribute DOMString        data;
                                        // raises(DOMException) on setting
                                        // raises(DOMException) on retrieval

    readonly attribute unsigned long    length;
    DOMString          substringData(in unsigned long offset, 
                                     in unsigned long count)
                                        raises(DOMException);
    void               appendData(in DOMString arg)
                                        raises(DOMException);
    void               insertData(in unsigned long offset, 
                                  in DOMString arg)
                                        raises(DOMException);
    void               deleteData(in unsigned long offset, 
                                  in unsigned long count)
                                        raises(DOMException);
    void               replaceData(in unsigned long offset, 
                                   in unsigned long count, 
                                   in DOMString arg)
                                        raises(DOMException);
  };

  interface Attr : Node {
    readonly attribute DOMString        name;
    readonly attribute boolean          specified;
    // Modified in DOM Level 1:
             attribute DOMString        value;
                                        // raises(DOMException) on setting

  };

  interface Element : Node {
    readonly attribute DOMString        tagName;
    DOMString          getAttribute(in DOMString name);
    void               setAttribute(in DOMString name, 
                                    in DOMString value)
                                        raises(DOMException);
    void               removeAttribute(in DOMString name)
                                        raises(DOMException);
    Attr               getAttributeNode(in DOMString name);
    Attr               setAttributeNode(in Attr newAttr)
                                        raises(DOMException);
    Attr               removeAttributeNode(in Attr oldAttr)
                                        raises(DOMException);
    NodeList           getElementsByTagName(in DOMString name);
    void               normalize();
  };

  interface Text : CharacterData {
    Text               splitText(in unsigned long offset)
                                        raises(DOMException);
  };

  interface Comment : CharacterData {
  };

  interface CDATASection : Text {
  };

  interface DocumentType : Node {
    readonly attribute DOMString        name;
    readonly attribute NamedNodeMap     entities;
    readonly attribute NamedNodeMap     notations;
  };

  interface Notation : Node {
    readonly attribute DOMString        publicId;
    readonly attribute DOMString        systemId;
  };

  interface Entity : Node {
    readonly attribute DOMString        publicId;
    readonly attribute DOMString        systemId;
    readonly attribute DOMString        notationName;
  };

  interface EntityReference : Node {
  };

  interface ProcessingInstruction : Node {
    readonly attribute DOMString        target;
             attribute DOMString        data;
                                        // raises(DOMException) on setting

  };

  interface DocumentFragment : Node {
  };

  interface Document : Node {
    readonly attribute DocumentType     doctype;
    readonly attribute DOMImplementation  implementation;
    readonly attribute Element          documentElement;
    Element            createElement(in DOMString tagName)
                                        raises(DOMException);
    DocumentFragment   createDocumentFragment();
    Text               createTextNode(in DOMString data);
    Comment            createComment(in DOMString data);
    CDATASection       createCDATASection(in DOMString data)
                                        raises(DOMException);
    ProcessingInstruction createProcessingInstruction(in DOMString target, 
                                                      in DOMString data)
                                        raises(DOMException);
    Attr               createAttribute(in DOMString name)
                                        raises(DOMException);
    EntityReference    createEntityReference(in DOMString name)
                                        raises(DOMException);
    NodeList           getElementsByTagName(in DOMString tagname);
  };
};

#endif // _DOM_IDL_

B.2: Document Object Model Level 1 HTML

html.idl:

// File: html.idl

#ifndef _HTML_IDL_
#define _HTML_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module html
{

  typedef dom::DOMString DOMString;
  typedef dom::Node Node;
  typedef dom::Document Document;
  typedef dom::Element Element;
  typedef dom::NodeList NodeList;

  interface HTMLElement;
  interface HTMLFormElement;
  interface HTMLTableCaptionElement;
  interface HTMLTableSectionElement;

  interface HTMLCollection {
    readonly attribute unsigned long    length;
    Node               item(in unsigned long index);
    Node               namedItem(in DOMString name);
  };

  interface HTMLDocument : Document {
             attribute DOMString        title;
    readonly attribute DOMString        referrer;
    readonly attribute DOMString        domain;
    readonly attribute DOMString        URL;
             attribute HTMLElement      body;
    readonly attribute HTMLCollection   images;
    readonly attribute HTMLCollection   applets;
    readonly attribute HTMLCollection   links;
    readonly attribute HTMLCollection   forms;
    readonly attribute HTMLCollection   anchors;
             attribute DOMString        cookie;
    void               open();
    void               close();
    void               write(in DOMString text);
    void               writeln(in DOMString text);
    Element            getElementById(in DOMString elementId);
    NodeList           getElementsByName(in DOMString elementName);
  };

  interface HTMLElement : Element {
             attribute DOMString        id;
             attribute DOMString        title;
             attribute DOMString        lang;
             attribute DOMString        dir;
             attribute DOMString        className;
  };

  interface HTMLHtmlElement : HTMLElement {
             attribute DOMString        version;
  };

  interface HTMLHeadElement : HTMLElement {
             attribute DOMString        profile;
  };

  interface HTMLLinkElement : HTMLElement {
             attribute boolean          disabled;
             attribute DOMString        charset;
             attribute DOMString        href;
             attribute DOMString        hreflang;
             attribute DOMString        media;
             attribute DOMString        rel;
             attribute DOMString        rev;
             attribute DOMString        target;
             attribute DOMString        type;
  };

  interface HTMLTitleElement : HTMLElement {
             attribute DOMString        text;
  };

  interface HTMLMetaElement : HTMLElement {
             attribute DOMString        content;
             attribute DOMString        httpEquiv;
             attribute DOMString        name;
             attribute DOMString        scheme;
  };

  interface HTMLBaseElement : HTMLElement {
             attribute DOMString        href;
             attribute DOMString        target;
  };

  interface HTMLIsIndexElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute DOMString        prompt;
  };

  interface HTMLStyleElement : HTMLElement {
             attribute boolean          disabled;
             attribute DOMString        media;
             attribute DOMString        type;
  };

  interface HTMLBodyElement : HTMLElement {
             attribute DOMString        aLink;
             attribute DOMString        background;
             attribute DOMString        bgColor;
             attribute DOMString        link;
             attribute DOMString        text;
             attribute DOMString        vLink;
  };

  interface HTMLFormElement : HTMLElement {
    readonly attribute HTMLCollection   elements;
    readonly attribute long             length;
             attribute DOMString        name;
             attribute DOMString        acceptCharset;
             attribute DOMString        action;
             attribute DOMString        enctype;
             attribute DOMString        method;
             attribute DOMString        target;
    void               submit();
    void               reset();
  };

  interface HTMLSelectElement : HTMLElement {
    readonly attribute DOMString        type;
             attribute long             selectedIndex;
             attribute DOMString        value;
    readonly attribute long             length;
    readonly attribute HTMLFormElement  form;
    readonly attribute HTMLCollection   options;
             attribute boolean          disabled;
             attribute boolean          multiple;
             attribute DOMString        name;
             attribute long             size;
             attribute long             tabIndex;
    void               add(in HTMLElement element, 
                           in HTMLElement before)
                                        raises(dom::DOMException);
    void               remove(in long index);
    void               blur();
    void               focus();
  };

  interface HTMLOptGroupElement : HTMLElement {
             attribute boolean          disabled;
             attribute DOMString        label;
  };

  interface HTMLOptionElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute boolean          defaultSelected;
    readonly attribute DOMString        text;
    readonly attribute long             index;
             attribute boolean          disabled;
             attribute DOMString        label;
             attribute boolean          selected;
             attribute DOMString        value;
  };

  interface HTMLInputElement : HTMLElement {
             attribute DOMString        defaultValue;
             attribute boolean          defaultChecked;
    readonly attribute HTMLFormElement  form;
             attribute DOMString        accept;
             attribute DOMString        accessKey;
             attribute DOMString        align;
             attribute DOMString        alt;
             attribute boolean          checked;
             attribute boolean          disabled;
             attribute long             maxLength;
             attribute DOMString        name;
             attribute boolean          readOnly;
             attribute DOMString        size;
             attribute DOMString        src;
             attribute long             tabIndex;
    readonly attribute DOMString        type;
             attribute DOMString        useMap;
             attribute DOMString        value;
    void               blur();
    void               focus();
    void               select();
    void               click();
  };

  interface HTMLTextAreaElement : HTMLElement {
             attribute DOMString        defaultValue;
    readonly attribute HTMLFormElement  form;
             attribute DOMString        accessKey;
             attribute long             cols;
             attribute boolean          disabled;
             attribute DOMString        name;
             attribute boolean          readOnly;
             attribute long             rows;
             attribute long             tabIndex;
    readonly attribute DOMString        type;
             attribute DOMString        value;
    void               blur();
    void               focus();
    void               select();
  };

  interface HTMLButtonElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute DOMString        accessKey;
             attribute boolean          disabled;
             attribute DOMString        name;
             attribute long             tabIndex;
    readonly attribute DOMString        type;
             attribute DOMString        value;
  };

  interface HTMLLabelElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute DOMString        accessKey;
             attribute DOMString        htmlFor;
  };

  interface HTMLFieldSetElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
  };

  interface HTMLLegendElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute DOMString        accessKey;
             attribute DOMString        align;
  };

  interface HTMLUListElement : HTMLElement {
             attribute boolean          compact;
             attribute DOMString        type;
  };

  interface HTMLOListElement : HTMLElement {
             attribute boolean          compact;
             attribute long             start;
             attribute DOMString        type;
  };

  interface HTMLDListElement : HTMLElement {
             attribute boolean          compact;
  };

  interface HTMLDirectoryElement : HTMLElement {
             attribute boolean          compact;
  };

  interface HTMLMenuElement : HTMLElement {
             attribute boolean          compact;
  };

  interface HTMLLIElement : HTMLElement {
             attribute DOMString        type;
             attribute long             value;
  };

  interface HTMLDivElement : HTMLElement {
             attribute DOMString        align;
  };

  interface HTMLParagraphElement : HTMLElement {
             attribute DOMString        align;
  };

  interface HTMLHeadingElement : HTMLElement {
             attribute DOMString        align;
  };

  interface HTMLQuoteElement : HTMLElement {
             attribute DOMString        cite;
  };

  interface HTMLPreElement : HTMLElement {
             attribute long             width;
  };

  interface HTMLBRElement : HTMLElement {
             attribute DOMString        clear;
  };

  interface HTMLBaseFontElement : HTMLElement {
             attribute DOMString        color;
             attribute DOMString        face;
             attribute DOMString        size;
  };

  interface HTMLFontElement : HTMLElement {
             attribute DOMString        color;
             attribute DOMString        face;
             attribute DOMString        size;
  };

  interface HTMLHRElement : HTMLElement {
             attribute DOMString        align;
             attribute boolean          noShade;
             attribute DOMString        size;
             attribute DOMString        width;
  };

  interface HTMLModElement : HTMLElement {
             attribute DOMString        cite;
             attribute DOMString        dateTime;
  };

  interface HTMLAnchorElement : HTMLElement {
             attribute DOMString        accessKey;
             attribute DOMString        charset;
             attribute DOMString        coords;
             attribute DOMString        href;
             attribute DOMString        hreflang;
             attribute DOMString        name;
             attribute DOMString        rel;
             attribute DOMString        rev;
             attribute DOMString        shape;
             attribute long             tabIndex;
             attribute DOMString        target;
             attribute DOMString        type;
    void               blur();
    void               focus();
  };

  interface HTMLImageElement : HTMLElement {
             attribute DOMString        lowSrc;
             attribute DOMString        name;
             attribute DOMString        align;
             attribute DOMString        alt;
             attribute DOMString        border;
             attribute DOMString        height;
             attribute DOMString        hspace;
             attribute boolean          isMap;
             attribute DOMString        longDesc;
             attribute DOMString        src;
             attribute DOMString        useMap;
             attribute DOMString        vspace;
             attribute DOMString        width;
  };

  interface HTMLObjectElement : HTMLElement {
    readonly attribute HTMLFormElement  form;
             attribute DOMString        code;
             attribute DOMString        align;
             attribute DOMString        archive;
             attribute DOMString        border;
             attribute DOMString        codeBase;
             attribute DOMString        codeType;
             attribute DOMString        data;
             attribute boolean          declare;
             attribute DOMString        height;
             attribute DOMString        hspace;
             attribute DOMString        name;
             attribute DOMString        standby;
             attribute long             tabIndex;
             attribute DOMString        type;
             attribute DOMString        useMap;
             attribute DOMString        vspace;
             attribute DOMString        width;
  };

  interface HTMLParamElement : HTMLElement {
             attribute DOMString        name;
             attribute DOMString        type;
             attribute DOMString        value;
             attribute DOMString        valueType;
  };

  interface HTMLAppletElement : HTMLElement {
             attribute DOMString        align;
             attribute DOMString        alt;
             attribute DOMString        archive;
             attribute DOMString        code;
             attribute DOMString        codeBase;
             attribute DOMString        height;
             attribute DOMString        hspace;
             attribute DOMString        name;
             attribute DOMString        object;
             attribute DOMString        vspace;
             attribute DOMString        width;
  };

  interface HTMLMapElement : HTMLElement {
    readonly attribute HTMLCollection   areas;
             attribute DOMString        name;
  };

  interface HTMLAreaElement : HTMLElement {
             attribute DOMString        accessKey;
             attribute DOMString        alt;
             attribute DOMString        coords;
             attribute DOMString        href;
             attribute boolean          noHref;
             attribute DOMString        shape;
             attribute long             tabIndex;
             attribute DOMString        target;
  };

  interface HTMLScriptElement : HTMLElement {
             attribute DOMString        text;
             attribute DOMString        htmlFor;
             attribute DOMString        event;
             attribute DOMString        charset;
             attribute boolean          defer;
             attribute DOMString        src;
             attribute DOMString        type;
  };

  interface HTMLTableElement : HTMLElement {
             attribute HTMLTableCaptionElement  caption;
             attribute HTMLTableSectionElement  tHead;
             attribute HTMLTableSectionElement  tFoot;
    readonly attribute HTMLCollection   rows;
    readonly attribute HTMLCollection   tBodies;
             attribute DOMString        align;
             attribute DOMString        bgColor;
             attribute DOMString        border;
             attribute DOMString        cellPadding;
             attribute DOMString        cellSpacing;
             attribute DOMString        frame;
             attribute DOMString        rules;
             attribute DOMString        summary;
             attribute DOMString        width;
    HTMLElement        createTHead();
    void               deleteTHead();
    HTMLElement        createTFoot();
    void               deleteTFoot();
    HTMLElement        createCaption();
    void               deleteCaption();
    HTMLElement        insertRow(in long index)
                                        raises(dom::DOMException);
    void               deleteRow(in long index)
                                        raises(dom::DOMException);
  };

  interface HTMLTableCaptionElement : HTMLElement {
             attribute DOMString        align;
  };

  interface HTMLTableColElement : HTMLElement {
             attribute DOMString        align;
             attribute DOMString        ch;
             attribute DOMString        chOff;
             attribute long             span;
             attribute DOMString        vAlign;
             attribute DOMString        width;
  };

  interface HTMLTableSectionElement : HTMLElement {
             attribute DOMString        align;
             attribute DOMString        ch;
             attribute DOMString        chOff;
             attribute DOMString        vAlign;
    readonly attribute HTMLCollection   rows;
    HTMLElement        insertRow(in long index)
                                        raises(dom::DOMException);
    void               deleteRow(in long index)
                                        raises(dom::DOMException);
  };

  interface HTMLTableRowElement : HTMLElement {
    readonly attribute long             rowIndex;
    readonly attribute long             sectionRowIndex;
    readonly attribute HTMLCollection   cells;
             attribute DOMString        align;
             attribute DOMString        bgColor;
             attribute DOMString        ch;
             attribute DOMString        chOff;
             attribute DOMString        vAlign;
    HTMLElement        insertCell(in long index)
                                        raises(dom::DOMException);
    void               deleteCell(in long index)
                                        raises(dom::DOMException);
  };

  interface HTMLTableCellElement : HTMLElement {
    readonly attribute long             cellIndex;
             attribute DOMString        abbr;
             attribute DOMString        align;
             attribute DOMString        axis;
             attribute DOMString        bgColor;
             attribute DOMString        ch;
             attribute DOMString        chOff;
             attribute long             colSpan;
             attribute DOMString        headers;
             attribute DOMString        height;
             attribute boolean          noWrap;
             attribute long             rowSpan;
             attribute DOMString        scope;
             attribute DOMString        vAlign;
             attribute DOMString        width;
  };

  interface HTMLFrameSetElement : HTMLElement {
             attribute DOMString        cols;
             attribute DOMString        rows;
  };

  interface HTMLFrameElement : HTMLElement {
             attribute DOMString        frameBorder;
             attribute DOMString        longDesc;
             attribute DOMString        marginHeight;
             attribute DOMString        marginWidth;
             attribute DOMString        name;
             attribute boolean          noResize;
             attribute DOMString        scrolling;
             attribute DOMString        src;
  };

  interface HTMLIFrameElement : HTMLElement {
             attribute DOMString        align;
             attribute DOMString        frameBorder;
             attribute DOMString        height;
             attribute DOMString        longDesc;
             attribute DOMString        marginHeight;
             attribute DOMString        marginWidth;
             attribute DOMString        name;
             attribute DOMString        scrolling;
             attribute DOMString        src;
             attribute DOMString        width;
  };
};

#endif // _HTML_IDL_