25 October 2001

Appendix A: IDL Definitions

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

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


// File: as.idl

#ifndef _AS_IDL_
#define _AS_IDL_

#include "dom.idl"
#include "ls.idl"

#pragma prefix "dom.w3c.org"
module as

  typedef dom::DOMString DOMString;
  typedef dom::Node Node;
  typedef dom::NodeList NodeList;
  typedef dom::Attr Attr;
  typedef dom::DOMOutputStream DOMOutputStream;

  interface ASModel;
  interface ASContentModel;
  interface ASAttributeDeclaration;
  interface DOMASBuilder;
  interface DOMASWriter;

  exception DOMASException {
    unsigned short   code;
  // ASExceptionCode
  const unsigned short      DUPLICATE_NAME_ERR             = 1;
  const unsigned short      TYPE_ERR                       = 2;
  const unsigned short      NO_AS_AVAILABLE                = 3;
  const unsigned short      WRONG_MIME_TYPE_ERR            = 4;

  interface ASObject {

    // ASObjectType
    const unsigned short      AS_ELEMENT_DECLARATION         = 1;
    const unsigned short      AS_ATTRIBUTE_DECLARATION       = 2;
    const unsigned short      AS_NOTATION_DECLARATION        = 3;
    const unsigned short      AS_ENTITY_DECLARATION          = 4;
    const unsigned short      AS_CONTENTMODEL                = 5;
    const unsigned short      AS_MODEL                       = 6;

    readonly attribute unsigned short   asNodeType;
             attribute ASModel          ownerASModel;
             attribute DOMString        nodeName;
             attribute DOMString        prefix;
             attribute DOMString        localName;
             attribute DOMString        namespaceURI;
    ASObject           cloneASObject(in boolean deep);

  interface ASObjectList {
    readonly attribute unsigned long    length;
    ASObject           item(in unsigned long index);

  interface ASNamedObjectMap {
    readonly attribute unsigned long    length;
    ASObject           getNamedItem(in DOMString name);
    ASObject           getNamedItemNS(in DOMString namespaceURI, 
                                      in DOMString localName);
    ASObject           item(in unsigned long index);
    ASObject           removeNamedItem(in DOMString name)
    ASObject           removeNamedItemNS(in DOMString namespaceURI, 
                                         in DOMString localName)
    ASObject           setNamedItem(in ASObject newASObject)
    ASObject           setNamedItemNS(in ASObject newASObject)

  interface ASDataType {
    readonly attribute unsigned short   dataType;

    const unsigned short      STRING_DATATYPE                = 1;
    const unsigned short      NOTATION_DATATYPE              = 10;
    const unsigned short      ID_DATATYPE                    = 11;
    const unsigned short      IDREF_DATATYPE                 = 12;
    const unsigned short      IDREFS_DATATYPE                = 13;
    const unsigned short      ENTITY_DATATYPE                = 14;
    const unsigned short      ENTITIES_DATATYPE              = 15;
    const unsigned short      NMTOKEN_DATATYPE               = 16;
    const unsigned short      NMTOKENS_DATATYPE              = 17;
    const unsigned short      BOOLEAN_DATATYPE               = 100;
    const unsigned short      FLOAT_DATATYPE                 = 101;
    const unsigned short      DOUBLE_DATATYPE                = 102;
    const unsigned short      DECIMAL_DATATYPE               = 103;
    const unsigned short      HEXBINARY_DATATYPE             = 104;
    const unsigned short      BASE64BINARY_DATATYPE          = 105;
    const unsigned short      ANYURI_DATATYPE                = 106;
    const unsigned short      QNAME_DATATYPE                 = 107;
    const unsigned short      DURATION_DATATYPE              = 108;
    const unsigned short      DATETIME_DATATYPE              = 109;
    const unsigned short      DATE_DATATYPE                  = 110;
    const unsigned short      TIME_DATATYPE                  = 111;
    const unsigned short      GYEARMONTH_DATATYPE            = 112;
    const unsigned short      GYEAR_DATATYPE                 = 113;
    const unsigned short      GMONTHDAY_DATATYPE             = 114;
    const unsigned short      GDAY_DATATYPE                  = 115;
    const unsigned short      GMONTH_DATATYPE                = 116;
    const unsigned short      INTEGER                        = 117;
    const unsigned short      NAME_DATATYPE                  = 200;
    const unsigned short      NCNAME_DATATYPE                = 201;
    const unsigned short      NORMALIZEDSTRING_DATATYPE      = 202;
    const unsigned short      TOKEN_DATATYPE                 = 203;
    const unsigned short      LANGUAGE_DATATYPE              = 204;
    const unsigned short      NONPOSITIVEINTEGER_DATATYPE    = 205;
    const unsigned short      NEGATIVEINTEGER_DATATYPE       = 206;
    const unsigned short      LONG_DATATYPE                  = 207;
    const unsigned short      INT_DATATYPE                   = 208;
    const unsigned short      SHORT_DATATYPE                 = 209;
    const unsigned short      BYTE_DATATYPE                  = 210;
    const unsigned short      NONNEGATIVEINTEGER_DATATYPE    = 211;
    const unsigned short      UNSIGNEDLONG_DATATYPE          = 212;
    const unsigned short      UNSIGNEDINT_DATATYPE           = 213;
    const unsigned short      UNSIGNEDSHORT_DATATYPE         = 214;
    const unsigned short      UNSIGNEDBYTE_DATATYPE          = 215;
    const unsigned short      POSITIVEINTEGER_DATATYPE       = 216;
    const unsigned short      OTHER_SIMPLE_DATATYPE          = 1000;
    const unsigned short      COMPLEX_DATATYPE               = 1001;

  interface ASElementDeclaration : ASObject {

    const unsigned short      EMPTY_CONTENTTYPE              = 1;
    const unsigned short      ANY_CONTENTTYPE                = 2;
    const unsigned short      MIXED_CONTENTTYPE              = 3;
    const unsigned short      ELEMENTS_CONTENTTYPE           = 4;

             attribute boolean          strictMixedContent;
             attribute ASDataType       elementType;
             attribute boolean          isPCDataOnly;
             attribute unsigned short   contentType;
             attribute DOMString        systemId;
             attribute ASContentModel   asCM;
             attribute ASNamedObjectMap  ASAttributeDecls;
    void               addASAttributeDecl(in ASAttributeDeclaration attributeDecl);
    ASAttributeDeclaration removeASAttributeDecl(in ASAttributeDeclaration attributeDecl);

  interface ASContentModel : ASObject {
    const unsigned long       AS_UNBOUNDED                   = MAX_VALUE;

    // ASContentModelType
    const unsigned short      AS_SEQUENCE                    = 0;
    const unsigned short      AS_CHOICE                      = 1;
    const unsigned short      AS_ALL                         = 2;
    const unsigned short      AS_NONE                        = 3;

             attribute unsigned short   listOperator;
             attribute unsigned long    minOccurs;
             attribute unsigned long    maxOccurs;
             attribute ASObjectList     subModels;
    void               removesubModel(in ASObject oldNode);
    void               insertsubModel(in ASObject newNode)
    unsigned long      appendsubModel(in ASObject newNode)

  interface ASAttributeDeclaration : ASObject {

    const unsigned short      VALUE_NONE                     = 0;
    const unsigned short      VALUE_DEFAULT                  = 1;
    const unsigned short      VALUE_FIXED                    = 2;

             attribute ASDataType       dataType;
             attribute DOMString        dataValue;
             attribute DOMString        enumAttr;
             attribute ASObjectList     ownerElements;
             attribute unsigned short   defaultType;

  interface ASEntityDeclaration : ASObject {

    // EntityType
    const unsigned short      INTERNAL_ENTITY                = 1;
    const unsigned short      EXTERNAL_ENTITY                = 2;

             attribute unsigned short   entityType;
             attribute DOMString        entityValue;
             attribute DOMString        systemId;
             attribute DOMString        publicId;

  interface ASNotationDeclaration : ASObject {
             attribute DOMString        systemId;
             attribute DOMString        publicId;

  interface DocumentAS {
             attribute ASModel          activeASModel;
             attribute ASObjectList     boundASModels;
    ASModel            getInternalAS();
    void               setInternalAS(in ASModel as);
    void               addAS(in ASModel as);
    void               removeAS(in ASModel as);
    ASElementDeclaration getElementDeclaration()
    void               validate()

  interface DOMImplementationAS {
    ASModel            createAS(in boolean isNamespaceAware);
    DOMASBuilder       createDOMASBuilder();
    DOMASWriter        createDOMASWriter();

  interface NodeEditAS {

    // ASCheckType
    const unsigned short      WF_CHECK                       = 1;
    const unsigned short      NS_WF_CHECK                    = 2;
    const unsigned short      PARTIAL_VALIDITY_CHECK         = 3;
    const unsigned short      STRICT_VALIDITY_CHECK          = 4;

    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            isNodeValid(in boolean deep, 
                                   in unsigned short wFValidityCheckLevel)

  interface ElementEditAS : NodeEditAS {
    readonly attribute NodeList         definedElementTypes;
    unsigned short     contentType();
    boolean            canSetAttribute(in DOMString attrname, 
                                       in DOMString attrval);
    boolean            canSetAttributeNode(in Attr attrNode);
    boolean            canSetAttributeNS(in DOMString name, 
                                         in DOMString attrval, 
                                         in DOMString namespaceURI);
    boolean            canRemoveAttribute(in DOMString attrname);
    boolean            canRemoveAttributeNS(in DOMString attrname, 
                                            in DOMString namespaceURI);
    boolean            canRemoveAttributeNode(in Node attrNode);
    NodeList           getChildElements();
    NodeList           getParentElements();
    NodeList           getAttributeList();
    boolean            isElementDefined(in DOMString elemTypeName);
    boolean            isElementDefinedNS(in DOMString elemTypeName, 
                                          in DOMString namespaceURI, 
                                          in DOMString name);

  interface CharacterDataEditAS : NodeEditAS {
    readonly attribute boolean          isWhitespaceOnly;
    boolean            canSetData(in unsigned long offset, 
                                  in unsigned long count);
    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 unsigned long count);

  interface ASModel : ASObject {
    readonly attribute boolean          isNamespaceAware;
    readonly attribute unsigned short   usageLocation;
             attribute DOMString        asLocation;
             attribute DOMString        asHint;
    readonly attribute ASNamedObjectMap  elementDeclarations;
    readonly attribute ASNamedObjectMap  attributeDeclarations;
    readonly attribute ASNamedObjectMap  notationDeclarations;
    readonly attribute ASNamedObjectMap  entityDeclarations;
    readonly attribute ASNamedObjectMap  contentModelDeclarations;
    void               setASModel(in ASModel abstractSchema);
    ASObjectList       getASModels();
    void               removeAS(in ASModel as);
    boolean            validate();
    ASElementDeclaration createASElementDeclaration(in DOMString namespaceURI, 
                                                    in DOMString name)
    ASAttributeDeclaration createASAttributeDeclaration(in DOMString namespaceURI, 
                                                        in DOMString name)
    ASNotationDeclaration createASNotationDeclaration(in DOMString namespaceURI, 
                                                      in DOMString name, 
                                                      in DOMString systemId, 
                                                      in DOMString publicId)
    ASEntityDeclaration createASEntityDeclaration(in DOMString name)
    ASContentModel     createASContentModel(in unsigned long minOccurs, 
                                            in unsigned long maxOccurs, 
                                            in unsigned short operator)

  interface DocumentEditAS : NodeEditAS {
             attribute boolean          continuousValidityChecking;

  interface DOMASBuilder : ls::DOMBuilder {
             attribute ASModel          abstractSchema;
    ASModel            parseASURI(in DOMString uri)
    ASModel            parseASInputSource(in ls::DOMInputSource is)

  interface DOMASWriter : ls::DOMWriter {
    void               writeASModel(in DOMOutputStream destination, 
                                    in ASModel model)

#endif // _AS_IDL_


// File: ls.idl

#ifndef _LS_IDL_
#define _LS_IDL_

#include "dom.idl"
#include "events.idl"
#include "traversal.idl"

#pragma prefix "dom.w3c.org"
module ls

  typedef dom::DOMErrorHandler DOMErrorHandler;
  typedef dom::DOMString DOMString;
  typedef dom::Node Node;
  typedef dom::Document Document;
  typedef dom::DOMOutputStream DOMOutputStream;
  typedef dom::DOMReader DOMReader;
  typedef dom::DOMError DOMError;

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

  interface DOMImplementationLS {

    // DOMIMplementationLSMode
    const unsigned short      MODE_SYNCHRONOUS               = 1;
    const unsigned short      MODE_ASYNCHRONOUS              = 2;

    DOMBuilder         createDOMBuilder(in unsigned short mode)
    DOMWriter          createDOMWriter();
    DOMInputSource     createDOMInputSource();

  interface DOMBuilder {
             attribute DOMEntityResolver  entityResolver;
             attribute DOMErrorHandler  errorHandler;
             attribute DOMBuilderFilter  filter;
    void               setFeature(in DOMString name, 
                                  in boolean state)
    boolean            canSetFeature(in DOMString name, 
                                     in boolean state);
    boolean            getFeature(in DOMString name)
    Document           parseURI(in DOMString uri)
    Document           parse(in DOMInputSource is)

    const unsigned short      ACTION_REPLACE                 = 1;
    const unsigned short      ACTION_APPEND                  = 2;
    const unsigned short      ACTION_INSERT_AFTER            = 3;
    const unsigned short      ACTION_INSERT_BEFORE           = 4;

    void               parseWithContext(in DOMInputSource is, 
                                        in Node cnode, 
                                        in unsigned short action)

  interface DOMWriter {
    void               setFeature(in DOMString name, 
                                  in boolean state)
    boolean            canSetFeature(in DOMString name, 
                                     in boolean state);
    boolean            getFeature(in DOMString name)
             attribute DOMString        encoding;
    readonly attribute DOMString        lastEncoding;
             attribute DOMString        newLine;
             attribute DOMErrorHandler  errorHandler;
    boolean            writeNode(in DOMOutputStream destination, 
                                 in Node wnode)
    DOMString          writeToString(in Node wnode)

  interface DOMInputSource {
             attribute DOMInputSource   byteStream;
             attribute DOMReader        characterStream;
             attribute DOMString        stringData;
             attribute DOMString        encoding;
             attribute DOMString        publicId;
             attribute DOMString        systemId;
             attribute DOMString        baseURI;

  interface DOMEntityResolver {
    DOMInputSource     resolveEntity(in DOMString publicId, 
                                     in DOMString systemId, 
                                     in DOMString baseURI)

  interface DOMBuilderFilter {
    unsigned long      startNode(in Node snode);
    unsigned long      endNode(in Node enode);
    readonly attribute unsigned long    whatToShow;

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

  interface LSLoadEvent : events::Event {
    readonly attribute Document         newDocument;
    readonly attribute DOMInputSource   inputSource;

  interface LSProgressEvent : events::Event {
    readonly attribute DOMInputSource   inputSource;
    readonly attribute unsigned long    position;
    readonly attribute unsigned long    totalSize;

  interface DOMWriterFilter : traversal::NodeFilter {
    readonly attribute unsigned long    whatToShow;

  interface ParseErrorEvent : events::Event {
    readonly attribute DOMError         error;

#endif // _LS_IDL_