01 September, 2000

Appendix A: IDL Definitions

This appendix contains the complete OMG IDL [OMGIDL] for the Level 3 Document Object Model Content Model definitions.

The IDL files are also available as: http://www.w3.org/TR/2000/WD-DOM-Level-3-Content-Models-and-Load-Save-20000901/idl.zip

contentModel.idl:

// File: contentModel.idl

#ifndef _CONTENTMODEL_IDL_
#define _CONTENTMODEL_IDL_

#include "dom.idl"

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

  typedef dom::DOMString DOMString;
  typedef dom::int int;
  typedef dom::where where;
  typedef dom::how how;
  typedef dom::why why;
  typedef dom::nsElement nsElement;
  typedef dom::namedCMNodeMap namedCMNodeMap;
  typedef dom::Document Document;
  typedef dom::CMExternalObject * CMExternalObject *;
  typedef dom::DomImplementation DomImplementation;
  typedef dom::Node Node;
  typedef dom::Text Text;

  interface CMObject {
  };

  interface CMExternalObject {
  };

  interface CMNode {
  };

  interface CMNodeList {
  };

  interface NamedCMNodeMap {
  };

  interface CMDataType {
  };

  interface CMType {
  };

  interface ElementDeclaration {
    readonly attribute DOMString        elementName;
             attribute DOMString        contentType;
             attribute NamedCMNodeMap   attributes;
  };

  interface ElementCMModel {
             attribute DOMString        listOperator;
             attribute int              multiplicity;
             attribute int              lowValue;
             attribute int              highValue;
             attribute NamedCMNodeMap   subModels;
             attribute CMNodeList       definingElement;
  };

  interface AttributeDeclaration {
    readonly attribute DOMString        attrName;
             attribute CMDataType       attrType;
             attribute DOMString        defaultValue;
             attribute DOMString        enumAttr;
             attribute CMNodeList       ownerElement;
  };

  interface EntityDeclaration {
  };

  interface ErrorHandler {
    void               warning(in where DOMString, 
                               in how DOMString, 
                               in why DOMString)
                                        raises(dom::DOMException2);
    void               fatalError(in where DOMString, 
                                  in how DOMString, 
                                  in why DOMString)
                                        raises(dom::DOMException2);
    void               error(in where DOMString, 
                             in how DOMString, 
                             in why DOMString)
                                        raises(dom::DOMException2);
  };

  interface CMObject {
    readonly attribute boolean          isNamespaceAware;
    nsElement          getCMNamespace();
    namedCMNodeMap     getCMElements();
    boolean            removeCMNode(in CMNode node);
    boolean            insertbeforeCMNode(in CMNode newnode, 
                                          in CMNode parentnode);
  };

  interface CMNode {
    CMType             getCMNodeType();
  };

  interface ElementDeclaration {
    int                getContentType();
    ElementCMModel     getCMElement();
    namedCMNodeMap     getCMAttributes();
    namedCMNodeMap     getCMElementsChildren();
  };

  interface ElementCMModel {
    ElementCMModel     setCMElementCardinality(in CMNode node, 
                                               in int high, 
                                               in int low);
    ElementCMModel     getCMElementCardinality(in CMNode node, 
                                               out int high, 
                                               out int low);
  };

  interface ElementCMModel {
    boolean            isValid();
    int                contentType();
    boolean            canSetAttribute(in DOMString attrname, 
                                       in DOMString attrval);
    boolean            canSetAttributeNode();
  };

  interface DocumentCM : Document {
    boolean            isValid();
    int                numCMs();
    CMObject           getInternalCM();
    CMExternalObject * getCMs();
    CMObject           getActiveCM();
    void               addCM(in CMObject cm);
    void               removeCM(in CMObject cm);
    boolean            activateCM(in CMObject cm);
  };

  interface DomImplementationCM : DomImplementation {
    boolean            validate();
    CMObject           createCM();
    CMExternalObject   createExternalCM();
    CMObject           cloneCM(in CMObject cm);
    CMExternalObject   cloneExternalCM(in CMExternalObject cm);
  };

  interface NodeCM : Node {
    boolean            canInsertBefore();
    boolean            canRemoveChild();
    boolean            canReplaceChild();
    boolean            canAppendChild();
  };

  interface TextCM : Text {
    boolean            isWhitespaceOnly();
    boolean            canSetData();
    boolean            canAppendData();
    boolean            canReplaceData();
    boolean            canInsertData();
  };

  interface DocumentCM : Document {
    boolean            isElementDefined(in DOMString elemTypeName);
    boolean            isAttributeDefined(in DOMString elemTypeName, 
                                          in DOMString attrName);
    boolean            isEntityDefined(in DOMString entName);
  };
};

#endif // _CONTENTMODEL_IDL_