01 November, 2000

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/2000/WD-DOM-Level-3-Content-Models-and-Load-Save-20001101/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::DOMString DOMString;
  typedef dom::int int;
  typedef dom::Node Node;
  typedef dom::nsElement nsElement;
  typedef dom::namedCMNodeMap namedCMNodeMap;
  typedef dom::Document Document;
  typedef dom::DomImplementation DomImplementation;
  typedef dom::Element Element;
  typedef dom::Text Text;
  typedef dom::DocumentType DocumentType;

  interface DOMLocator;

  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 CMElement {
             attribute DOMString        listOperator;
             attribute CMDataType       elementType;
             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 DOMLocator where, 
                               in DOMString how, 
                               in DOMString why)
                                        raises(dom::DOMException2);
    void               fatalError(in DOMLocator where, 
                                  in DOMString how, 
                                  in DOMString why)
                                        raises(dom::DOMException2);
    void               error(in DOMLocator where, 
                             in DOMString how, 
                             in DOMString why)
                                        raises(dom::DOMException2);
  };

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

  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();
    CMElement          getCMElement();
    namedCMNodeMap     getCMAttributes();
    namedCMNodeMap     getCMElementsChildren();
  };

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

  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);
    void               setErrorHandler(in ErrorHandler handler);
  };

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

  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);
  };

  interface ElementCM : Element {
    boolean            isValid();
    int                contentType();
    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::DOMString  DOMString ;
  typedef dom::Element Element;
  typedef dom::DOMOutputStream DOMOutputStream;
  typedef dom::Node Node;
  typedef dom::TreeWalker TreeWalker;

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

  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 DOMFormatter     formatter;
    void               writeNode(in DOMOutputStream destination, 
                                 in Node node)
                                        raises(dom::DOMSystemException);
    void               writeTreeWalker(in DOMOutputStream destination, 
                                       in TreeWalker tree)
                                        raises(dom::DOMSystemException);
    void               writeString(in DOMOutputStream destination, 
                                   in DOMString aString)
                                        raises(dom::DOMSystemException);
  };

  interface DOMFormatter {
             attribute DOMString        encoding;
    readonly attribute DOMString        lastEncoding;
             attribute DOMString        substituteChars;
             attribute unsigned short   format;
    void               formatNode(in Node rootNode, 
                                  in DOMOutputStream destination)
                                        raises(dom::DOMSystemException);
    void               formatTreeWalker(in TreeWalker tree, 
                                        in DOMOutputStream destination)
                                        raises(dom::DOMSystemException);
  };
};

#endif // _LOAD-SAVE_IDL_