07 June 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-20010607/idl.zip


// File: abstract-schemas.idl


#include "dom.idl"

#pragma prefix "dom.w3c.org"
module abstract-schemas

  typedef dom::DOMString DOMString;
  typedef dom::int int;
  typedef dom::decimal decimal;
  typedef dom::Node Node;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Element Element;
  typedef dom::CharacterData CharacterData;
  typedef dom::DocumentType DocumentType;
  typedef dom::Attr Attr;

  interface ASModel;
  interface ASChildren;
  interface ASAttributeDeclaration;
  interface DOMErrorHandler;
  interface DOMLocator;

  interface ASNode {
    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_CHILDREN                    = 5;
    const unsigned short      AS_MODEL                       = 6;
    const unsigned short      AS_EXTERNALMODEL               = 7;
    readonly attribute unsigned short   cmNodeType;
             attribute ASModel          ownerASModel;
             attribute DOMString        nodeName;
             attribute DOMString        prefix;
             attribute DOMString        localName;
             attribute DOMString        namespaceURI;
    ASNode             cloneASNode();

  interface ASNodeList {
    readonly attribute int              length;
    ASNode             item(in int index);

  interface ASDOMStringList {
    readonly attribute int              length;
    DOMString          item(in int index);

  interface ASNamedNodeMap {
    readonly attribute int              length;
    ASNode             getNamedItem(inout DOMString name);
    ASNode             getNamedItemNS(in DOMString namespaceURI, 
                                      inout DOMString localName);
    ASNode             item(in int index);
    ASNode             removeNamedItem(in DOMString name);
    ASNode             removeNamedItemNS(in DOMString namespaceURI, 
                                         in DOMString localName);
    ASNode             setNamedItem(inout ASNode newASNode)
    ASNode             setNamedItemNS(inout ASNode newASNode)

  interface ASDataType {
    const short               STRING_DATATYPE                = 1;
    short              getASPrimitiveType();

  interface ASPrimitiveType : ASDataType {
    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 ASElementDeclaration : ASNode {
    const short               EMPTY_CONTENTTYPE              = 1;
    const short               ANY_CONTENTTYPE                = 2;
    const short               MIXED_CONTENTTYPE              = 3;
    const short               ELEMENTS_CONTENTTYPE           = 4;
             attribute boolean          strictMixedContent;
             attribute ASDataType       elementType;
             attribute boolean          isPCDataOnly;
             attribute short            contentType;
             attribute DOMString        tagName;
    ASChildren         getASChildren();
    void               setASChildren(inout ASChildren elementContent)
    ASNamedNodeMap     getASAttributeDecls();
    void               setASAttributeDecls(inout ASNamedNodeMap attributes);
    void               addASAttributeDecl(in ASAttributeDeclaration attributeDecl);
    ASAttributeDeclaration removeASAttributeDecl(in ASAttributeDeclaration attributeDecl);

  interface ASChildren : ASNode {
    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 ASNodeList       subModels;
    ASNode             removeASNode(in unsigned long nodeIndex);
    int                insertASNode(in unsigned long nodeIndex, 
                                    in ASNode newNode);
    int                appendASNode(in ASNode newNode);

  interface ASAttributeDeclaration : ASNode {
    const short               NO_VALUE_CONSTRAINT            = 0;
    const short               DEFAULT_VALUE_CONSTRAINT       = 1;
    const short               FIXED_VALUE_CONSTRAINT         = 2;
             attribute DOMString        attrName;
             attribute ASDataType       attrType;
             attribute DOMString        attributeValue;
             attribute DOMString        enumAttr;
             attribute ASNodeList       ownerElement;
             attribute short            constraintType;

  interface ASEntityDeclaration : ASNode {
    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 ASNotationDeclaration : ASNode {
             attribute DOMString        notationName;
             attribute DOMString        systemId;
             attribute DOMString        publicId;

  interface Document {
    void               setErrorHandler(in DOMErrorHandler handler);

  interface DocumentAS : Document {
             attribute boolean          continuousValidityChecking;
    int                numASs();
    ASModel            getInternalAS();
    ASNodeList         getASs();
    ASModel            getActiveAS();
    void               addAS(in ASModel cm);
    void               removeAS(in ASModel cm);
    boolean            activateAS(in ASModel 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 ASModel : ASNode {
    readonly attribute boolean          isNamespaceAware;
             attribute ASElementDeclaration  rootElementDecl;
             attribute DOMString        systemId;
             attribute DOMString        publicId;
    ASNodeList         getASNodes();
    boolean            removeNode(in ASNode node);
    boolean            insertBefore(in ASNode newNode, 
                                    in ASNode refNode);
    boolean            validate();
    ASElementDeclaration createASElementDeclaration(inout DOMString namespaceURI, 
                                                    in DOMString qualifiedElementName)
    ASAttributeDeclaration createASAttributeDeclaration(inout DOMString namespaceURI, 
                                                        in DOMString qualifiedName)
    ASNotationDeclaration createASNotationDeclaration(inout DOMString namespaceURI, 
                                                      in DOMString qualifiedElementName, 
                                                      in DOMString systemIdentifier, 
                                                      inout DOMString publicIdentifier)
    ASEntityDeclaration createASEntityDeclaration(in DOMString name)
    ASChildren         createASChildren(in unsigned long minOccurs, 
                                        in unsigned long maxOccurs, 
                                        inout unsigned short operator)

  interface ASExternalModel : ASModel {

  interface DOMImplementationAS : DOMImplementation {
    ASModel            createAS();
    ASExternalModel    createExternalAS();

  interface NodeAS : Node {
    const short               WF_CHECK                       = 1;
    const short               NS_WF_CHECK                    = 2;
    const short               PARTIAL_VALIDITY_CHECK         = 3;
    const short               STRICT_VALIDITY_CHECK          = 4;
             attribute short            wfValidityCheckLevel;
    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(in boolean deep)

  interface ElementAS : Element {
    short              contentType();
    ASElementDeclaration 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);
    ASDOMStringList    getChildElements();
    ASDOMStringList    getParentElements();
    ASDOMStringList    getAttributeList();

  interface CharacterDataAS : CharacterData {
    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 DocumentTypeAS : DocumentType {
    readonly attribute ASDOMStringList  definedElementTypes;
    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 AttributeAS : Attr {
    ASAttributeDeclaration getAttributeDeclaration();
    ASNotationDeclaration 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;
  typedef dom::CMModel CMModel;

  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;
             attribute boolean          mimeTypeCheck;
    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 DOMCMWriter : DOMWriter {
    void               writeCMModel(in DOMOutputStream destination, 
                                    in CMModel model)

  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;

  interface DOMCMBuilder : DOMBuilder {
    CMModel            parseCMURI(in DOMString uri)
    CMModel            parseCMInputSource(in DOMInputSource is)

#endif // _LOAD-SAVE_IDL_