File:  [Public] / DOM / dom-core.idl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed Jun 10 21:14:39 1998 UTC (25 years, 11 months ago) by daniel
Branches: W3C_DOM, MAIN
CVS tags: START, HEAD
Document Object Model code

//
// Document Object Model (Core) Level 1 ISL
// As of Tue Jun  9 16:52:45 EDT 1998
//

//
// Modifs:
//    replaced interface by raise for exceptions;
//    "interface NotMyChildException {}" => "raises NotMyChildException".
//
//    replaced "wstring" (Unicode) for simple "string".
//
//    replaced "int" by "long".
//
//    Reordered interface list and added forward references.
//
//    Added a definition for NotMyChildException, NoSuchNodeException,
//           NoSuchAttributeException.
//
//    Renamed Node:PI to Node:PIS due to clash with PI interface.
//

interface Document;
interface Node;
interface NodeIterator;
interface Element;
interface Text;
interface Comment;
interface PI;
interface Attribute;
interface AttributeList;
interface TreeIterator;

interface DOM {
    Document            createDocument(in string type); // wstring
    boolean             hasFeature(in string feature); // wstring
};

interface DocumentContext {
    attribute Document       document;
};

exception NotMyChildException {
};
exception NoSuchNodeException {
};
exception NoSuchAttributeException {
};

interface Node {
    // NodeType
    const long            DOCUMENT             = 1;
    const long            ELEMENT              = 2;
    const long            ATTRIBUTE            = 3;
    const long            PIS                  = 4;
    const long            COMMENT              = 5;
    const long            TEXT                 = 6;

    long                 getNodeType();
    Node                getParentNode();
    NodeIterator        getChildNodes();
    boolean             hasChildNodes();
    Node                getFirstChild();
    Node                getPreviousSibling();
    Node                getNextSibling();
    Node                insertBefore(in Node newChild, in Node refChild)
			   raises (NotMyChildException);
    Node                replaceChild(in Node newChild, in Node oldChild) 
			   raises (NotMyChildException);
    Node                removeChild(in Node oldChild)
			   raises (NotMyChildException);
};

interface DocumentFragment : Node {
    attribute Document       masterDoc;
};

interface Document : DocumentFragment {
    attribute Node           documentType;
    attribute Element        documentElement;
    attribute DocumentContext contextInfo;
    DocumentContext     createDocumentContext();
    Element             createElement(in string tagName, // wstring
				      in AttributeList attributes);
    Text                createTextNode(in string data); // wstring
    Comment             createComment(in string data); // wstring
    PI                  createPI(in string name,  // wstring
				 in string data); // wstring
    Attribute           createAttribute(in string name,  // wstring
					in Node value);
    AttributeList       createAttributeList();
    TreeIterator        createTreeIterator(in Node node);
    NodeIterator        getElementsByTagName(in string tagname); // wstring
};

interface NodeIterator {
    unsigned long       getLength();
    unsigned long       getCurrentPos();
    boolean             atFirst();
    boolean             atLast();
    Node                toNextNode();
    Node                toPrevNode();
    Node                toFirstNode();
    Node                toLastNode();
    Node                moveTo(in long n);
};


interface TreeIterator : NodeIterator {
    unsigned long       numChildren();
    unsigned long       numPreviousSiblings();
    unsigned long       numNextSiblings();
    Node                toParent();
    Node                toPreviousSibling();
    Node                toNextSibling();
    Node                toFirstChild();
    Node                toLastChild();
    Node                toNthChild(in long n) raises (NoSuchNodeException);
};

interface Attribute {
    string              getName(); // wstring
    string              getValue(); // wstring
    attribute boolean   specified;
    string              toString(); // wstring
};

interface AttributeList {
    Attribute           getAttribute(in string attrName); // wstring
    Attribute           setAttribute(in Attribute attr);
    Attribute           remove(in string attrName) // wstring
                            raises (NoSuchAttributeException);
    Attribute           item(in unsigned long index)
                            raises (NoSuchAttributeException);
    unsigned long       getLength();
};

interface Element : Node {
    string              getTagName(); // wstring
    NodeIterator        getAttributes();
    string              getAttribute(in string name); // wstring
    void                setAttribute(in string name, // wstring
				     in string value);// wstring
    void                removeAttribute(in string name); // wstring
    Attribute           getAttributeNode(in string name);
    void                setAttributeNode(in Attribute newAttr);
    void                removeAttributeNode(in Attribute oldAttr);
    void                getElementsByTagName(in string tagname); // wstring
    void                normalize();
};

interface Text : Node {
    attribute string        data; // wstring
    void                append(in string data); // wstring
    void                insert(in long offset, 
			       in string data); // wstring
    void                delete(in long offset, 
			       in long count);
    void                replace(in long offset, 
				in long count, 
				in string data); // wstring
    void                splice(in Element element, 
			       in long offset, 
			       in long count);
};

interface Comment : Node {
    attribute string        data; // wstring
};

interface PI : Node {
    attribute string        name; // wstring
    attribute string        data; // wstring
};


Webmaster