14 January 2002

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/2002/WD-DOM-Level-3-ASLS-20020114/idl.zip

as.idl:

// 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::Document Document;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Node Node;
  typedef dom::NodeList NodeList;
  typedef dom::Attr Attr;
  typedef dom::DOMOutputStream DOMOutputStream;

  interface ASModel;
  interface ASContentModel;
  interface ASAttributeDecl;
  interface NodeEditAS;

  exception ASException {
    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;
  const unsigned short      INVALID_CHARACTER_ERR          = 5;
  const unsigned short      VALIDATION_ERR                 = 6;


  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  ASObjectType;
    readonly attribute ASModel         ownerASModel;
             attribute DOMString       objectName;
             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           item(in unsigned long index);
    ASObject           removeNamedItem(in DOMString name)
                                        raises(dom::DOMException);
    ASObject           setNamedItem(in ASObject newASObject)
                                        raises(dom::DOMException, 
                                               ASException);
  };

  interface ASDataType {
    readonly attribute unsigned short  dataType;

    // DATA_TYPES
    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 ASElementDecl : ASObject {

    // CONTENT_MODEL_TYPES
    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 ASContentModel  ASContentModel;
             attribute ASNamedObjectMap ASAttributeDecls;
    void               addASAttributeDecl(in ASAttributeDecl attributeDecl);
    ASAttributeDecl    removeASAttributeDecl(in ASAttributeDecl 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;
    const unsigned short      AS_UNDEFINED                   = 4;

             attribute unsigned short  listOperator;
             attribute unsigned long   minOccurs;
             attribute unsigned long   maxOccurs;
             attribute ASObjectList    subModels;
    void               removesubModel(in ASObject oldObject);
    ASObject           insertBeforeSubModel(in ASObject newObject, 
                                            in ASObject refObject)
                                        raises(ASException);
    unsigned long      appendsubModel(in ASObject newObject)
                                        raises(ASException);
  };

  interface ASAttributeDecl : ASObject {

    // VALUE_TYPES
    const unsigned short      NONE                           = 0;
    const unsigned short      DEFAULT                        = 1;
    const unsigned short      FIXED                          = 2;
    const unsigned short      REQUIRED                       = 3;

             attribute ASDataType      DataType;
             attribute DOMString       DataValue;
             attribute DOMString       enumAttr;
             attribute ASObjectList    ownerElements;
             attribute unsigned short  defaultType;
  };

  interface ASEntityDecl : 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 ASNotationDecl : ASObject {
             attribute DOMString       systemId;
             attribute DOMString       publicId;
  };

  interface ASModel : ASObject {

    // ASMODEL_TYPES
    const unsigned short      INTERNAL_SUBSET                = 1;
    const unsigned short      EXTERNAL_SUBSET                = 2;
    const unsigned short      NOT_USED                       = 3;

    readonly attribute boolean         NamespaceAware;
    readonly attribute unsigned short  usage;
             attribute DOMString       location;
             attribute DOMString       hint;
    readonly attribute boolean         container;
    readonly attribute ASNamedObjectMap elementDecls;
    readonly attribute ASNamedObjectMap attributeDecls;
    readonly attribute ASNamedObjectMap notationDecls;
    readonly attribute ASNamedObjectMap entityDecls;
    readonly attribute ASNamedObjectMap contentModelDecls;
    void               addASModel(in ASModel abstractSchema);
    ASObjectList       getASModels();
    void               removeAS(in ASModel as);
    boolean            validate();
    void               importASObject(in ASObject asobject);
    void               insertASObject(in ASObject asobject);
    ASElementDecl      createASElementDecl(in DOMString namespaceURI, 
                                           in DOMString name)
                                        raises(ASException);
    ASAttributeDecl    createASAttributeDecl(in DOMString namespaceURI, 
                                             in DOMString name)
                                        raises(ASException);
    ASNotationDecl     createASNotationDecl(in DOMString namespaceURI, 
                                            in DOMString name, 
                                            in DOMString systemId, 
                                            in DOMString publicId)
                                        raises(ASException);
    ASEntityDecl       createASEntityDecl(in DOMString name)
                                        raises(ASException);
    ASContentModel     createASContentModel(in DOMString name, 
                                            in DOMString namespaceURI, 
                                            in unsigned long minOccurs, 
                                            in unsigned long maxOccurs, 
                                            in unsigned short operator)
                                        raises(ASException);
  };

  interface DocumentAS : Document {
             attribute ASModel         activeASModel;
             attribute ASObjectList    boundASModels;
    ASModel            getInternalAS();
    void               setInternalAS(in ASModel as)
                                        raises(dom::DOMException);
    void               addAS(in ASModel as);
    void               removeAS(in ASModel as);
    ASElementDecl      getElementDecl()
                                        raises(dom::DOMException);
    void               validate()
                                        raises(ASException);
  };

  interface DOMImplementationAS : DOMImplementation {
    readonly attribute boolean         container;
             attribute DOMString       schemaType;
    ASModel            createAS(in boolean NamespaceAware, 
                                in DOMString schemaType);
  };

  interface DocumentEditAS : NodeEditAS {
             attribute boolean         continuousValidityChecking;
  };

  interface NodeEditAS : Node {

    // 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)
                                        raises(ASException);
  };

  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 ASDOMBuilder : ls::DOMBuilder {
             attribute ASModel         abstractSchema;
    ASModel            parseASURI(in DOMString uri, 
                                  in DOMString schemaType)
                                        raises(ASException, 
                                               dom::DOMSystemException);
    ASModel            parseASInputSource(in ls::DOMInputSource is)
                                        raises(ASException, 
                                               dom::DOMSystemException);
  };

  interface DOMASWriter : ls::DOMWriter {
    void               writeASModel(in DOMOutputStream destination, 
                                    in ASModel model)
                                        raises(dom::DOMSystemException);
  };
};

#endif // _AS_IDL_

ls.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)
                                        raises(dom::DOMException);
    DOMWriter          createDOMWriter();
    DOMInputSource     createDOMInputSource();
  };

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

    // ACTION_TYPES
    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)
                                        raises(dom::DOMException);
  };

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

  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)
                                        raises(dom::DOMSystemException);
  };

  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)
                                        raises(dom::DOMException);
  };

  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_