09 February 2001

Appendix A: IDL Definitions

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

The IDL files are also available as: http://www.w3.org/TR/2001/WD-DOM-Level-3-CMLS-20010209/idl.zip

content-models.idl:

// File: content-models.idl

#ifndef _CONTENT-MODELS_IDL_
#define _CONTENT-MODELS_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module content-models
{

  typedef dom::int int;
  typedef dom::DOMString DOMString;
  typedef dom::CMExternalModel * CMExternalModel *;
  typedef dom::Node Node;
  typedef dom::nsElement nsElement;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Element Element;
  typedef dom::Text Text;
  typedef dom::DocumentType DocumentType;

  interface CMChildren;
  interface DOMErrorHandler;
  interface CMModel;
  interface DOMLocator;

  interface CMNode {
    const unsigned short      ELEMENT_DECLARATION            = 1;
    const unsigned short      ATTRIBUTE_DECLARATION          = 2;
    const unsigned short      CM_NOTATION_DECLARATION        = 3;
    const unsigned short      ENTITY_DECLARATION             = 4;
    const unsigned short      CM_CHILDREN                    = 5;
    const unsigned short      CM_MODEL                       = 6;
    const unsigned short      CM_EXTERNALMODEL               = 7;
    readonly attribute unsigned short   cmNodeType;
    CMNode             cloneCM();
    CMNode             cloneExternalCM();
  };

  interface CMNodeList {
  };

  interface CMNamedNodeMap {
  };

  interface CMDataType {
    const short               STRING_DATATYPE                = 1;
    const short               BOOLEAN_DATATYPE               = 2;
    const short               FLOAT_DATATYPE                 = 3;
    const short               DOUBLE_DATATYPE                = 4;
    const short               LONG_DATATYPE                  = 5;
    const short               INT_DATATYPE                   = 6;
    const short               SHORT_DATATYPE                 = 7;
    const short               BYTE_DATATYPE                  = 8;
             attribute int              lowValue;
             attribute int              highValue;
    short              getPrimitiveType();
  };

  interface ElementDeclaration {
    int                getContentType();
    CMChildren         getCMChildren();
    CMNamedNodeMap     getCMAttributes();
    CMNamedNodeMap     getCMGrandChildren();
  };

  interface CMChildren {
             attribute DOMString        listOperator;
             attribute CMDataType       elementType;
             attribute int              multiplicity;
             attribute CMNamedNodeMap   subModels;
    readonly attribute boolean          isPCDataOnly;
  };

  interface AttributeDeclaration {
    const short               NO_VALUE_CONSTRAINT            = 0;
    const short               DEFAULT_VALUE_CONSTRAINT       = 1;
    const short               FIXED_VALUE_CONSTRAINT         = 2;
    readonly attribute DOMString        attrName;
             attribute CMDataType       attrType;
             attribute DOMString        attributeValue;
             attribute DOMString        enumAttr;
             attribute CMNodeList       ownerElement;
             attribute short            constraintType;
  };

  interface EntityDeclaration {
  };

  interface CMNotationDeclaration {
             attribute DOMString        strSystemIdentifier;
             attribute DOMString        strPublicIdentifier;
  };

  interface Document {
    void               setErrorHandler(in DOMErrorHandler handler);
  };

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

  interface AttributeCM {
    AttributeDeclaration getAttributeDeclaration();
    CMNotationDeclaration getNotation()
                                        raises(dom::DOMException);
  };

  interface DOMErrorHandler {
    void               warning(in DOMLocator where, 
                               in DOMString how, 
                               in DOMString why)
                                        raises(dom::DOMSystemException);
    void               fatalError(in DOMLocator where, 
                                  in DOMString how, 
                                  in DOMString why)
                                        raises(dom::DOMSystemException);
    void               error(in DOMLocator where, 
                             in DOMString how, 
                             in DOMString why)
                                        raises(dom::DOMSystemException);
  };

  interface DOMLocator {
    int                getColumnNumber();
    int                getLineNumber();
    DOMString          getPublicID();
    DOMString          getSystemID();
    Node               getNode();
  };

  interface CMModel : CMNode {
    readonly attribute boolean          isNamespaceAware;
    readonly attribute ElementDeclaration  rootElementDecl;
    DOMString          getLocation();
    nsElement          getCMNamespace();
    CMNamedNodeMap     getCMNodes();
    boolean            removeNode(in CMNode node);
    boolean            insertBefore(in CMNode newNode, 
                                    in CMNode refNode);
    boolean            validate();
  };

  interface CMExternalModel : CMModel {
  };

  interface DOMImplementationCM : DOMImplementation {
    CMModel            createCM();
    CMExternalModel    createExternalCM();
  };

  interface NodeCM : Node {
    boolean            canInsertBefore(in Node newChild, 
                                       in Node refChild)
                                        raises(dom::DOMException);
    boolean            canRemoveChild(in Node oldChild)
                                        raises(dom::DOMException);
    boolean            canReplaceChild(in Node newChild, 
                                       in Node oldChild)
                                        raises(dom::DOMException);
    boolean            canAppendChild(in Node newChild)
                                        raises(dom::DOMException);
    boolean            isValid();
  };

  interface ElementCM : Element {
    int                contentType();
    ElementDeclaration getElementDeclaration()
                                        raises(dom::DOMException);
    boolean            canSetAttribute(in DOMString attrname, 
                                       in DOMString attrval);
    boolean            canSetAttributeNode(in Node node);
    boolean            canSetAttributeNodeNS(in Node node, 
                                             in DOMString namespaceURI, 
                                             in DOMString localName);
    boolean            canSetAttributeNS(in DOMString attrname, 
                                         in DOMString attrval, 
                                         in DOMString namespaceURI, 
                                         in DOMString localName);
  };

  interface CharacterDataCM : Text {
    boolean            isWhitespaceOnly();
    boolean            canSetData(in unsigned long offset, 
                                  in DOMString arg)
                                        raises(dom::DOMException);
    boolean            canAppendData(in DOMString arg)
                                        raises(dom::DOMException);
    boolean            canReplaceData(in unsigned long offset, 
                                      in unsigned long count, 
                                      in DOMString arg)
                                        raises(dom::DOMException);
    boolean            canInsertData(in unsigned long offset, 
                                     in DOMString arg)
                                        raises(dom::DOMException);
    boolean            canDeleteData(in unsigned long offset, 
                                     in DOMString arg)
                                        raises(dom::DOMException);
  };

  interface DocumentTypeCM : DocumentType {
    boolean            isElementDefined(in DOMString elemTypeName);
    boolean            isElementDefinedNS(in DOMString elemTypeName, 
                                          in DOMString namespaceURI, 
                                          in DOMString localName);
    boolean            isAttributeDefined(in DOMString elemTypeName, 
                                          in DOMString attrName);
    boolean            isAttributeDefinedNS(in DOMString elemTypeName, 
                                            in DOMString attrName, 
                                            in DOMString namespaceURI, 
                                            in DOMString localName);
    boolean            isEntityDefined(in DOMString entName);
  };
};

