Code

Split out domptr stuff into its own .h file, so that it can be used by other things...
[inkscape.git] / src / dom / dom.h
1 #ifndef __DOM_H__
2 #define __DOM_H__
3 /**
4  * Phoebe DOM Implementation.
5  *
6  * This is a C++ approximation of the W3C DOM model, which follows
7  * fairly closely the specifications in the various .idl files, copies of
8  * which are provided for reference.  Most important is this one:
9  *
10  * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
11  * 
12  * More thorough explanations of the various classes and their algorithms
13  * can be found there.
14  *     
15  *
16  * Authors:
17  *   Bob Jamison
18  *
19  * Copyright (C) 2006-2008 Bob Jamison
20  *
21  *  This library is free software; you can redistribute it and/or
22  *  modify it under the terms of the GNU Lesser General Public
23  *  License as published by the Free Software Foundation; either
24  *  version 2.1 of the License, or (at your option) any later version.
25  *
26  *  This library is distributed in the hope that it will be useful,
27  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
28  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29  *  Lesser General Public License for more details.
30  *
31  *  You should have received a copy of the GNU Lesser General Public
32  *  License along with this library; if not, write to the Free Software
33  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
34  *  
35  * =======================================================================
36  *  NOTES:
37  * 
38  *  Notice that many of the classes defined here are pure virtual.  In other
39  *  words, they are purely unimplemented interfaces.  For the implementations
40  *  of them, look in domimpl.h and domimpl.cpp.
41  *  
42  *  Also, note that there is a domptr.cpp file that has a couple of necessary
43  *  functions which cannot be in a .h file
44  *             
45  */
47 #include <vector>
49 #include "domptr.h"
52 /**
53  * What type of string do we want?  Pick one of the following
54  * Then below, select one of the corresponding typedefs.
55  */ 
57 #include <glibmm.h>
58 //#include <string>
60 //# Unfortunate hack for a name collision
61 #ifdef SEVERITY_ERROR
62 #undef SEVERITY_ERROR
63 #endif
65 #define XMLNSNAME "http://www.w3.org/2000/xmlns/"
67 namespace org
68 {
69 namespace w3c
70 {
71 namespace dom
72 {
75 /**
76  * This is the org::w3c::dom::DOMString definition.
77  * Which type do we want?
78  */  
79 typedef Glib::ustring DOMString;
80 typedef gunichar XMLCh;
82 //typedef std::string DOMString;
83 //typedef unsigned short XMLCh;
86 /**
87  *  At least 64 bit time stamp value.
88  */
89 typedef unsigned long long DOMTimeStamp;
91 /**
92  *  This is used for storing refs to user-supplied data.
93  */
94 typedef void DOMUserData;
98 /**
99  *  This is used for opaque references to arbitrary objects from
100  *  the DOM tree. 
101  */
102 typedef void DOMObject;
105 /**
106  * Forward references.  These are needed because of extensive
107  * inter-referencing within the DOM tree.
108  */  
109 class NodeList;
110 class NamedNodeMap;
111 class DOMException;
112 class DOMStringList;
113 class NameList;
114 class DOMImplementationList;
115 class DOMImplementationSource;
116 class DOMImplementation;
117 class TypeInfo;
118 class UserDataHandler;
119 class DOMError;
120 class DOMErrorHandler;
121 class DOMLocator;
122 class DOMConfiguration;
124 /**
125  * Smart pointer definitions.  Most methods that return references to
126  * Nodes of various types, will return one of these smart pointers instead,
127  * to allow refcounting and GC.
128  */   
129 class Node;
130 typedef Ptr<Node> NodePtr;
131 class CharacterData;
132 typedef Ptr<CharacterData> CharacterDataPtr;
133 class Attr;
134 typedef Ptr<Attr> AttrPtr;
135 class Element;
136 typedef Ptr<Element> ElementPtr;
137 class Text;
138 typedef Ptr<Text> TextPtr;
139 class Comment;
140 typedef Ptr<Comment> CommentPtr;
141 class DocumentType;
142 typedef Ptr<DocumentType> DocumentTypePtr;
143 class CDATASection;
144 typedef Ptr<CDATASection> CDATASectionPtr;
145 class Notation;
146 typedef Ptr<Notation> NotationPtr;
147 class Entity;
148 typedef Ptr<Entity> EntityPtr;
149 class EntityReference;
150 typedef Ptr<EntityReference> EntityReferencePtr;
151 class ProcessingInstruction;
152 typedef Ptr<ProcessingInstruction> ProcessingInstructionPtr;
153 class DocumentFragment;
154 typedef Ptr<DocumentFragment> DocumentFragmentPtr;
155 class Document;
156 typedef Ptr<Document> DocumentPtr;
161 /**
162  * NOTE: We were originally intending to split ALL specifications into
163  * interface and implementation.   After consideration, though, it behooves
164  * us to simplify things by implementing the base exception and
165  * container classes directly:
166  *
167  * DOMException
168  * DOMStringList
169  * NameList
170  * DOMImplementationList
171  * DOMImplementationSource
172  * DOMImplementation
173  * NodeList
174  * NamedNodeMap
175  */
178 /*#########################################################################
179 ## DOMException
180 #########################################################################*/
182 /**
183  *  An Exception class.  Not an interface, since this is something that
184  *  all implementations must support. 
185  */
186 class DOMException
189 public:
191     /**
192      * ExceptionCode
193      */
194     typedef enum
195         {
196         INDEX_SIZE_ERR                 = 1,
197         DOMSTRING_SIZE_ERR             = 2,
198         HIERARCHY_REQUEST_ERR          = 3,
199         WRONG_DOCUMENT_ERR             = 4,
200         INVALID_CHARACTER_ERR          = 5,
201         NO_DATA_ALLOWED_ERR            = 6,
202         NO_MODIFICATION_ALLOWED_ERR    = 7,
203         NOT_FOUND_ERR                  = 8,
204         NOT_SUPPORTED_ERR              = 9,
205         INUSE_ATTRIBUTE_ERR            = 10,
206         INVALID_STATE_ERR              = 11,
207         SYNTAX_ERR                     = 12,
208         INVALID_MODIFICATION_ERR       = 13,
209         NAMESPACE_ERR                  = 14,
210         INVALID_ACCESS_ERR             = 15,
211         VALIDATION_ERR                 = 16,
212         TYPE_MISMATCH_ERR              = 17
213         } ExceptionCode;
217     DOMException(const DOMString &reasonMsg)
218         { msg = reasonMsg; }
220     DOMException(short theCode)
221         {
222         code = theCode;
223         }
225     virtual ~DOMException() throw()
226        {}
228     /**
229      *  What type of exception?  One of the ExceptionCodes above.
230      */
231     unsigned short code;
233     /**
234      * Some text describing the context that generated this exception.
235      */
236     DOMString msg;
238     /**
239      * Get a string, translated from the code.
240      * Like std::exception. Not in spec.
241      */
242     const char *what()
243         { return (const char *)msg.c_str(); }
247 };
254 /*#########################################################################
255 ## DOMStringList
256 #########################################################################*/
258 /**
259  *  This holds a list of DOMStrings.  This is likely the response to a query,
260  *  or the value of an attribute. 
261  */ 
262 class DOMStringList
264 public:
266     /**
267      *  Get the nth string of the list
268      */
269     virtual DOMString item(unsigned long index)
270         {
271         if (index>=strings.size())
272             return "";
273         return strings[index];
274         }
276     /**
277      * How many strings in this list?
278      */
279     virtual unsigned long getLength()
280         {
281         return (unsigned long) strings.size();
282         }
284     /**
285      *  Is the argument string present in this list?  Lexically, not identically.
286      */
287     virtual bool contains(const DOMString &str)
288         {
289         for (unsigned int i=0; i<strings.size() ; i++)
290             {
291             if (strings[i] == str)
292                 return true;
293             }
294         return false;
295         }
298     //##################
299     //# Non-API methods
300     //##################
302     /**
303      *
304      */
305     DOMStringList() {}
308     /**
309      *
310      */
311     DOMStringList(const DOMStringList &other)
312         {
313         strings = other.strings;
314         }
316     /**
317      *
318      */
319     DOMStringList &operator=(const DOMStringList &other)
320         {
321         strings = other.strings;
322         return *this;
323         }
325     /**
326      *
327      */
328     virtual ~DOMStringList() {}
331 protected:
333     /**
334      *
335      */
336     virtual void add(const DOMString &str)
337         {
338         strings.push_back(str);
339         }
341     std::vector<DOMString>strings;
343 };
347 /*#########################################################################
348 ## NameList
349 #########################################################################*/
352 /**
353  * Constains a list of namespaced names.
354  */ 
355 class NameList
357 private:
359     class NamePair
360     {
361         public:
362             NamePair(const DOMString &theNamespaceURI, const DOMString &theName)
363                 {
364                 namespaceURI = theNamespaceURI;
365                 name         = theName;
366                 }
367             NamePair(const NamePair &other)
368                 {
369                 namespaceURI = other.namespaceURI;
370                 name         = other.name;
371                 }
372             NamePair &operator=(const NamePair &other)
373                 {
374                 namespaceURI = other.namespaceURI;
375                 name         = other.name;
376                 return *this;
377                 }
378             virtual ~NamePair() {}
379         
380             DOMString namespaceURI;
381             DOMString name;
382         };
384 public:
386     /**
387      * Returns a name at the given index.  If out of range, return -1.
388      */
389     virtual DOMString getName(unsigned long index)
390         {
391         if (index>=namePairs.size())
392             return "";
393         return namePairs[index].name;
394         }
396     /**
397      * Returns a namespace at the given index.  If out of range, return -1.
398      */
399     virtual DOMString getNamespaceURI(unsigned long index)
400         {
401         if (index>=namePairs.size())
402             return "";
403         return namePairs[index].namespaceURI;
404         }
406     /**
407      * Return the number of entries in this list.
408      */
409     virtual unsigned long getLength()
410         {
411         return (unsigned long)namePairs.size();
412         }
414     /**
415      * Return whether the name argument is present in the list.
416      * This is done lexically, not identically.     
417      */
418     virtual bool contains(const DOMString &name)
419         {
420         for (unsigned int i=0; i<namePairs.size() ; i++)
421             {
422             if (namePairs[i].name == name )
423                 return true;
424             }
425         return false;
426         }
428     /**
429      * Return whether the namespaced name argument is present in the list.
430      * This is done lexically, not identically.     
431      */
432     virtual bool containsNS(const DOMString namespaceURI,const DOMString &name)
433         {
434         for (unsigned int i=0; i<namePairs.size() ; i++)
435             {
436             if (namePairs[i].namespaceURI == namespaceURI ||
437                 namePairs[i].name         == name           )
438                 return true;
439             }
440         return false;
441         }
444     //##################
445     //# Non-API methods
446     //##################
448     /**
449      *
450      */
451     NameList() {}
453     /**
454      *
455      */
456     NameList(const NameList &other)
457         {
458         namePairs = other.namePairs;
459         }
461     /**
462      *
463      */
464     NameList &operator=(const NameList &other)
465         {
466         namePairs = other.namePairs;
467         return *this;
468         }
470     /**
471      *
472      */
473     virtual ~NameList() {}
476 protected:
478     std::vector<NamePair> namePairs;
480 };
482 /*#########################################################################
483 ## DOMImplementationList
484 #########################################################################*/
486 /**
487  * Contains a list of DOMImplementations, with accessors.
488  */ 
489 class DOMImplementationList
491 public:
493     /**
494      * Return a DOMImplementation at the given index.  If
495      * out of range, return NULL.     
496      */
497     virtual DOMImplementation *item(unsigned long index)
498         {
499         if (index >implementations.size())
500             return NULL;
501         return implementations[index];
502         }
504     /**
505      * Return the number of DOMImplementations in this list.
506      */
507     virtual unsigned long getLength()
508         {
509         return (unsigned long) implementations.size();
510         }
513     //##################
514     //# Non-API methods
515     //##################
517     /**
518      *
519      */
520     DOMImplementationList() {}
523     /**
524      *
525      */
526     DOMImplementationList(const DOMImplementationList &other)
527         {
528         implementations = other.implementations;
529         }
531     /**
532      *
533      */
534     DOMImplementationList &operator=(const DOMImplementationList &other)
535         {
536         implementations = other.implementations;
537         return *this;
538         }
540     /**
541      *
542      */
543     virtual ~DOMImplementationList() {}
545 protected:
547     std::vector<DOMImplementation *>implementations;
549 };
552 /*#########################################################################
553 ## DOMImplementationSource
554 #########################################################################*/
556 /**
557  * This is usually the first item to be called when creating a Document.
558  * You will either find one DOMImplementation with a given set of features,
559  * or return a list that match.  Using "" will get any implementation
560  * available.
561  */    
562 class DOMImplementationSource
564 public:
566     /**
567      *  Return the first DOMImplementation with the given set of features.
568      *  Use "" to fetch any implementation. 
569      */
570     virtual DOMImplementation *getDOMImplementation(const DOMString &features) = 0;
572     /**
573      *  Return a list of DOMImplementations with the given set of features.
574      *  Use "" to fetch any implementation. 
575      */
576     virtual DOMImplementationList getDOMImplementationList(const DOMString &features) = 0;
578     //##################
579     //# Non-API methods
580     //##################
582     /**
583      *
584      */
585     virtual ~DOMImplementationSource() {}
587 };
593 /*#########################################################################
594 ## DOMImplementation
595 #########################################################################*/
597 /**
598  * This is the class that actually creates a Document. 
599  */
600 class DOMImplementation
602 public:
604     /**
605      *  Determine if this implementation has the given feature and version.
606      */
607     virtual bool hasFeature(const DOMString& feature, const DOMString& version) = 0;
610     /**
611      *  Create a document type to be used in creating documents.
612      */
613     virtual DocumentTypePtr createDocumentType(
614                                        const DOMString& qualifiedName,
615                                    const DOMString& publicId,
616                                    const DOMString& systemId)
617                                    throw(DOMException) = 0;
619     /**
620      *  Create a DOM document.
621      */
622     virtual DocumentPtr createDocument(const DOMString& namespaceURI,
623                              const DOMString& qualifiedName,
624                              DocumentTypePtr doctype)
625                              throw(DOMException) = 0;
626     /**
627      *  Return the thing which is the feature of this implementation.  Since
628      *  this is a "one size fits all" call, you will need to typecast the
629      *  result to the expected type.          
630      */
631     virtual DOMObject *getFeature(const DOMString& feature,
632                              const DOMString& version) = 0;
635     //##################
636     //# Non-API methods
637     //##################
639     /**
640      *
641      */
642     virtual ~DOMImplementation() {}
644 };
650 /*#########################################################################
651 ## Node
652 #########################################################################*/
654 /**
655  *  The basic Node class, which is the root of most other
656  *  classes in DOM.  Thus it is by far the most important, and the one
657  *  whose implementation we must perform correctly. 
658  */
659 class Node
661 public:
663     /**
664      * Which of the DOM Core node types is this node?
665      */      
666     typedef enum
667         {
668         ELEMENT_NODE                   = 1,
669         ATTRIBUTE_NODE                 = 2,
670         TEXT_NODE                      = 3,
671         CDATA_SECTION_NODE             = 4,
672         ENTITY_REFERENCE_NODE          = 5,
673         ENTITY_NODE                    = 6,
674         PROCESSING_INSTRUCTION_NODE    = 7,
675         COMMENT_NODE                   = 8,
676         DOCUMENT_NODE                  = 9,
677         DOCUMENT_TYPE_NODE             = 10,
678         DOCUMENT_FRAGMENT_NODE         = 11,
679         NOTATION_NODE                  = 12
680         } NodeType;
682     /**
683      * Return the name of this node.
684      */
685     virtual DOMString getNodeName() = 0;
687     /**
688      *  Return the value of this node.  The interpretation of the
689      *  value is type-specific.     
690      */
691     virtual DOMString getNodeValue() throw (DOMException) = 0;
693     /**
694      *  Set the value of this node.  The interpretation of the
695      *  value is type-specific.     
696      */
697     virtual void setNodeValue(const DOMString& val) throw (DOMException) = 0;
699     /**
700      *  Return the type of this Node.  One of the NodeType values above.
701      */
702     virtual unsigned short getNodeType() = 0;
704     /**
705      *  Return the parent which references this node as a child in the DOM
706      *  tree.  Return NULL if there is none.     
707      */
708     virtual NodePtr getParentNode() = 0;
710     /**
711      * Return a list of the children of this Node.
712      * NOTE: the spec expects this to be a "live" list that always
713      * reflects an accurate list of what the Node current possesses, not
714      * a snapshot.  How do we do this?                
715      */
716     virtual NodeList getChildNodes() = 0;
718     /**
719      * Return the first sibling of the chidren of this node.  Return
720      * null if there is none.     
721      */
722     virtual NodePtr getFirstChild() = 0;
724     /**
725      * Return the last sibling of the children of this node.  Return
726      * null if there is none.     
727      */
728     virtual NodePtr getLastChild() = 0;
730     /**
731      * Return the node that is previous to this one in the parent's
732      * list of children.  Return null if there is none.     
733      */
734     virtual NodePtr getPreviousSibling() = 0;
736     /**
737      * Return the node that is after this one in the parent's list
738      * of children.  Return null if there is none.     
739      */
740     virtual NodePtr getNextSibling() = 0;
742     /**
743      * Get the list of all attributes of this node.
744      */
745     virtual NamedNodeMap &getAttributes() = 0;
748     /**
749      * Return the document that created or inherited this node.
750      */
751     virtual DocumentPtr getOwnerDocument() = 0;
753     /**
754      * Insert a node as a new child.  Place it before the referenced child.
755      * Place it at the end if the referenced child does not exist.     
756      */
757     virtual NodePtr insertBefore(const NodePtr newChild,
758                        const NodePtr refChild)
759                        throw(DOMException) = 0;
761     /**
762      * Insert a node as a new child.  Replace the referenced child with it.
763      * Place it at the end if the referenced child does not exist.     
764      */
765     virtual NodePtr replaceChild(const NodePtr newChild,
766                        const NodePtr oldChild)
767                        throw(DOMException) = 0;
769     /**
770      * Remove a node from the list of children.  Do nothing if the
771      * node is not a member of the child list.     
772      */
773     virtual NodePtr removeChild(const NodePtr oldChild)
774                       throw(DOMException) = 0;
776     /**
777      *  Add the node to the end of this node's child list.
778      */
779     virtual NodePtr appendChild(const NodePtr newChild)
780                       throw(DOMException) = 0;
782     /**
783      * Return true if this node has one or more children, else return false.
784      */
785     virtual bool hasChildNodes() = 0;
787     /**
788      * Return a new node which has the name, type, value, attributes, and
789      * child list as this one.      
790      * If 'deep' is true, continue cloning recursively with this node's children,
791      * so that the child list also contains clones of their respective nodes.     
792      */
793     virtual NodePtr cloneNode(bool deep) = 0;
795     /**
796      *  Adjust this node and its children to have its namespaces and
797      *  prefixes in "canonical" order.     
798      */
799     virtual void normalize() = 0;
801     /**
802      *  Return true if the named feature is supported by this node,
803      *  else false.     
804      */
805     virtual bool isSupported(const DOMString& feature,
806                      const DOMString& version) = 0;
808     /**
809      * Return the namespace of this node.  This would be whether the
810      * namespace were declared explicitly on this node, it has a namespace
811      * prefix, or it is inherits the namespace from an ancestor node.         
812      */
813     virtual DOMString getNamespaceURI() = 0;
815     /**
816      * Return the namespace prefix of this node, if any.  For example, if
817      * the tag were <svg:image> then the prefix would be "svg"     
818      */
819     virtual DOMString getPrefix() = 0;
821     /**
822      *  Sets the namespace prefix of this node to the given value.  This
823      *  does not change the namespaceURI value.     
824      */
825     virtual void setPrefix(const DOMString& val) throw(DOMException) = 0;
827     /**
828      * Return the local name of this node.  This is merely the name without
829      * any namespace or prefix.     
830      */
831     virtual DOMString getLocalName() = 0;
833     /**
834      * Return true if this node has one or more attributes, else false.
835      */
836     virtual bool hasAttributes() = 0;
838     /**
839      * Return the base URI of this node.  This is basically the "location" of this
840      * node, and is used in resolving the relative locations of other URIs.     
841      */
842     virtual DOMString getBaseURI() = 0;
844     /**
845      * DocumentPosition.
846      * This is used to describe the position of one node relative
847      * to another in a document
848      */                      
849     typedef enum
850         {
851         DOCUMENT_POSITION_DISCONNECTED            = 0x01,
852         DOCUMENT_POSITION_PRECEDING               = 0x02,
853         DOCUMENT_POSITION_FOLLOWING               = 0x04,
854         DOCUMENT_POSITION_CONTAINS                = 0x08,
855         DOCUMENT_POSITION_CONTAINED_BY            = 0x10,
856         DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
857         } DocumentPosition;
860     /**
861      * Get the position of this node relative to the node argument.
862      */
863     virtual unsigned short compareDocumentPosition(
864                                  const NodePtr other) = 0;
866     /**
867      * This is a DOM L3 method.  Return the text value of this node and its
868      * children.  This is done by concatenating all of the TEXT_NODE and
869      * CDATA_SECTION nodes of this node and its children, in order, together.
870      *  Very handy.                           
871      */
872     virtual DOMString getTextContent() throw(DOMException) = 0;
875     /**
876      * This is a DOM L3 method.  Remember, this is a destructive call.  This
877      * will replace all of the child nodes of this node with a single TEXT_NODE
878      * with the given text value.      
879      */
880     virtual void setTextContent(const DOMString &val) throw(DOMException) = 0;
883     /**
884      *  This will search the tree from this node up, for a prefix that
885      *  has been assigned to the namespace argument.  Return "" if not found.     
886      */
887     virtual DOMString lookupPrefix(const DOMString &namespaceURI) =0;
890     /**
891      *  Return true if this node is in the namespace of the argument, without
892      *  requiring an explicit namespace declaration or a suffix.     
893      */
894     virtual bool isDefaultNamespace(const DOMString &namespaceURI) =0;
897     /**
898      * This will search the tree from this node up, for a namespace that
899      * has been assigned the suffix in the argument. Return "" if not found.     
900      */
901     virtual DOMString lookupNamespaceURI(const DOMString &prefix) =0;
904     /**
905      * Return true if the argument node is equal to this one.  Use W3C rules
906      * for equality.     
907      */
908     virtual bool isEqualNode(const NodePtr node) =0;
912     /**
913      * Return an opaque reference to the named feature.  Return null if
914      * not supported.  Using other than "" for the version will look for
915      * a feature with the given version.              
916      */
917     virtual DOMObject *getFeature(const DOMString &feature,
918                                  const DOMString &version) =0;
920     /**
921      * Store a user data reference in this node, using the given key.
922      * A handler is an optional function object that will be called during
923      * future settings of this value.  See UserDataHandler for more info.             
924      */
925     virtual DOMUserData *setUserData(const DOMString &key,
926                                      const DOMUserData *data,
927                                      const UserDataHandler *handler) =0;
930     /**
931      *  Return a reference to the named user data object. Return null
932      *  if it does not exist.     
933      */
934     virtual DOMUserData *getUserData(const DOMString &key) =0;
936     //##################
937     //# Non-API methods
938     //##################
940     /**
941      *
942      */
943     Node() : _refCnt(0)
944         {}
946     /**
947      *
948      */
949     virtual ~Node() {}
951 protected:
953     friend void incrementRefCount(Node *p);
954     friend void decrementRefCount(Node *p);
955  
956     /**
957      * For the Ptr smart pointer
958      */      
959     int _refCnt;
961 };
966 /*#########################################################################
967 ## NodeList
968 #########################################################################*/
970 /**
971  *  Contains a list of Nodes.  This is the standard API container for Nodes,
972  *  and is used in lieu of other lists, arrays, etc, in order to provide
973  *  a consistent API and algorithm.  
974  */
975 class NodeList
977 public:
979     /**
980      *  Retrieve the Node at the given index.  Return NULL
981      *  if out of range.     
982      */
983     virtual NodePtr item(unsigned long index)
984         {
985         if (index>=nodes.size())
986             return NULL;
987         return nodes[index];
988         }
990     /**
991      * Get the number of nodes in this list
992      */
993     virtual unsigned long getLength()
994         {
995         return (unsigned long) nodes.size();
996         }
998     //##################
999     //# Non-API methods
1000     //##################
1003     /**
1004      *
1005      */
1006     NodeList() {}
1008     /**
1009      *
1010      */
1011     NodeList(const NodeList &other)
1012         {
1013         nodes = other.nodes;
1014         }
1016     /**
1017      *
1018      */
1019     NodeList &operator=(const NodeList &other)
1020         {
1021         nodes = other.nodes;
1022         return *this;
1023         }
1025     /**
1026      *
1027      */
1028     virtual ~NodeList() {}
1030     /**
1031      *
1032      */
1033     virtual void clear()
1034         {
1035         nodes.clear();
1036         }
1038 protected:
1040 friend class NodeImpl;
1041 friend class ElementImpl;
1043     /*
1044      *
1045      */
1046     virtual void add(const NodePtr node)
1047         {
1048         nodes.push_back(node);
1049         }
1051 protected:
1053     std::vector<NodePtr> nodes;
1055 };
1060 /*#########################################################################
1061 ## NamedNodeMap
1062 #########################################################################*/
1064 /**
1065  * Contains a mapping from name->NodePtr.  Used for various purposes.  For
1066  * example, a list of Attributes is a NamedNodeMap. 
1067  */
1068 class NamedNodeMap
1070 private:
1072     /**
1073      * table entry.  Not an API item
1074      */      
1075         class NamedNodeMapEntry
1076         {
1077         public:
1078             NamedNodeMapEntry(const DOMString &theNamespaceURI,
1079                               const DOMString &theName,
1080                               const NodePtr   theNode)
1081                 {
1082                 namespaceURI = theNamespaceURI;
1083                 name         = theName;
1084                 node         = theNode;
1085                 }
1086             NamedNodeMapEntry(const NamedNodeMapEntry &other)
1087                 {
1088                 assign(other);
1089                 }
1090             NamedNodeMapEntry &operator=(const NamedNodeMapEntry &other)
1091                 {
1092                 assign(other);
1093                 return *this;
1094                 }
1095             virtual ~NamedNodeMapEntry()
1096                 {
1097                 }
1098             void assign(const NamedNodeMapEntry &other)
1099                 {
1100                 namespaceURI = other.namespaceURI;
1101                 name         = other.name;
1102                 node         = other.node;
1103                 }
1104             DOMString namespaceURI;
1105             DOMString name;
1106             NodePtr   node;
1107         };
1110 public:
1112     /**
1113      * Return the named node.  Return nullptr if not found.
1114      */
1115     virtual NodePtr getNamedItem(const DOMString& name)
1116         {
1117         std::vector<NamedNodeMapEntry>::iterator iter;
1118         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1119             {
1120             if (iter->name == name)
1121                 {
1122                 NodePtr node = iter->node;
1123                 return node;
1124                 }
1125             }
1126         return NULL;
1127         }
1129     /**
1130      *
1131      */
1132     virtual NodePtr setNamedItem(NodePtr arg) throw(DOMException)
1133         {
1134         if (!arg)
1135             return NULL;
1136         DOMString namespaceURI = arg->getNamespaceURI();
1137         DOMString name         = arg->getNodeName();
1138         std::vector<NamedNodeMapEntry>::iterator iter;
1139         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1140             {
1141             if (iter->name == name)
1142                 {
1143                 NodePtr node = iter->node;
1144                 iter->node = arg;
1145                 return node;
1146                 }
1147             }
1148         NamedNodeMapEntry entry(namespaceURI, name, arg);
1149         entries.push_back(entry);
1150         return arg;
1151         }
1154     /**
1155      *
1156      */
1157     virtual NodePtr removeNamedItem(const DOMString& name) throw(DOMException)
1158         {
1159         std::vector<NamedNodeMapEntry>::iterator iter;
1160         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1161             {
1162             if (iter->name == name)
1163                 {
1164                 NodePtr node = iter->node;
1165                 entries.erase(iter);
1166                 return node;
1167                 }
1168             }
1169         return NULL;
1170         }
1172     /**
1173      *
1174      */
1175     virtual NodePtr item(unsigned long index)
1176         {
1177         if (index>=entries.size())
1178             return NULL;
1179         return entries[index].node;
1180         }
1182     /**
1183      *
1184      */
1185     virtual unsigned long getLength()
1186         {
1187         return (unsigned long)entries.size();
1188         }
1190     /**
1191      *
1192      */
1193     virtual NodePtr getNamedItemNS(const DOMString& namespaceURI,
1194                                  const DOMString& localName)
1195         {
1196         std::vector<NamedNodeMapEntry>::iterator iter;
1197         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1198             {
1199             if (iter->namespaceURI == namespaceURI && iter->name == localName)
1200                 {
1201                 NodePtr node = iter->node;
1202                 return node;
1203                 }
1204             }
1205         return NULL;
1206         }
1208     /**
1209      *
1210      */
1211     virtual NodePtr setNamedItemNS(NodePtr arg) throw(DOMException)
1212         {
1213         if (!arg)
1214             return NULL;
1215         DOMString namespaceURI = arg->getNamespaceURI();
1216         DOMString name         = arg->getNodeName();
1217         std::vector<NamedNodeMapEntry>::iterator iter;
1218         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1219             {
1220             if (iter->namespaceURI == namespaceURI && iter->name == name)
1221                 {
1222                 NodePtr node = iter->node;
1223                 iter->node = arg;
1224                 return node;
1225                 }
1226             }
1227         NamedNodeMapEntry entry(namespaceURI, name, arg);
1228         entries.push_back(entry);
1229         return arg;
1230         }
1232     /**
1233      *
1234      */
1235     virtual NodePtr removeNamedItemNS(const DOMString& namespaceURI,
1236                                     const DOMString& localName)
1237                                     throw(DOMException)
1238         {
1239         std::vector<NamedNodeMapEntry>::iterator iter;
1240         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1241             {
1242             if (iter->namespaceURI == namespaceURI && iter->name == localName)
1243                 {
1244                 NodePtr node = iter->node;
1245                 entries.erase(iter);
1246                 return node;
1247                 }
1248             }
1249         return NULL;
1250         }
1252     //##################
1253     //# Non-API methods
1254     //##################
1256     /**
1257      *
1258      */
1259     NamedNodeMap() {}
1262     /**
1263      *
1264      */
1265     NamedNodeMap(const NamedNodeMap &other)
1266         {
1267         entries = other.entries;
1268         }
1270     /**
1271      *
1272      */
1273     NamedNodeMap &operator=(const NamedNodeMap &other)
1274         {
1275         entries = other.entries;
1276         return *this;
1277         }
1280     /**
1281      *
1282      */
1283     virtual ~NamedNodeMap() {}
1285 protected:
1287     std::vector<NamedNodeMapEntry> entries;
1289 };
1294 /*#########################################################################
1295 ## CharacterData
1296 #########################################################################*/
1298 /**
1299  *
1300  */
1301 class CharacterData : virtual public Node
1303 public:
1305     /**
1306      *
1307      */
1308     virtual DOMString getData() throw(DOMException) = 0;
1310     /**
1311      *
1312      */
1313     virtual void setData(const DOMString& val) throw(DOMException) = 0;
1315     /**
1316      *
1317      */
1318     virtual unsigned long getLength() = 0;
1320     /**
1321      *
1322      */
1323     virtual DOMString substringData(unsigned long offset,
1324                             unsigned long count)
1325                             throw(DOMException) = 0;
1327     /**
1328      *
1329      */
1330     virtual void appendData(const DOMString& arg) throw(DOMException) = 0;
1332     /**
1333      *
1334      */
1335     virtual void insertData(unsigned long offset,
1336                     const DOMString& arg)
1337                     throw(DOMException) = 0;
1339     /**
1340      *
1341      */
1342     virtual void deleteData(unsigned long offset,
1343                     unsigned long count)
1344                     throw(DOMException) = 0;
1346     /**
1347      *
1348      */
1349     virtual void  replaceData(unsigned long offset,
1350                       unsigned long count,
1351                       const DOMString& arg)
1352                       throw(DOMException) = 0;
1355     //##################
1356     //# Non-API methods
1357     //##################
1360     /**
1361      *
1362      */
1363     virtual ~CharacterData() {}
1365 };
1368 typedef Ptr<CharacterData> CharacterDataPtr;
1373 /*#########################################################################
1374 ## Attr
1375 #########################################################################*/
1377 /**
1378  *
1379  */
1380 class Attr : virtual public Node
1382 public:
1384     /**
1385      *
1386      */
1387     virtual DOMString getName() = 0;
1389     /**
1390      *
1391      */
1392     virtual bool getSpecified() = 0;
1394     /**
1395      *
1396      */
1397     virtual DOMString getValue() = 0;
1399     /**
1400      *
1401      */
1402     virtual void setValue(const DOMString& val) throw(DOMException) = 0;
1404     /**
1405      *
1406      */
1407     virtual ElementPtr getOwnerElement() = 0;
1410     /**
1411      *
1412      */
1413     virtual TypeInfo &getSchemaTypeInfo() = 0;
1416     /**
1417      *
1418      */
1419     virtual bool getIsId() = 0;
1421     //##################
1422     //# Non-API methods
1423     //##################
1426     /**
1427      *
1428      */
1429     virtual ~Attr() {}
1431 };
1437 /*#########################################################################
1438 ## Element
1439 #########################################################################*/
1441 /**
1442  *
1443  */
1444 class Element : virtual public Node
1446 public:
1449     /**
1450      *
1451      */
1452     virtual DOMString getTagName() = 0;
1454     /**
1455      *
1456      */
1457     virtual DOMString getAttribute(const DOMString& name) = 0;
1459     /**
1460      *
1461      */
1462     virtual void setAttribute(const DOMString& name,
1463                       const DOMString& value)
1464                       throw(DOMException) = 0;
1466     /**
1467      *
1468      */
1469     virtual void removeAttribute(const DOMString& name)
1470                          throw(DOMException) = 0;
1472     /**
1473      *
1474      */
1475     virtual AttrPtr getAttributeNode(const DOMString& name) = 0;
1477     /**
1478      *
1479      */
1480     virtual AttrPtr setAttributeNode(AttrPtr newAttr)
1481                           throw(DOMException) = 0;
1483     /**
1484      *
1485      */
1486     virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
1487                              throw(DOMException) = 0;
1489     /**
1490      *
1491      */
1492     virtual NodeList getElementsByTagName(const DOMString& name) = 0;
1494     /**
1495      *
1496      */
1497     virtual DOMString getAttributeNS(const DOMString& namespaceURI,
1498                              const DOMString& localName) = 0;
1500     /**
1501      *
1502      */
1503     virtual void setAttributeNS(const DOMString& namespaceURI,
1504                         const DOMString& qualifiedName,
1505                         const DOMString& value)
1506                         throw(DOMException) = 0;
1508     /**
1509      *
1510      */
1511     virtual void removeAttributeNS(const DOMString& namespaceURI,
1512                            const DOMString& localName)
1513                            throw(DOMException) = 0;
1515     /**
1516      *
1517      */
1518     virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
1519                             const DOMString& localName) = 0;
1521     /**
1522      *
1523      */
1524     virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
1525                             throw(DOMException) = 0;
1527     /**
1528      *
1529      */
1530     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1531                                     const DOMString& localName) = 0;
1533     /**
1534      *
1535      */
1536     virtual bool hasAttribute(const DOMString& name) = 0;
1538     /**
1539      *
1540      */
1541     virtual bool hasAttributeNS(const DOMString& namespaceURI,
1542                         const DOMString& localName) = 0;
1544     /**
1545      *
1546      */
1547     virtual TypeInfo &getSchemaTypeInfo() = 0;
1550     /**
1551      *
1552      */
1553     virtual void setIdAttribute(const DOMString &name,
1554                                 bool isId) throw (DOMException) = 0;
1556     /**
1557      *
1558      */
1559     virtual void setIdAttributeNS(const DOMString &namespaceURI,
1560                                   const DOMString &localName,
1561                                   bool isId) throw (DOMException) = 0;
1563     /**
1564      *
1565      */
1566     virtual void setIdAttributeNode(const AttrPtr idAttr,
1567                                     bool isId) throw (DOMException) = 0;
1569     //##################
1570     //# Non-API methods
1571     //##################
1573     /**
1574      *
1575      */
1576     virtual ~Element() {}
1578 };
1584 /*#########################################################################
1585 ## Text
1586 #########################################################################*/
1588 /**
1589  *
1590  */
1591 class Text : virtual public CharacterData
1593 public:
1595     /**
1596      *
1597      */
1598     virtual TextPtr splitText(unsigned long offset)
1599                     throw(DOMException) = 0;
1601     /**
1602      *
1603      */
1604     virtual bool getIsElementContentWhitespace()= 0;
1606     /**
1607      *
1608      */
1609     virtual DOMString getWholeText() = 0;
1612     /**
1613      *
1614      */
1615     virtual TextPtr replaceWholeText(const DOMString &content)
1616                                  throw(DOMException) = 0;
1618     //##################
1619     //# Non-API methods
1620     //##################
1623     /**
1624      *
1625      */
1626     virtual ~Text() {}
1628 };
1632 /*#########################################################################
1633 ## Comment
1634 #########################################################################*/
1636 /**
1637  *
1638  */
1639 class Comment : virtual public CharacterData
1641 public:
1643     //##################
1644     //# Non-API methods
1645     //##################
1648     /**
1649      *
1650      */
1651     virtual ~Comment() {}
1654 };
1658 /*#########################################################################
1659 ## TypeInfo
1660 #########################################################################*/
1662 /**
1663  *
1664  */
1665 class TypeInfo
1667 public:
1669     /**
1670      *
1671      */
1672     virtual DOMString getTypeName()
1673         { return typeName; }
1675     /**
1676      *
1677      */
1678     virtual DOMString getTypeNamespace()
1679         { return typeNameSpace; }
1681     typedef enum
1682         {
1683         DERIVATION_RESTRICTION = 0x00000001,
1684         DERIVATION_EXTENSION   = 0x00000002,
1685         DERIVATION_UNION       = 0x00000004,
1686         DERIVATION_LIST        = 0x00000008
1687         } DerivationMethod;
1690     /**
1691      *
1692      */
1693     virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1694                                const DOMString &typeNameArg,
1695                                DerivationMethod derivationMethod)
1696         { (void)typeNamespaceArg; (void)typeNameArg; (void)derivationMethod; return false; }
1698     //##################
1699     //# Non-API methods
1700     //##################
1703     /**
1704      *
1705      */
1706     TypeInfo() 
1707             {}
1708             
1709     /**
1710      *
1711      */
1712     TypeInfo(const TypeInfo &other)
1713         { assign(other); }
1714         
1715     /**
1716      *
1717      */
1718     TypeInfo &operator=(const TypeInfo &other)
1719         { assign(other); return *this; }
1720         
1721     /**
1722      *
1723      */
1724     virtual ~TypeInfo() {}
1725     
1726 private:
1728     void assign(const TypeInfo &other)
1729         {
1730         typeName      = other.typeName;
1731         typeNameSpace = other.typeNameSpace;
1732         }
1734     DOMString typeName;
1735     DOMString typeNameSpace;
1736 };
1741 /*#########################################################################
1742 ## UserDataHandler
1743 #########################################################################*/
1745 /**
1746  *
1747  */
1748 class UserDataHandler
1750 public:
1752     typedef enum
1753         {
1754         NODE_CLONED     = 1,
1755         NODE_IMPORTED   = 2,
1756         NODE_DELETED    = 3,
1757         NODE_RENAMED    = 4,
1758         NODE_ADOPTED    = 5
1759         } OperationType;
1762     /**
1763      *
1764      */
1765     virtual  void handle(unsigned short operation,
1766                          const DOMString &key,
1767                          const DOMUserData *data,
1768                          const NodePtr src,
1769                          const NodePtr dst) =0;
1771     //##################
1772     //# Non-API methods
1773     //##################
1776     /**
1777      *
1778      */
1779     virtual ~UserDataHandler() {}
1781 };
1784 /*#########################################################################
1785 ## DOMError
1786 #########################################################################*/
1788 /**
1789  *
1790  */
1791 class DOMError
1793 public:
1795     typedef enum
1796         {
1797         SEVERITY_WARNING     = 1,
1798         SEVERITY_ERROR       = 2,
1799         SEVERITY_FATAL_ERROR = 3
1800         } ErrorSeverity;
1803     /**
1804      *
1805      */
1806     virtual unsigned short getSeverity() =0;
1808     /**
1809      *
1810      */
1811     virtual DOMString getMessage() =0;
1813     /**
1814      *
1815      */
1816     virtual DOMString getType() =0;
1818     /**
1819      *
1820      */
1821     virtual DOMObject *getRelatedException() =0;
1823     /**
1824      *
1825      */
1826     virtual DOMObject *getRelatedData() =0;
1828     /**
1829      *
1830      */
1831     virtual DOMLocator *getLocation() =0;
1834     //##################
1835     //# Non-API methods
1836     //##################
1839     /**
1840      *
1841      */
1842     virtual ~DOMError() {}
1844 };
1847 /*#########################################################################
1848 ## DOMErrorHandler
1849 #########################################################################*/
1851 /**
1852  *
1853  */
1854 class DOMErrorHandler
1856 public:
1857     /**
1858      *
1859      */
1860     virtual bool handleError(const DOMError *error) =0;
1862     //##################
1863     //# Non-API methods
1864     //##################
1867     /**
1868      *
1869      */
1870     virtual ~DOMErrorHandler() {}
1872 };
1876 /*#########################################################################
1877 ## DOMLocator
1878 #########################################################################*/
1880 /**
1881  *
1882  */
1883 class DOMLocator
1885 public:
1887     /**
1888      *
1889      */
1890     virtual long getLineNumber() =0;
1892     /**
1893      *
1894      */
1895     virtual long getColumnNumber() =0;
1897     /**
1898      *
1899      */
1900     virtual long getByteOffset() =0;
1902     /**
1903      *
1904      */
1905     virtual long getUtf16Offset() =0;
1908     /**
1909      *
1910      */
1911     virtual NodePtr getRelatedNode() =0;
1914     /**
1915      *
1916      */
1917     virtual DOMString getUri() =0;
1919     //##################
1920     //# Non-API methods
1921     //##################
1923     /**
1924      *
1925      */
1926     virtual ~DOMLocator() {}
1927 };
1930 /*#########################################################################
1931 ## DOMConfiguration
1932 #########################################################################*/
1934 /**
1935  *
1936  */
1937 class DOMConfiguration
1939 public:
1941     /**
1942      *
1943      */
1944     virtual void setParameter(const DOMString &name,
1945                               const DOMUserData *value)
1946                                                            throw (DOMException) =0;
1948     /**
1949      *
1950      */
1951     virtual DOMUserData *getParameter(const DOMString &name)
1952                                       throw (DOMException) =0;
1954     /**
1955      *
1956      */
1957     virtual bool canSetParameter(const DOMString &name,
1958                                  const DOMUserData *data) =0;
1960     /**
1961      *
1962      */
1963     virtual DOMStringList *getParameterNames() =0;
1965     //##################
1966     //# Non-API methods
1967     //##################
1970     /**
1971      *
1972      */
1973     virtual ~DOMConfiguration() {}
1975 };
1982 /*#########################################################################
1983 ## CDATASection
1984 #########################################################################*/
1985 /**
1986  *
1987  */
1988 class CDATASection : virtual public Text
1990 public:
1992     //##################
1993     //# Non-API methods
1994     //##################
1997     /**
1998      *
1999      */
2000     virtual ~CDATASection() {}
2002 };
2007 /*#########################################################################
2008 ## DocumentType
2009 #########################################################################*/
2011 /**
2012  *
2013  */
2014 class DocumentType : virtual public Node
2016 public:
2018     /**
2019      *
2020      */
2021     virtual DOMString getName() = 0;
2023     /**
2024      *
2025      */
2026     virtual NamedNodeMap getEntities() = 0;
2028     /**
2029      *
2030      */
2031     virtual NamedNodeMap getNotations() = 0;
2033     /**
2034      *
2035      */
2036     virtual DOMString getPublicId() = 0;
2038     /**
2039      *
2040      */
2041     virtual DOMString getSystemId() = 0;
2043     /**
2044      *
2045      */
2046     virtual DOMString getInternalSubset() = 0;
2048     //##################
2049     //# Non-API methods
2050     //##################
2052     /**
2053      *
2054      */
2055     virtual ~DocumentType() {}
2057 };
2063 /*#########################################################################
2064 ## Notation
2065 #########################################################################*/
2067 /**
2068  *
2069  */
2070 class Notation : virtual public Node
2072 public:
2074     /**
2075      *
2076      */
2077     virtual DOMString getPublicId() = 0;
2079     /**
2080      *
2081      */
2082     virtual DOMString getSystemId() = 0;
2084     //##################
2085     //# Non-API methods
2086     //##################
2089     /**
2090      *
2091      */
2092     virtual ~Notation() {}
2093 };
2100 /*#########################################################################
2101 ## Entity
2102 #########################################################################*/
2104 /**
2105  *
2106  */
2107 class Entity : virtual public Node
2109 public:
2111     /**
2112      *
2113      */
2114     virtual DOMString getPublicId() = 0;
2116     /**
2117      *
2118      */
2119     virtual DOMString getSystemId() = 0;
2121     /**
2122      *
2123      */
2124     virtual DOMString getNotationName() = 0;
2126     /**
2127      *
2128      */
2129     virtual DOMString getInputEncoding() = 0;
2131     /**
2132      *
2133      */
2134     virtual DOMString getXmlEncoding() = 0;
2136     /**
2137      *
2138      */
2139     virtual DOMString getXmlVersion() = 0;
2141     //##################
2142     //# Non-API methods
2143     //##################
2146     /**
2147      *
2148      */
2149     virtual ~Entity() {}
2150 };
2156 /*#########################################################################
2157 ## EntityReference
2158 #########################################################################*/
2159 /**
2160  *
2161  */
2162 class EntityReference : virtual public Node
2164 public:
2167     //##################
2168     //# Non-API methods
2169     //##################
2171     /**
2172      *
2173      */
2174     virtual ~EntityReference() {}
2175 };
2181 /*#########################################################################
2182 ## ProcessingInstruction
2183 #########################################################################*/
2185 /**
2186  *
2187  */
2188 class ProcessingInstruction : virtual public Node
2190 public:
2192     /**
2193      *
2194      */
2195     virtual DOMString getTarget() = 0;
2197     /**
2198      *
2199      */
2200     virtual DOMString getData() = 0;
2202     /**
2203      *
2204      */
2205    virtual void setData(const DOMString& val) throw(DOMException) = 0;
2207     //##################
2208     //# Non-API methods
2209     //##################
2212     /**
2213      *
2214      */
2215     virtual ~ProcessingInstruction() {}
2217 };
2223 /*#########################################################################
2224 ## DocumentFragment
2225 #########################################################################*/
2226 /**
2227  *
2228  */
2229 class DocumentFragment : virtual public Node
2231 public:
2233     //##################
2234     //# Non-API methods
2235     //##################
2238     /**
2239      *
2240      */
2241     virtual ~DocumentFragment() {}
2242 };
2249 /*#########################################################################
2250 ## Document
2251 #########################################################################*/
2253 /**
2254  *
2255  */
2256 class Document : virtual public Node
2258 public:
2260     /**
2261      *
2262      */
2263     virtual DocumentTypePtr getDoctype() = 0;
2265     /**
2266      *
2267      */
2268     virtual DOMImplementation *getImplementation() = 0;
2270     /**
2271      *
2272      */
2273     virtual ElementPtr getDocumentElement() = 0;
2275     /**
2276      *
2277      */
2278     virtual ElementPtr createElement(const DOMString& tagName)
2279                            throw(DOMException) = 0;
2281     /**
2282      *
2283      */
2284     virtual DocumentFragmentPtr createDocumentFragment() = 0;
2286     /**
2287      *
2288      */
2289     virtual TextPtr createTextNode(const DOMString& data) = 0;
2291     /**
2292      *
2293      */
2294     virtual CommentPtr createComment(const DOMString& data) = 0;
2296     /**
2297      *
2298      */
2299     virtual CDATASectionPtr createCDATASection(const DOMString& data)
2300                                      throw(DOMException) = 0;
2302     /**
2303      *
2304      */
2305     virtual ProcessingInstructionPtr
2306                    createProcessingInstruction(const DOMString& target,
2307                                            const DOMString& data)
2308                                            throw(DOMException) = 0;
2310     /**
2311      *
2312      */
2313     virtual AttrPtr createAttribute(const DOMString& name)
2314                           throw(DOMException) = 0;
2316     /**
2317      *
2318      */
2319     virtual EntityReferencePtr createEntityReference(const DOMString& name)
2320                                            throw(DOMException) = 0;
2322     /**
2323      *
2324      */
2325     virtual NodeList getElementsByTagName(const DOMString& tagname) = 0;
2328     /**
2329      *
2330      */
2331     virtual NodePtr importNode(const NodePtr importedNode,
2332                      bool deep)
2333                      throw(DOMException) = 0;
2335     /**
2336      *
2337      */
2338     virtual ElementPtr createElementNS(const DOMString& namespaceURI,
2339                              const DOMString& qualifiedName)
2340                              throw(DOMException) = 0;
2342     /**
2343      *
2344      */
2345     virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
2346                             const DOMString& qualifiedName)
2347                             throw(DOMException) = 0;
2349     /**
2350      *
2351      */
2352     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
2353                                      const DOMString& localName) = 0;
2355     /**
2356      *
2357      */
2358     virtual ElementPtr getElementById(const DOMString& elementId) = 0;
2361     /**
2362      *
2363      */
2364     virtual DOMString getInputEncoding() = 0;
2367     /**
2368      *
2369      */
2370     virtual DOMString getXmlEncoding() = 0;
2372     /**
2373      *
2374      */
2375     virtual bool getXmlStandalone() = 0;
2377     /**
2378      *
2379      */
2380     virtual void setXmlStandalone(bool val) throw (DOMException) = 0;
2382     /**
2383      *
2384      */
2385     virtual DOMString getXmlVersion() = 0;
2387     /**
2388      *
2389      */
2390     virtual void setXmlVersion(const DOMString &version)
2391                                    throw (DOMException) = 0;
2393     /**
2394      *
2395      */
2396     virtual bool getStrictErrorChecking() = 0;
2398     /**
2399      *
2400      */
2401     virtual void setStrictErrorChecking(bool val) = 0;
2404     /**
2405      *
2406      */
2407     virtual DOMString getDocumentURI() = 0;
2409     /**
2410      *
2411      */
2412     virtual void setDocumentURI(const DOMString &uri) = 0;
2414     /**
2415      *
2416      */
2417     virtual NodePtr adoptNode(const NodePtr source) throw (DOMException) = 0;
2419     /**
2420      *
2421      */
2422     virtual DOMConfiguration *getDomConfig() = 0;
2424     /**
2425      *
2426      */
2427     virtual void normalizeDocument() = 0;
2429     /**
2430      *
2431      */
2432     virtual NodePtr renameNode(const NodePtr n,
2433                                const DOMString &namespaceURI,
2434                                const DOMString &qualifiedName)
2435                                throw (DOMException) = 0;
2438     //##################
2439     //# Non-API methods
2440     //##################
2442     /**
2443      *
2444      */
2445     virtual ~Document() {}
2447 };
2456 }  //namespace dom
2457 }  //namespace w3c
2458 }  //namespace org
2461 #endif // __DOM_H__
2464 /*#########################################################################
2465 ## E N D    O F    F I L E
2466 #########################################################################*/