#include "nsISupports.idl"

#pragma prefix org.mozilla.dom


typedef wstring DOMString;

interface DocumentType;
interface Document;
interface NodeList;
interface NamedNodeMap;
interface Element;

exception DOMException {
  unsigned short   code;
};

// ExceptionCode
const unsigned short      INDEX_SIZE_ERR                 = 1;
const unsigned short      DOMSTRING_SIZE_ERR             = 2;
const unsigned short      HIERARCHY_REQUEST_ERR          = 3;
const unsigned short      WRONG_DOCUMENT_ERR             = 4;
const unsigned short      INVALID_CHARACTER_ERR          = 5;
const unsigned short      NO_DATA_ALLOWED_ERR            = 6;
const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;
const unsigned short      NOT_FOUND_ERR                  = 8;
const unsigned short      NOT_SUPPORTED_ERR              = 9;
const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;
// Introduced in DOM Level 2:
const unsigned short      INVALID_STATE_ERR              = 11;
// Introduced in DOM Level 2:
const unsigned short      SYNTAX_ERR                     = 12;
// Introduced in DOM Level 2:
const unsigned short      INVALID_MODIFICATION_ERR       = 13;
// Introduced in DOM Level 2:
const unsigned short      NAMESPACE_ERR                  = 14;
// Introduced in DOM Level 2:
const unsigned short      INVALID_ACCESS_ERR             = 15;


[scriptable, uuid(0776b330-9ad5-11d4-a983-00105ae3801e)]
interface DOMImplementation : nsISupports {
  boolean            hasFeature(in DOMString feature, 
                                in DOMString version);
  // Introduced in DOM Level 2:
  DocumentType       createDocumentType(in DOMString qualifiedName, 
                                        in DOMString publicId, 
                                        in DOMString systemId)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  Document           createDocument(in DOMString namespaceURI, 
                                    in DOMString qualifiedName, 
                                    in DocumentType doctype)
                                      raises(DOMException);
};

[scriptable, uuid(082f98e0-9ad5-11d4-a983-00105ae3801e)]
interface Node : nsISupports {
  // NodeType
  const unsigned short      ELEMENT_NODE                   = 1;
  const unsigned short      ATTRIBUTE_NODE                 = 2;
  const unsigned short      TEXT_NODE                      = 3;
  const unsigned short      CDATA_SECTION_NODE             = 4;
  const unsigned short      ENTITY_REFERENCE_NODE          = 5;
  const unsigned short      ENTITY_NODE                    = 6;
  const unsigned short      PROCESSING_INSTRUCTION_NODE    = 7;
  const unsigned short      COMMENT_NODE                   = 8;
  const unsigned short      DOCUMENT_NODE                  = 9;
  const unsigned short      DOCUMENT_TYPE_NODE             = 10;
  const unsigned short      DOCUMENT_FRAGMENT_NODE         = 11;
  const unsigned short      NOTATION_NODE                  = 12;

  readonly attribute DOMString        nodeName;
           attribute DOMString        nodeValue;
                                      // raises(DOMException) on setting
                                      // raises(DOMException) on retrieval

  readonly attribute unsigned short   nodeType;
  readonly attribute Node             parentNode;
  readonly attribute NodeList         childNodes;
  readonly attribute Node             firstChild;
  readonly attribute Node             lastChild;
  readonly attribute Node             previousSibling;
  readonly attribute Node             nextSibling;
  readonly attribute NamedNodeMap     attributes;
  // Modified in DOM Level 2:
  readonly attribute Document         ownerDocument;
  Node               insertBefore(in Node newChild, 
                                  in Node refChild)
                                      raises(DOMException);
  Node               replaceChild(in Node newChild, 
                                  in Node oldChild)
                                      raises(DOMException);
  Node               removeChild(in Node oldChild)
                                      raises(DOMException);
  Node               appendChild(in Node newChild)
                                      raises(DOMException);
  boolean            hasChildNodes();
  Node               cloneNode(in boolean deep);
  // Introduced in DOM Level 2:
  void               normalize();
  // Introduced in DOM Level 2:
  boolean            supports(in DOMString feature, 
                              in DOMString version);
  // Introduced in DOM Level 2:
  readonly attribute DOMString        namespaceURI;
  // Introduced in DOM Level 2:
           attribute DOMString        prefix;
                                      // raises(DOMException) on setting

