19 June 2003

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/2003/WD-DOM-Level-3-LS-20030619/idl.zip

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   Object DOMInputStream;

  typedef   Object DOMOutputStream;

  typedef   Object DOMReader;

  typedef   Object DOMWriter;

  typedef dom::DOMString DOMString;
  typedef dom::DOMConfiguration DOMConfiguration;
  typedef dom::Node Node;
  typedef dom::Document Document;
  typedef dom::Element Element;

  interface DOMParser;
  interface DOMSerializer;
  interface DOMInput;
  interface DOMParserFilter;
  interface DOMSerializerFilter;
  interface DOMOutput;

  interface DOMImplementationLS {
 // DOMImplementationLSMode
    const unsigned short      MODE_SYNCHRONOUS               = 1;
    const unsigned short      MODE_ASYNCHRONOUS              = 2;
 DOMParser          createDOMParser(in unsigned short mode, 
                          in DOMString schemaType)
                           raises(dom::DOMException);
    DOMSerializer      createDOMSerializer();
    DOMInput           createDOMInput();
  };

  interface DOMParser {
    readonly attribute DOMConfiguration config;
attribute DOMParserFilter filter;
    readonly attribute boolean         async;
    readonly attribute boolean         busy;
    Document           parse(in DOMInput is)
                           raises(dom::DOMException);
    Document           parseURI(in DOMString uri)
                           raises(dom::DOMException);
 // ACTION_TYPES
    const unsigned short      ACTION_APPEND_AS_CHILDREN      = 1;
    const unsigned short      ACTION_REPLACE_CHILDREN        = 2;
    const unsigned short      ACTION_insert_BEFORE           = 3;
    const unsigned short      ACTION_insert_AFTER            = 4;
    const unsigned short      ACTION_REPLACE                 = 5;
 Node               parseWithContext(in DOMInput input, 
                           in Node context, 
                           in unsigned short action)
                           raises(dom::DOMException);
    void               abort();
  };

  interface DOMInput {
    // Depending on the language binding in use,
    // this attribute may not be available.
attribute DOMReader       characterStream;
attribute DOMInputStream  byteStream;
attribute DOMString       stringData;
attribute DOMString       systemId;
attribute DOMString       encoding;
attribute DOMString       publicId;
attribute DOMString       baseURI;
attribute boolean         certified;
  };

  interface DOMResourceResolver {
    DOMInput           resolveResource(in DOMString publicId, 
                          in DOMString systemId, 
                          in DOMString baseURI);
  };

  interface DOMParserFilter {
 // Constants returned by startElement and acceptNode
    const short               FILTER_ACCEPT                  = 1;
    const short               FILTER_REJECT                  = 2;
    const short               FILTER_SKIP                    = 3;
    const short               FILTER_INTERRUPT               = 4;
 unsigned short     startElement(in Element element);
    unsigned short     acceptNode(in Node node);
    readonly attribute unsigned long   whatToShow;
  };

  interface DOMSerializer {
    readonly attribute DOMConfiguration config;
attribute DOMString       newLine;
attribute DOMSerializerFilter filter;
    boolean            write(in Node node, 
                in DOMOutput destination);
    boolean            writeURI(in Node node, 
                   in DOMString URI);
    DOMString          writeToString(in Node node)
                           raises(dom::DOMException);
  };

  interface DOMOutput {
    // Depending on the language binding in use,
    // this attribute may not be available.
attribute DOMWriter       characterStream;
attribute DOMOutputStream byteStream;
attribute DOMString       systemId;
attribute DOMString       encoding;
  };

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

  interface ElementLS {
attribute DOMString       markupContent;
  };

  interface LSProgressEvent : events::Event {
    readonly attribute DOMInput        input;
    readonly attribute unsigned long   position;
    readonly attribute unsigned long   totalSize;
  };

  interface LSLoadEvent : events::Event {
    readonly attribute Document        newDocument;
    readonly attribute DOMInput        input;
  };

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

#endif // _LS_IDL_