#endif // _CONTENT-MODELS_IDL_

load-save.idl:

// File: load-save.idl

#ifndef _LOAD-SAVE_IDL_
#define _LOAD-SAVE_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"
module load-save
{

  typedef dom::DOMErrorHandler DOMErrorHandler;
  typedef dom::DOMString DOMString;
  typedef dom::Document Document;
  typedef dom::DOMInputStream DOMInputStream;
  typedef dom::DOMReader DOMReader;
  typedef dom::Element Element;
  typedef dom::DOMOutputStream DOMOutputStream;
  typedef dom::Node Node;

  interface DOMBuilder;
  interface DOMWriter;
  interface DOMEntityResolver;
  interface DOMBuilderFilter;
  interface DOMInputSource;

  interface DOMImplementationLS {
    DOMBuilder         createDOMBuilder();
    DOMWriter          createDOMWriter();
  };

  interface DOMBuilder {
             attribute DOMEntityResolver  entityResolver;
             attribute DOMErrorHandler  errorHandler;
             attribute DOMBuilderFilter  filter;
    void               setFeature(in DOMString name, 
                                  in boolean state)
                                        raises(dom::DOMException);
    boolean            supportsFeature(in DOMString name);
    boolean            canSetFeature(in DOMString name, 
                                     in boolean state);
    boolean            getFeature(in DOMString name)
                                        raises(dom::DOMException);
    Document           parseURI(in DOMString uri)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
    Document           parseDOMInputSource(in DOMInputSource is)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
  };

  interface DOMInputSource {
             attribute DOMInputStream   byteStream;
             attribute DOMReader        characterStream;
             attribute DOMString        encoding;
             attribute DOMString        publicId;
             attribute DOMString        systemId;
  };

  interface DOMEntityResolver {
    DOMInputSource     resolveEntity(in DOMString publicId, 
                                     in DOMString systemId )
                                        raises(dom::DOMSystemException);
  };

  interface DOMBuilderFilter {
    boolean            endElement(in Element element);
  };

  interface DOMWriter {
             attribute DOMString        encoding;
    readonly attribute DOMString        lastEncoding;
             attribute unsigned short   format;
    // Modified in DOM Level 3:
             attribute DOMString        newLine;
    void               writeNode(in DOMOutputStream destination, 
                                 in Node node)
                                        raises(dom::DOMSystemException);
  };
};

#endif // _LOAD-SAVE_IDL_