  // Introduced in DOM Level 2:
  readonly attribute DOMString        localName;
};

[scriptable, uuid(0895fa70-9ad5-11d4-a983-00105ae3801e)]
interface NodeList : nsISupports {
  Node               item(in unsigned long index);
  readonly attribute unsigned long    length;
};

[scriptable, uuid(08f4b810-9ad5-11d4-a983-00105ae3801e)]
interface NamedNodeMap : nsISupports {
  Node               getNamedItem(in DOMString name);
  Node               setNamedItem(in Node arg)
                                      raises(DOMException);
  Node               removeNamedItem(in DOMString name)
                                      raises(DOMException);
  Node               item(in unsigned long index);
  readonly attribute unsigned long    length;
  // Introduced in DOM Level 2:
  Node               getNamedItemNS(in DOMString namespaceURI, 
                                    in DOMString localName);
  // Introduced in DOM Level 2:
  Node               setNamedItemNS(in Node arg)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  Node               removeNamedItemNS(in DOMString namespaceURI, 
                                       in DOMString localName)
                                      raises(DOMException);
};

[scriptable, uuid(0965cbf0-9ad5-11d4-a983-00105ae3801e)]
interface CharacterData : Node {
           attribute DOMString        data;
                                      // raises(DOMException) on setting
                                      // raises(DOMException) on retrieval

  readonly attribute unsigned long    length;
  DOMString          substringData(in unsigned long offset, 
                                   in unsigned long count)
                                      raises(DOMException);
  void               appendData(in DOMString arg)
                                      raises(DOMException);
  void               insertData(in unsigned long offset, 
                                in DOMString arg)
                                      raises(DOMException);
  void               deleteData(in unsigned long offset, 
                                in unsigned long count)
                                      raises(DOMException);
  void               replaceData(in unsigned long offset, 
                                 in unsigned long count, 
                                 in DOMString arg)
                                      raises(DOMException);
};

[scriptable, uuid(09e31950-9ad5-11d4-a983-00105ae3801e)]
interface Attr : Node {
  readonly attribute DOMString        name;
  readonly attribute boolean          specified;
           attribute DOMString        value;
                                      // raises(DOMException) on setting

  // Introduced in DOM Level 2:
  readonly attribute Element          ownerElement;
};

[scriptable, uuid(0a7d6f40-9ad5-11d4-a983-00105ae3801e)]
interface Element : Node {
  readonly attribute DOMString        tagName;
  DOMString          getAttribute(in DOMString name);
  void               setAttribute(in DOMString name, 
                                  in DOMString value)
                                      raises(DOMException);
  void               removeAttribute(in DOMString name)
                                      raises(DOMException);
  Attr               getAttributeNode(in DOMString name);
  Attr               setAttributeNode(in Attr newAttr)
                                      raises(DOMException);
  Attr               removeAttributeNode(in Attr oldAttr)
                                      raises(DOMException);
  NodeList           getElementsByTagName(in DOMString name);
  // Introduced in DOM Level 2:
  DOMString          getAttributeNS(in DOMString namespaceURI, 
                                    in DOMString localName);
  // Introduced in DOM Level 2:
  void               setAttributeNS(in DOMString namespaceURI, 
                                    in DOMString qualifiedName, 
                                    in DOMString value)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  void               removeAttributeNS(in DOMString namespaceURI, 
                                       in DOMString localName)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  Attr               getAttributeNodeNS(in DOMString namespaceURI, 
                                        in DOMString localName);
  // Introduced in DOM Level 2:
  Attr               setAttributeNodeNS(in Attr newAttr)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  NodeList           getElementsByTagNameNS(in DOMString namespaceURI, 
                                            in DOMString localName);
  // Introduced in DOM Level 2:
  boolean            hasAttribute(in DOMString name);
  // Introduced in DOM Level 2:
  boolean            hasAttributeNS(in DOMString namespaceURI, 
                                    in DOMString localName);
};

