25 July 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-LS-20020725/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 dom::DOMString DOMString;
  typedef dom::Node Node;
  typedef dom::Element Element;
  typedef dom::DOMErrorHandler DOMErrorHandler;
  typedef dom::Document Document;

  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);
  };

  interface DOMBuilderFilter {

    // 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 elt);
    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);

    // 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);
    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 DOMWriterFilter : traversal::NodeFilter {
    readonly attribute unsigned long   whatToShow;
  };
};

#endif // _LS_IDL_