19 April 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-20010419/idl.zip


// File: content-models.idl


#include "dom.idl"

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

  typedef dom::DOMString DOMString;
  typedef dom::decimal decimal;
  typedef dom::int int;
  typedef dom::Node Node;
  typedef dom::nsElement nsElement;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Element,NodeCM Element,NodeCM;
  typedef dom::Text,NodeCM Text,NodeCM;
  typedef dom::DocumentType,NodeCM DocumentType,NodeCM;
  typedef dom::Attr,NodeCM Attr,NodeCM;

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

  interface CMNode {
    const unsigned short      CM_ELEMENT_DECLARATION         = 1;
    const unsigned short      CM_ATTRIBUTE_DECLARATION       = 2;
    const unsigned short      CM_NOTATION_DECLARATION        = 3;
    const unsigned short      CM_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;
             attribute CMModel          ownerCMModel;
             attribute DOMString        nodeName;
             attribute DOMString        prefix;
             attribute DOMString        localName;
             attribute DOMString        namespaceURI;
    CMNode             clone();

  interface CMNodeList {

  interface CMNamedNodeMap {

  interface CMDataType {
    const short               STRING_DATATYPE                = 1;
    short              getCMPrimitiveType();

  interface CMPrimitiveType : CMDataType {
    const short               BOOLEAN_DATATYPE               = 2;
    const short               FLOAT_DATATYPE                 = 3;
    const short               DOUBLE_DATATYPE                = 4;
    const short               DECIMAL_DATATYPE               = 5;
    const short               HEXBINARY_DATATYPE             = 6;
    const short               BASE64BINARY_DATATYPE          = 7;
    const short               ANYURI_DATATYPE                = 8;
    const short               QNAME_DATATYPE                 = 9;
    const short               DURATION_DATATYPE              = 10;
    const short               DATETIME_DATATYPE              = 11;
    const short               DATE_DATATYPE                  = 12;
    const short               TIME_DATATYPE                  = 13;
    const short               YEARMONTH_DATATYPE             = 14;
    const short               YEAR_DATATYPE                  = 15;
    const short               MONTHDAY_DATATYPE              = 16;
    const short               DAY_DATATYPE                   = 17;
    const short               MONTH_DATATYPE                 = 18;
    const short               NOTATION_DATATYPE              = 19;
             attribute decimal          lowValue;
             attribute decimal          highValue;

  interface CMElementDeclaration : CMNode {
             attribute CMDataType       elementType;
    readonly attribute boolean          isPCDataOnly;
             attribute DOMString        tagName;
    int                getContentType();
    CMChildren         getCMChildren();
    CMNamedNodeMap     getCMAttributes();
    CMNamedNodeMap     getCMGrandChildren();

  interface CMChildren : CMNode {
    const unsigned long       UNBOUNDED                      = MAX_LONG;
    const unsigned short      NONE                           = 0;
    const unsigned short      SEQUENCE                       = 1;
    const unsigned short      CHOICE                         = 2;
             attribute unsigned short   listOperator;
             attribute unsigned long    minOccurs;
             attribute unsigned long    maxOccurs;
             attribute CMNodeList       subModels;
    CMNode             removeCMNode(in unsigned long nodeIndex);
    int                insertCMNode(in unsigned long nodeIndex, 
                                    in CMNode newNode);
    int                appendCMNode(in CMNode newNode);

  interface CMAttributeDeclaration : CMNode {
    const short               NO_VALUE_CONSTRAINT            = 0;
    const short               DEFAULT_VALUE_CONSTRAINT       = 1;
    const short               FIXED_VALUE_CONSTRAINT         = 2;
             attribute DOMString        attrName;
             attribute CMDataType       attrType;
             attribute DOMString        attributeValue;
             attribute DOMString        enumAttr;
             attribute CMNodeList       ownerElement;
             attribute short            constraintType;

  interface CMEntityDeclaration : CMNode {
    const short               INTERNAL_ENTITY                = 1;
    const short               EXTERNAL_ENTITY                = 2;
             attribute short            entityType;
             attribute DOMString        entityName;
             attribute DOMString        entityValue;
             attribute DOMString        systemId;
             attribute DOMString        publicId;
             attribute DOMString        notationName;

  interface CMNotationDeclaration : CMNode {
             attribute DOMString        notationName;
             attribute DOMString        systemId;
             attribute DOMString        publicId;

  interface Document {
    void               setErrorHandler(in DOMErrorHandler handler);

  interface DocumentCM : Document {
    const short               WF_CHECK                       = 1;
    const short               NS_WF_CHECK                    = 2;
    const short               PARTIAL_VALIDITY_CHECK         = 3;
    const short               STRICT_VALIDITY_CHECK          = 4;
             attribute boolean          continuousValidityChecking;
             attribute short            wfValidityCheckLevel;
    int                numCMs();
    CMModel            getInternalCM();
    CMNodeList         getCMs();
    CMModel            getActiveCM();
    void               addCM(in CMModel cm);
    void               removeCM(in CMModel cm);
    boolean            activateCM(in CMModel cm);

  interface DOMErrorHandler {
    void               warning(in DOMLocator where, 
                               in DOMString how, 
                               in DOMString why)
    void               fatalError(in DOMLocator where, 
                                  in DOMString how, 
                                  in DOMString why)
    void               error(in DOMLocator where, 
                             in DOMString how, 
                             in DOMString why)

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

  interface CMModel : CMNode {
    readonly attribute boolean          isNamespaceAware;
             attribute CMElementDeclaration  rootElementDecl;
    DOMString          getLocation();
    nsElement          getCMNamespace();
    CMNamedNodeMap     getCMNodes();
    boolean            removeNode(in CMNode node);
    boolean            insertBefore(in CMNode newNode, 
                                    in CMNode refNode);
    boolean            validate();
    CMElementDeclaration createCMElementDeclaration(inout DOMString namespaceURI, 
                                                    in DOMString qualifiedElementName, 
                                                    in int contentSpec)
    CMAttributeDeclaration createCMAttributeDeclaration(inout DOMString namespaceURI, 
                                                        in DOMString qualifiedName)
    CMNotationDeclaration createCMNotationDeclaration(in DOMString name, 
                                                      in DOMString systemIdentifier, 
                                                      inout DOMString publicIdentifier)
    CMEntityDeclaration createCMEntityDeclaration(in DOMString name)
    CMChildren         createCMChildren(in unsigned long minOccurs, 
                                        in unsigned long maxOccurs, 
                                        inout unsigned short operator)

  interface CMExternalModel : CMModel {

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

  interface NodeCM : Node {
    boolean            canInsertBefore(in Node newChild, 
                                       in Node refChild)
    boolean            canRemoveChild(in Node oldChild)
    boolean            canReplaceChild(in Node newChild, 
                                       in Node oldChild)
    boolean            canAppendChild(in Node newChild)
    boolean            isValid()

  interface ElementCM : Element,NodeCM {
    int                contentType();
    CMElementDeclaration getElementDeclaration()
    boolean            canSetAttribute(in DOMString attrname, 
                                       in DOMString attrval);
    boolean            canSetAttributeNode(in Node node);
    boolean            canSetAttributeNodeNS(in Node node);
    boolean            canSetAttributeNS(in DOMString attrname, 
                                         in DOMString attrval, 
                                         in DOMString namespaceURI, 
                                         in DOMString localName);
    boolean            canRemoveAttribute(in DOMString attrname);
    boolean            canRemoveAttributeNS(in DOMString attrname, 
                                            inout DOMString namespaceURI);
    boolean            canRemoveAttributeNode(in Node node);

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

  interface DocumentTypeCM : DocumentType,NodeCM {
    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);

  interface AttributeCM : Attr,NodeCM {
    CMAttributeDeclaration getAttributeDeclaration();
    CMNotationDeclaration getNotation()



// 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)
    boolean            supportsFeature(in DOMString name);
    boolean            canSetFeature(in DOMString name, 
                                     in boolean state);
    boolean            getFeature(in DOMString name)
    Document           parseURI(in DOMString uri)
    Document           parseDOMInputSource(in DOMInputSource is)

  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 )

  interface DOMBuilderFilter {
    boolean            startElement(in Element element);
    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)

  interface DocumentLS {
             attribute boolean          async;
    void               abort();
    boolean            load(in DOMString url);
    boolean            loadXML(in DOMString source);
    DOMString          saveXML(in Node node)

  interface ParserErrorEvent {
    readonly attribute long             errorCode;
    readonly attribute long             filepos;
    readonly attribute long             line;
    readonly attribute long             linepos;
    readonly attribute DOMString        reason;
    readonly attribute DOMString        srcText;
    readonly attribute DOMString        url;

#endif // _LOAD-SAVE_IDL_