[scriptable, uuid(0eefd9f0-9ad5-11d4-a983-00105ae3801e)]
interface Text : CharacterData {
  Text               splitText(in unsigned long offset)
                                      raises(DOMException);
};

[scriptable, uuid(0ae9ed90-9ad5-11d4-a983-00105ae3801e)]
interface Comment : CharacterData {
};

[scriptable, uuid(0b813520-9ad5-11d4-a983-00105ae3801e)]
interface CDATASection : Text {
};

[scriptable, uuid(0c07ada0-9ad5-11d4-a983-00105ae3801e)]
interface DocumentType : Node {
  readonly attribute DOMString        name;
  readonly attribute NamedNodeMap     entities;
  readonly attribute NamedNodeMap     notations;
  // Introduced in DOM Level 2:
  readonly attribute DOMString        publicId;
  // Introduced in DOM Level 2:
  readonly attribute DOMString        systemId;
  // Introduced in DOM Level 2:
  readonly attribute DOMString        internalSubset;
};

[scriptable, uuid(0c7a48b0-9ad5-11d4-a983-00105ae3801e)]
interface Notation : Node {
  readonly attribute DOMString        publicId;
  readonly attribute DOMString        systemId;
};

[scriptable, uuid(0cf30080-9ad5-11d4-a983-00105ae3801e)]
interface Entity : Node {
  readonly attribute DOMString        publicId;
  readonly attribute DOMString        systemId;
  readonly attribute DOMString        notationName;
};

[scriptable, uuid(0d4eafc0-9ad5-11d4-a983-00105ae3801e)]
interface EntityReference : Node {
};

[scriptable, uuid(0db69880-9ad5-11d4-a983-00105ae3801e)]
interface ProcessingInstruction : Node {
  readonly attribute DOMString        target;
           attribute DOMString        data;
                                      // raises(DOMException) on setting

};

[scriptable, uuid(0e249e00-9ad5-11d4-a983-00105ae3801e)]
interface DocumentFragment : Node {
};

[scriptable, uuid(0e81d470-9ad5-11d4-a983-00105ae3801e)]
interface Document : Node {
  readonly attribute DocumentType     doctype;
  readonly attribute DOMImplementation  implementation;
  readonly attribute Element          documentElement;
  Element            createElement(in DOMString tagName)
                                      raises(DOMException);
  DocumentFragment   createDocumentFragment();
  Text               createTextNode(in DOMString data);
  Comment            createComment(in DOMString data);
  CDATASection       createCDATASection(in DOMString data)
                                      raises(DOMException);
  ProcessingInstruction createProcessingInstruction(in DOMString target, 
                                                    in DOMString data)
                                      raises(DOMException);
  Attr               createAttribute(in DOMString name)
                                      raises(DOMException);
  EntityReference    createEntityReference(in DOMString name)
                                      raises(DOMException);
  NodeList           getElementsByTagName(in DOMString tagname);
  // Introduced in DOM Level 2:
  Node               importNode(in Node importedNode, 
                                in boolean deep)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  Element            createElementNS(in DOMString namespaceURI, 
                                     in DOMString qualifiedName)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  Attr               createAttributeNS(in DOMString namespaceURI, 
                                       in DOMString qualifiedName)
                                      raises(DOMException);
  // Introduced in DOM Level 2:
  NodeList           getElementsByTagNameNS(in DOMString namespaceURI, 
                                            in DOMString localName);
  // Introduced in DOM Level 2:
  Element            getElementById(in DOMString elementId);
};

