09 April 2002

Appendix A: IDL Definitions

This appendix contains the complete OMG IDL [OMG IDL] 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-20020409/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::Element Element;
  typedef dom::Attr Attr;
  typedef dom::Entity Entity;
  typedef dom::Notation Notation;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Node Node;
  typedef dom::NodeList NodeList;
  typedef dom::DOMOutputStream DOMOutputStream;

  interface ASModel;
  interface ASElementDecl;
  interface ASAttributeDecl;
  interface ASEntityDecl;
  interface ASNotationDecl;
  interface ASWElementDecl;
  interface ASWAttributeDecl;
  interface ASWNotationDecl;
  interface ASWEntityDecl;
  interface ASWContentModel;
  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;
  const unsigned short      ACTIVEAS_DELETION_ERR          = 7;


  interface ASConstants {

    // ASObject Types
    const unsigned short      ELEMENT_DECLARATION            = 1;
    const unsigned short      ATTRIBUTE_DECLARATION          = 2;
    const unsigned short      NOTATION_DECLARATION           = 3;
    const unsigned short      ENTITY_DECLARATION             = 4;
    const unsigned short      CONTENT_MODEL                  = 5;
    const unsigned short      SCHEMA_MODEL                   = 6;


    // Schema Model types
    const unsigned short      INTERNAL_SUBSET                = 30;
    const unsigned short      EXTERNAL_SUBSET                = 31;
    const unsigned short      NOT_USED                       = 32;


    // Entity Types
    const unsigned short      INTERNAL_ENTITY                = 33;
    const unsigned short      EXTERNAL_ENTITY                = 34;


    // Content Model Types
    const unsigned short      EMPTY_CONTENTTYPE              = 40;
    const unsigned short      SIMPLE_CONTENTTYPE             = 41;
    const unsigned short      ELEMENT_CONTENTTYPE            = 42;
    const unsigned short      MIXED_CONTENTTYPE              = 43;
    const unsigned short      ANY_CONTENTTYPE                = 44;


    // Content model compositors
    const unsigned short      SEQUENCE_CM                    = 50;
    const unsigned short      CHOICE_CM                      = 51;
    const unsigned short      ALL_CM                         = 52;
    const unsigned short      UNDEFINED_CM                   = 53;
    const unsigned short      ATOMIC_CM                      = 54;


    // Value Constraint
    const unsigned short      NONE_VC                        = 0;
    const unsigned short      DEFAULT_VC                     = 60;
    const unsigned short      FIXED_VC                       = 61;
    const unsigned short      REQUIRED_VC                    = 62;


    // Definition of unbounded
    const unsigned long       UNBOUNDED                      = MAX_VALUE;
  };

  interface ASObject {
    readonly attribute unsigned short  objectType;
    readonly attribute ASModel         ownerModel;
    readonly attribute DOMString       rawname;
    readonly attribute DOMString       name;
    readonly attribute DOMString       namespace;
    ASObject           cloneASObject(in boolean deep)
                                        raises(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      ANYSIMPLETYPE_DATATYPE         = 216;
    const unsigned short      ANYTYPE_DATATYPE               = 216;
  };

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

  interface ASNamedObjectMap {
    readonly attribute unsigned long   length;
    ASObject           item(in unsigned long index);
    ASObject           getNamedItem(in DOMString name);
    ASObject           getNamedItemNS(in DOMString namespaceURI, 
                                      in DOMString localName);
  };

  interface ASModel : ASObject {
    readonly attribute boolean         namespaceAware;
    readonly attribute unsigned short  usage;
    readonly attribute DOMString       location;
    readonly attribute DOMString       hint;
    readonly attribute boolean         container;
    ASNamedObjectMap   getComponents(in unsigned short objectType);

    // Convenience method to retrive named top-level declarations

    ASElementDecl      getElementDecl(in DOMString name, 
                                      in DOMString targetNamespace);
    ASAttributeDecl    getAttributeDecl(in DOMString name, 
                                        in DOMString targetNamespace);
    ASEntityDecl       getEntityDecl(in DOMString name);
    ASNotationDecl     getNotationDecl(in DOMString name, 
                                       in DOMString targetNamespace);
  };

  interface ASContentModel : ASObject {
    readonly attribute unsigned short  contentModelType;
    readonly attribute unsigned long   minOccurs;
    readonly attribute unsigned long   maxOccurs;
    readonly attribute ASObjectList    subModels;
  };

  interface ASElementDecl : ASObject {
    readonly attribute ASDataType      type;
    readonly attribute unsigned short  contentType;
    readonly attribute boolean         strictMixedContent;
    readonly attribute ASContentModel  contentModel;
    readonly attribute boolean         isPCDataOnly;
    readonly attribute ASNamedObjectMap attributeDecls;
    ASAttributeDecl    getAttributeDecl(in DOMString name, 
                                        in DOMString targetNamespace);
  };

  interface ASAttributeDecl : ASObject {
    readonly attribute ASDataType      type;
    readonly attribute DOMString       enumAttr;
    readonly attribute ASObjectList    ownerElementDeclarations;
    readonly attribute unsigned short  defaultType;
    readonly attribute DOMString       value;
  };

  interface ASEntityDecl : ASObject {
    readonly attribute unsigned short  entityType;
    readonly attribute DOMString       entityValue;
    readonly attribute DOMString       systemId;
    readonly attribute DOMString       publicId;
  };

  interface ASNotationDecl : ASObject {
    readonly attribute DOMString       systemId;
    readonly attribute DOMString       publicId;
  };

  interface ASWModel : ASModel {
    void               setLocation(in DOMString location);
    void               setHint(in DOMString hint);
    void               addComponent(in ASObject declaration);
    void               removeComponent(in ASObject declaration);
    void               addASModel(in ASModel declaration);
    void               removeASModel(in ASModel declaration);
    ASObjectList       getASModels();
    ASObject           importASObject(in ASObject asobject);
    void               insertASObject(in ASObject asobject);
    boolean            validate();
    ASWElementDecl     createASWElementDecl(in DOMString namespaceURI, 
                                            in DOMString name)
                                        raises(ASException);
    ASWAttributeDecl   createASWAttributeDecl(in DOMString namespaceURI, 
                                              in DOMString name)
                                        raises(ASException);
    ASWNotationDecl    createASWNotationDecl(in DOMString namespaceURI, 
                                             in DOMString name, 
                                             in DOMString systemId, 
                                             in DOMString publicId)
                                        raises(ASException);
    ASWEntityDecl      createASWEntityDecl(in DOMString name)
                                        raises(ASException);
    ASWContentModel    createASWContentModel(in DOMString name, 
                                             in DOMString namespaceURI, 
                                             in unsigned long minOccurs, 
                                             in unsigned long maxOccurs, 
                                             in unsigned short operator)
                                        raises(ASException);
  };

  interface ASWNamedObjectMap : ASNamedObjectMap {
    ASObject           removeNamedItem(in DOMString name)
                                        raises(ASException);
    ASObject           setNamedItem(in ASObject newASObject)
                                        raises(ASException, 
                                               ASException);
    ASObject           setNamedItemNS(in ASObject arg)
                                        raises(ASException);
    ASObject           removeNamedItemNS(in DOMString namespaceURI, 
                                         in DOMString localName)
                                        raises(dom::DOMException);
  };

  interface ASWElementDecl : ASElementDecl {
    void               setRawname(in DOMString rawname);
    void               setName(in DOMString name);
    void               setNamespace(in DOMString namespaceURI);
    void               setStrictMixedContent(in boolean mixedContent);
    void               setType(in ASDataType type);
    void               setContentType(in unsigned short contentType);
    void               setContentModel(in ASWContentModel contentModel);
    void               addAttributeDecl(in ASWAttributeDecl attributeDecl);
    ASWAttributeDecl   removeAttributeDecl(in ASWAttributeDecl attributeDecl);
  };

  interface ASWContentModel : ASContentModel {
    void               setName(in DOMString name);
    void               setNamespaceURI(in DOMString namespaceURI);
    void               setContentModelType(in unsigned short operator);
    void               setMinOccurs(in unsigned long minOccurs);
    void               setMaxOccurs(in unsigned long maxOccurs);
    void               removeSubModel(in ASObject oldObject);
    ASObject           insertBeforeSubModel(in ASObject newObject, 
                                            in ASObject refObject)
                                        raises(ASException);
    unsigned long      appendSubModel(in ASObject newObject)
                                        raises(ASException);
  };

  interface ASWAttributeDecl : ASAttributeDecl {
    void               setRawname(in DOMString rawname);
    void               setName(in DOMString name);
    void               setNamespaceURI(in DOMString namespaceURI);
    void               setType(in ASDataType type);
    void               setValue(in DOMString value);
    void               setEnumAttr(in DOMString enumeration);
    void               setDefaultType(in unsigned short constraint);
  };

  interface ASWEntityDecl : ASEntityDecl {
    void               setRawname(in DOMString rawname);
    void               setEntityType(in unsigned short type);
    void               setEntityValue(in DOMString value);
    void               setSystemId(in DOMString systemId);
    void               setPublicId(in DOMString publicId);
  };

  interface ASWNotationDecl : ASNotationDecl {
    void               setRawname(in DOMString rawname);
    void               setName(in DOMString name);
    void               setNamespaceURI(in DOMString namespaceURI);
    void               setSystemId(in DOMString systemId);
    void               setPublicId(in DOMString publicId);
  };

  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)
                                        raises(ASException);
    ASElementDecl      getElementDecl(in Element node)
                                        raises(dom::DOMException);
    ASAttributeDecl    getAttributeDecl(in Attr node)
                                        raises(dom::DOMException);
    ASEntityDecl       getEntityDecl(in Entity node)
                                        raises(dom::DOMException);
    ASNotationDecl     getNotationDecl(in Notation node)
                                        raises(dom::DOMException);
    void               validate()
                                        raises(ASException);
  };

  interface DOMImplementationAS : DOMImplementation {
    ASWModel           createASWModel(in boolean isNamespaceAware, 
                                      in boolean container, 
                                      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 ASWModel        abstractSchema;
    ASWModel           parseASURI(in DOMString uri, 
                                  in DOMString schemaType)
                                        raises(ASException, 
                                               dom::DOMSystemException);
    ASWModel           parseASInputSource(in ls::DOMInputSource is, 
                                          in DOMString schemaType)
                                        raises(ASException, 
                                               dom::DOMSystemException);
  };

  interface ASDOMWriter : 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::DOMString DOMString;
  typedef dom::Node Node;
  typedef dom::DOMInputStream DOMInputStream;
  typedef dom::DOMReader DOMReader;
  typedef dom::DOMErrorHandler DOMErrorHandler;
  typedef dom::Document Document;
  typedef dom::DOMOutputStream DOMOutputStream;
  typedef dom::DOMError DOMError;

  interface DOMBuilder;
  interface DOMWriter;
  interface DOMInputSource;
  interface DOMWriterFilter;

  interface DOMImplementationLS {

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

    DOMBuilder         createDOMBuilder(in unsigned short mode, 
                                        in DOMString schemaType)
                                        raises(dom::DOMException);
    DOMWriter          createDOMWriter();
    DOMInputSource     createDOMInputSource();
  };

  interface DocumentLS {
             attribute boolean         async;
                                        // raises(dom::DOMException) on setting

    void               abort();
    boolean            load(in DOMString uri);
    boolean            loadXML(in DOMString source);
    DOMString          saveXML(in Node snode)
                                        raises(dom::DOMException);
  };

  interface DOMInputSource {
             attribute DOMInputStream  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 {
    const unsigned short      FILTER_INTERRUPT               = 4;
    unsigned short     startContainer(in Node snode);
    unsigned short     acceptNode(in Node enode);
    readonly attribute unsigned long   whatToShow;
  };

  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);
    Document           parse(in DOMInputSource is)
                                        raises(dom::DOMSystemException);

    // ACTION_TYPES
    const unsigned short      ACTION_REPLACE                 = 1;
    const unsigned short      ACTION_APPEND_AS_CHILDREN      = 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;
             attribute DOMString       newLine;
             attribute DOMWriterFilter filter;
             attribute DOMErrorHandler errorHandler;
    boolean            writeNode(in DOMOutputStream destination, 
                                 in Node wnode)
                                        raises(dom::DOMSystemException);
    DOMString          writeToString(in Node wnode)
                                        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 ParseErrorEvent : events::Event {
    readonly attribute DOMError        error;
  };

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

#endif // _LS_IDL_