/*
 * Copyright (c) 2001 World Wide Web Consortium,
 * (Massachusetts Institute of Technology, Institut National de
 * Recherche en Informatique et en Automatique, Keio University). All
 * Rights Reserved. This program is distributed under the W3C's Software
 * Intellectual Property License. This program is distributed in the
 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.
 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
 */

// File: http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20010607/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)
                                        raises(dom::DOMException);
    boolean            supportsFeature(in DOMString name);
    boolean            canSetFeature(in DOMString name, 
                                     in boolean state);
    boolean            getFeature(in DOMString name)
                                        raises(dom::DOMException);
    Document           parseURI(in DOMString uri)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
    Document           parseDOMInputSource(in DOMInputSource is)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
  };

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

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

  interface DOMCMWriter : DOMWriter {
    void               writeCMModel(in DOMOutputStream destination, 
                                    in CMModel model)
                                        raises(dom::DOMSystemException);
  };

  interface DocumentLS {
             attribute boolean          async;
    void               abort();
    boolean            load(in DOMString url);
    boolean            loadXML(in DOMString source);
    DOMString          saveXML(in Node node)
                                        raises(dom::DOMException);
  };

  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)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
    CMModel            parseCMInputSource(in DOMInputSource is)
                                        raises(dom::DOMException, 
                                               dom::DOMSystemException);
  };
};

#endif // _LOAD-SAVE_IDL_

