Code

more unreffing temporary styles properly
[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  * Authors:
13  *   Bob Jamison
14  *
15  * Copyright (C) 2006 Bob Jamison
16  *
17  *  This library is free software; you can redistribute it and/or
18  *  modify it under the terms of the GNU Lesser General Public
19  *  License as published by the Free Software Foundation; either
20  *  version 2.1 of the License, or (at your option) any later version.
21  *
22  *  This library is distributed in the hope that it will be useful,
23  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  *  Lesser General Public License for more details.
26  *
27  *  You should have received a copy of the GNU Lesser General Public
28  *  License along with this library; if not, write to the Free Software
29  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30  */
32 #include <vector>
34 //# include this before the #ifdefs below
35 #include "domconfig.h"
37 #ifdef DOM_STRING_OWN
38 #include "domstring.h"
39 #else
40 #ifdef DOM_STRING_GLIBMM
41 #include <glibmm.h>
42 #else
43 #include <string>
44 #endif
45 #endif
47 //# Unfortunate hack for a name collision
48 #ifdef SEVERITY_ERROR
49 #undef SEVERITY_ERROR
50 #endif
52 #define XMLNSNAME "http://www.w3.org/2000/xmlns/"
54 namespace org
55 {
56 namespace w3c
57 {
58 namespace dom
59 {
63 #ifdef DOM_STRING_OWN
64 #else
65 #ifdef DOM_STRING_GLIBMM
66 typedef Glib::ustring DOMString;
67 typedef gunichar XMLCh;
68 #else
69 typedef std::string DOMString;
70 typedef unsigned short XMLCh;
71 #endif
72 #endif
75 /**
76  *
77  */
78 typedef unsigned long long DOMTimeStamp;
80 /**
81  *
82  */
83 typedef void DOMUserData;
85 /*#########################################################################
86 ## NodePtr
87 #########################################################################*/
89 /**
90  * A simple Smart Pointer class that handles Nodes and all of its
91  * descendants 
92  */ 
93 template<class T> class Ptr
94 {
95 public:
97     /**
98      * Simple constructor
99      */ 
100     Ptr()
101         { _ref = 0; }
103     /**
104      * Constructor upon a reference
105      */ 
106     template<class Y> Ptr(const Ptr<Y> &other)
107         {
108         _ref = other._ref;
109             incrementRefCount(_ref);
110         }
112     /**
113      * Constructor upon a reference
114      */ 
115     Ptr(T * refArg, bool addRef = true)
116         {
117         _ref = refArg;
118         if(addRef)
119                     incrementRefCount(_ref);
120         }
123     /**
124      * Copy constructor
125      */ 
126     Ptr(const Ptr &other)
127         {
128         _ref = other._ref;
129             incrementRefCount(_ref);
130         }
132     /**
133      * Destructor
134      */ 
135     ~Ptr()
136         {
137             decrementRefCount(_ref);
138         }
141     /**
142      * Assignment operator
143      */ 
144     template<class Y> Ptr &operator=(const Ptr<Y> &other)
145         {
146         decrementRefCount(_ref);
147         _ref = other._ref;
148         incrementRefCount(_ref);
149         return *this;
150         }
152     /**
153      * Assignment operator
154      */ 
155     Ptr &operator=(const Ptr &other)
156         {
157         decrementRefCount(_ref);
158         _ref = other._ref;
159         incrementRefCount(_ref);
160         return *this;
161         }
163     /**
164      * Assignment operator
165      */ 
166     template<class Y> Ptr &operator=(Y * ref)
167         {
168         decrementRefCount(_ref);
169         _ref = ref;
170         incrementRefCount(_ref);
171         return *this;
172         }
174     /**
175      * Assignment operator
176      */ 
177     template<class Y> Ptr &operator=(const Y * ref)
178         {
179         decrementRefCount(_ref);
180         _ref = (Y *) ref;
181         incrementRefCount(_ref);
182         return *this;
183         }
185     /**
186      * Return the reference
187      */ 
188     T * get() const
189         {
190         return _ref;
191         }
193     /**
194      * Dereference operator
195      */ 
196     T &operator*() const
197         {
198         return *_ref;
199         }
201     /**
202      * Point-to operator
203      */ 
204     T *operator->() const
205         {
206         return _ref;
207         }
209     /**
210      * NOT bool operator.  How to check if we are null without a comparison
211      */      
212     bool operator! () const
213         {
214         return (_ref == 0);
215         }
217     /**
218      * Swap what I reference with the other guy
219      */      
220     void swap(Ptr &other)
221         {
222         T *tmp = _ref;
223         _ref = other._ref;
224         other._ref = tmp;
225         }
227     //The referenced item
228     T *_ref;
229 };
232 /**
233  * Global definitions.  Many of these are used to mimic behaviour of
234  * a real pointer 
235  */
237 /**
238  * Equality
239  */ 
240 template<class T, class U> inline bool
241    operator==(const Ptr<T> &a, const Ptr<U> &b)
243     return a.get() == b.get();
246 /**
247  * Inequality
248  */ 
249 template<class T, class U> inline bool
250      operator!=(const Ptr<T> &a, const Ptr<U> &b)
252     return a.get() != b.get();
255 /**
256  * Equality
257  */ 
258 template<class T> inline bool
259      operator==(const Ptr<T> &a, T * b)
261     return a.get() == b;
264 /**
265  * Inequality
266  */ 
267 template<class T> inline bool
268      operator!=(const Ptr<T> &a, T * b)
270     return a.get() != b;
273 /**
274  * Equality
275  */ 
276 template<class T> inline bool
277      operator==(T * a, const Ptr<T> &b)
279     return a == b.get();
282 /**
283  * Inequality
284  */ 
285 template<class T> inline bool
286      operator!=(T * a, const Ptr<T> &b)
288     return a != b.get();
292 /**
293  * Less than
294  */ 
295 template<class T> inline bool
296      operator<(const Ptr<T> &a, const Ptr<T> &b)
298     return std::less<T *>()(a.get(), b.get());
301 /**
302  * Swap
303  */ 
304 template<class T> void
305      swap(Ptr<T> &a, Ptr<T> &b)
307     a.swap(b);
311 /**
312  * Get the pointer globally, for <algo>
313  */ 
314 template<class T> T * 
315     get_pointer(const Ptr<T> &p)
317     return p.get();
320 /**
321  * Static cast
322  */ 
323 template<class T, class U> Ptr<T>
324      static_pointer_cast(const Ptr<U> &p)
326     return static_cast<T *>(p.get());
329 /**
330  * Const cast
331  */ 
332 template<class T, class U> Ptr<T>
333      const_pointer_cast(const Ptr<U> &p)
335     return const_cast<T *>(p.get());
338 /**
339  * Dynamic cast
340  */ 
341 template<class T, class U> Ptr<T>
342      dynamic_pointer_cast(const Ptr<U> &p)
344     return dynamic_cast<T *>(p.get());
348 /**
349  *
350  */
351 typedef void DOMObject;
354 class NodeList;
355 class NamedNodeMap;
356 class DOMException;
357 class DOMStringList;
358 class NameList;
359 class DOMImplementationList;
360 class DOMImplementationSource;
361 class DOMImplementation;
362 class TypeInfo;
363 class UserDataHandler;
364 class DOMError;
365 class DOMErrorHandler;
366 class DOMLocator;
367 class DOMConfiguration;
369 class Node;
370 typedef Ptr<Node> NodePtr;
371 class CharacterData;
372 typedef Ptr<CharacterData> CharacterDataPtr;
373 class Attr;
374 typedef Ptr<Attr> AttrPtr;
375 class Element;
376 typedef Ptr<Element> ElementPtr;
377 class Text;
378 typedef Ptr<Text> TextPtr;
379 class Comment;
380 typedef Ptr<Comment> CommentPtr;
381 class DocumentType;
382 typedef Ptr<DocumentType> DocumentTypePtr;
383 class CDATASection;
384 typedef Ptr<CDATASection> CDATASectionPtr;
385 class Notation;
386 typedef Ptr<Notation> NotationPtr;
387 class Entity;
388 typedef Ptr<Entity> EntityPtr;
389 class EntityReference;
390 typedef Ptr<EntityReference> EntityReferencePtr;
391 class ProcessingInstruction;
392 typedef Ptr<ProcessingInstruction> ProcessingInstructionPtr;
393 class DocumentFragment;
394 typedef Ptr<DocumentFragment> DocumentFragmentPtr;
395 class Document;
396 typedef Ptr<Document> DocumentPtr;
401 /**
402  * NOTE: We were originally intending to split ALL specifications into
403  * interface and implementation.   After consideration, though, it behooves
404  * us to simplify things by implementing the base exception and
405  * container classes directly:
406  *
407  * DOMException
408  * DOMStringList
409  * NameList
410  * DOMImplementationList
411  * DOMImplementationSource
412  * DOMImplementation
413  * NodeList
414  * NamedNodeMap
415  */
418 /*#########################################################################
419 ## DOMException
420 #########################################################################*/
421 /**
422  *  This is the only non-interface class
423  */
424 class DOMException
427 public:
429     /**
430      * ExceptionCode
431      */
432     typedef enum
433         {
434         INDEX_SIZE_ERR                 = 1,
435         DOMSTRING_SIZE_ERR             = 2,
436         HIERARCHY_REQUEST_ERR          = 3,
437         WRONG_DOCUMENT_ERR             = 4,
438         INVALID_CHARACTER_ERR          = 5,
439         NO_DATA_ALLOWED_ERR            = 6,
440         NO_MODIFICATION_ALLOWED_ERR    = 7,
441         NOT_FOUND_ERR                  = 8,
442         NOT_SUPPORTED_ERR              = 9,
443         INUSE_ATTRIBUTE_ERR            = 10,
444         INVALID_STATE_ERR              = 11,
445         SYNTAX_ERR                     = 12,
446         INVALID_MODIFICATION_ERR       = 13,
447         NAMESPACE_ERR                  = 14,
448         INVALID_ACCESS_ERR             = 15,
449         VALIDATION_ERR                 = 16,
450         TYPE_MISMATCH_ERR              = 17
451         } ExceptionCode;
455     DOMException(const DOMString &reasonMsg)
456         { msg = reasonMsg; }
458     DOMException(short theCode)
459         {
460         code = theCode;
461         }
463     virtual ~DOMException() throw()
464        {}
466     /**
467      *
468      */
469     unsigned short code;
471     /**
472      *
473      */
474     DOMString msg;
476     /**
477      * Get a string, translated from the code.
478      * Like std::exception. Not in spec.
479      */
480     const char *what()
481         { return (const char *)msg.c_str(); }
485 };
492 /*#########################################################################
493 ## DOMStringList
494 #########################################################################*/
496 class DOMStringList
498 public:
500     /**
501      *
502      */
503     virtual DOMString item(unsigned long index)
504         {
505         if (index>=strings.size())
506             return "";
507         return strings[index];
508         }
510     /**
511      *
512      */
513     virtual unsigned long getLength()
514         {
515         return (unsigned long) strings.size();
516         }
518     /**
519      *
520      */
521     virtual bool contains(const DOMString &str)
522         {
523         for (unsigned int i=0; i<strings.size() ; i++)
524             {
525             if (strings[i] == str)
526                 return true;
527             }
528         return false;
529         }
532     //##################
533     //# Non-API methods
534     //##################
536     /**
537      *
538      */
539     DOMStringList() {}
542     /**
543      *
544      */
545     DOMStringList(const DOMStringList &other)
546         {
547         strings = other.strings;
548         }
550     /**
551      *
552      */
553     DOMStringList &operator=(const DOMStringList &other)
554         {
555         strings = other.strings;
556         return *this;
557         }
559     /**
560      *
561      */
562     virtual ~DOMStringList() {}
565 protected:
567     /**
568      *
569      */
570     virtual void add(const DOMString &str)
571         {
572         strings.push_back(str);
573         }
575     std::vector<DOMString>strings;
577 };
581 /*#########################################################################
582 ## NameList
583 #########################################################################*/
584 class NamePair
586 public:
587     NamePair(const DOMString &theNamespaceURI, const DOMString &theName)
588         {
589         namespaceURI = theNamespaceURI;
590         name         = theName;
591         }
592     NamePair(const NamePair &other)
593         {
594         namespaceURI = other.namespaceURI;
595         name         = other.name;
596         }
597     NamePair &operator=(const NamePair &other)
598         {
599         namespaceURI = other.namespaceURI;
600         name         = other.name;
601         return *this;
602         }
603     virtual ~NamePair() {}
605     DOMString namespaceURI;
606     DOMString name;
607 };
611 class NameList
613 public:
615     /**
616      *
617      */
618     virtual DOMString getName(unsigned long index)
619         {
620         if (index>=namePairs.size())
621             return "";
622         return namePairs[index].name;
623         }
625     /**
626      *
627      */
628     virtual DOMString getNamespaceURI(unsigned long index)
629         {
630         if (index>=namePairs.size())
631             return "";
632         return namePairs[index].namespaceURI;
633         }
635     /**
636      *
637      */
638     virtual unsigned long getLength()
639         {
640         return (unsigned long)namePairs.size();
641         }
643     /**
644      *
645      */
646     virtual bool contains(const DOMString &name)
647         {
648         for (unsigned int i=0; i<namePairs.size() ; i++)
649             {
650             if (namePairs[i].name == name )
651                 return true;
652             }
653         return false;
654         }
656     /**
657      *
658      */
659     virtual bool containsNS(const DOMString namespaceURI,const DOMString &name)
660         {
661         for (unsigned int i=0; i<namePairs.size() ; i++)
662             {
663             if (namePairs[i].namespaceURI == namespaceURI ||
664                 namePairs[i].name         == name           )
665                 return true;
666             }
667         return false;
668         }
671     //##################
672     //# Non-API methods
673     //##################
675     /**
676      *
677      */
678     NameList() {}
680     /**
681      *
682      */
683     NameList(const NameList &other)
684         {
685         namePairs = other.namePairs;
686         }
688     /**
689      *
690      */
691     NameList &operator=(const NameList &other)
692         {
693         namePairs = other.namePairs;
694         return *this;
695         }
697     /**
698      *
699      */
700     virtual ~NameList() {}
701 protected:
703     std::vector<NamePair> namePairs;
705 };
707 /*#########################################################################
708 ## DOMImplementationList
709 #########################################################################*/
711 class DOMImplementationList
713 public:
715     /**
716      *
717      */
718     virtual DOMImplementation *item(unsigned long index)
719         {
720         if (index >implementations.size())
721             return NULL;
722         return implementations[index];
723         }
725     /**
726      *
727      */
728     virtual unsigned long getLength()
729         {
730         return (unsigned long) implementations.size();
731         }
736     //##################
737     //# Non-API methods
738     //##################
740     /**
741      *
742      */
743     DOMImplementationList() {}
746     /**
747      *
748      */
749     DOMImplementationList(const DOMImplementationList &other)
750         {
751         implementations = other.implementations;
752         }
754     /**
755      *
756      */
757     DOMImplementationList &operator=(const DOMImplementationList &other)
758         {
759         implementations = other.implementations;
760         return *this;
761         }
763     /**
764      *
765      */
766     virtual ~DOMImplementationList() {}
768 protected:
770     std::vector<DOMImplementation *>implementations;
772 };
775 /*#########################################################################
776 ## DOMImplementationSource
777 #########################################################################*/
779 class DOMImplementationSource
781 public:
783     /**
784      *
785      */
786     virtual DOMImplementation *getDOMImplementation(const DOMString &features) = 0;
788     /**
789      *
790      */
791     virtual DOMImplementationList getDOMImplementationList(const DOMString &features) = 0;
793     //##################
794     //# Non-API methods
795     //##################
797     /**
798      *
799      */
800     virtual ~DOMImplementationSource() {}
802 };
808 /*#########################################################################
809 ## DOMImplementation
810 #########################################################################*/
811 /**
812  *
813  */
814 class DOMImplementation
816 public:
817     /**
818      *
819      */
820     virtual bool hasFeature(const DOMString& feature, const DOMString& version) = 0;
823     /**
824      *
825      */
826     virtual DocumentTypePtr createDocumentType(
827                                        const DOMString& qualifiedName,
828                                    const DOMString& publicId,
829                                    const DOMString& systemId)
830                                    throw(DOMException) = 0;
832     /**
833      *
834      */
835     virtual DocumentPtr createDocument(const DOMString& namespaceURI,
836                              const DOMString& qualifiedName,
837                              DocumentTypePtr doctype)
838                              throw(DOMException) = 0;
839     /**
840      *
841      */
842     virtual DOMObject *getFeature(const DOMString& feature,
843                              const DOMString& version) = 0;
846     //##################
847     //# Non-API methods
848     //##################
850     /**
851      *
852      */
853     virtual ~DOMImplementation() {}
855 };
861 /*#########################################################################
862 ## Node
863 #########################################################################*/
865 /**
866  *  The basic Node class, which is the root of most other
867  *  classes in DOM.
868  */
869 class Node
871 public:
873     typedef enum
874         {
875         ELEMENT_NODE                   = 1,
876         ATTRIBUTE_NODE                 = 2,
877         TEXT_NODE                      = 3,
878         CDATA_SECTION_NODE             = 4,
879         ENTITY_REFERENCE_NODE          = 5,
880         ENTITY_NODE                    = 6,
881         PROCESSING_INSTRUCTION_NODE    = 7,
882         COMMENT_NODE                   = 8,
883         DOCUMENT_NODE                  = 9,
884         DOCUMENT_TYPE_NODE             = 10,
885         DOCUMENT_FRAGMENT_NODE         = 11,
886         NOTATION_NODE                  = 12
887         } NodeType;
889     /**
890      *
891      */
892     virtual DOMString getNodeName() = 0;
894     /**
895      *
896      */
897     virtual DOMString getNodeValue() throw (DOMException) = 0;
899     /**
900      *
901      */
902     virtual void setNodeValue(const DOMString& val) throw (DOMException) = 0;
904     /**
905      *
906      */
907     virtual unsigned short getNodeType() = 0;
909     /**
910      *
911      */
912     virtual NodePtr getParentNode() = 0;
914     /**
915      *
916      */
917     virtual NodeList getChildNodes() = 0;
919     /**
920      *
921      */
922     virtual NodePtr getFirstChild() = 0;
924     /**
925      *
926      */
927     virtual NodePtr getLastChild() = 0;
929     /**
930      *
931      */
932     virtual NodePtr getPreviousSibling() = 0;
934     /**
935      *
936      */
937     virtual NodePtr getNextSibling() = 0;
939     /**
940      *
941      */
942     virtual NamedNodeMap &getAttributes() = 0;
945     /**
946      *
947      */
948     virtual DocumentPtr getOwnerDocument() = 0;
950     /**
951      *
952      */
953     virtual NodePtr insertBefore(const NodePtr newChild,
954                        const NodePtr refChild)
955                        throw(DOMException) = 0;
957     /**
958      *
959      */
960     virtual NodePtr replaceChild(const NodePtr newChild,
961                        const NodePtr oldChild)
962                        throw(DOMException) = 0;
964     /**
965      *
966      */
967     virtual NodePtr removeChild(const NodePtr oldChild)
968                       throw(DOMException) = 0;
970     /**
971      *
972      */
973     virtual NodePtr appendChild(const NodePtr newChild)
974                       throw(DOMException) = 0;
976     /**
977      *
978      */
979     virtual bool hasChildNodes() = 0;
981     /**
982      *
983      */
984     virtual NodePtr cloneNode(bool deep) = 0;
986     /**
987      *
988      */
989     virtual void normalize() = 0;
991     /**
992      *
993      */
994     virtual bool isSupported(const DOMString& feature,
995                      const DOMString& version) = 0;
997     /**
998      *
999      */
1000     virtual DOMString getNamespaceURI() = 0;
1002     /**
1003      *
1004      */
1005     virtual DOMString getPrefix() = 0;
1007     /**
1008      *
1009      */
1010     virtual void setPrefix(const DOMString& val) throw(DOMException) = 0;
1012     /**
1013      *
1014      */
1015     virtual DOMString getLocalName() = 0;
1017     /**
1018      *
1019      */
1020     virtual bool hasAttributes() = 0;
1022     /**
1023      *
1024      */
1025     virtual DOMString getBaseURI() = 0;
1027     typedef enum
1028         {
1029         DOCUMENT_POSITION_DISCONNECTED            = 0x01,
1030         DOCUMENT_POSITION_PRECEDING               = 0x02,
1031         DOCUMENT_POSITION_FOLLOWING               = 0x04,
1032         DOCUMENT_POSITION_CONTAINS                = 0x08,
1033         DOCUMENT_POSITION_CONTAINED_BY            = 0x10,
1034         DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
1035         } DocumentPosition;
1038     /**
1039      *
1040      */
1041     virtual unsigned short compareDocumentPosition(
1042                                  const NodePtr other) = 0;
1044     /**
1045      *
1046      */
1047     virtual DOMString getTextContent() throw(DOMException) = 0;
1050     /**
1051      *
1052      */
1053     virtual void setTextContent(const DOMString &val) throw(DOMException) = 0;
1056     /**
1057      *
1058      */
1059     virtual DOMString lookupPrefix(const DOMString &namespaceURI) =0;
1062     /**
1063      *
1064      */
1065     virtual bool isDefaultNamespace(const DOMString &namespaceURI) =0;
1068     /**
1069      *
1070      */
1071     virtual DOMString lookupNamespaceURI(const DOMString &prefix) =0;
1074     /**
1075      *
1076      */
1077     virtual bool isEqualNode(const NodePtr node) =0;
1081     /**
1082      *
1083      */
1084     virtual DOMObject *getFeature(const DOMString &feature,
1085                                  const DOMString &version) =0;
1087     /**
1088      *
1089      */
1090     virtual DOMUserData *setUserData(const DOMString &key,
1091                                      const DOMUserData *data,
1092                                      const UserDataHandler *handler) =0;
1095     /**
1096      *
1097      */
1098     virtual DOMUserData *getUserData(const DOMString &namespaceURI) =0;
1100     //##################
1101     //# Non-API methods
1102     //##################
1104     /**
1105      *
1106      */
1107     Node() : _refCnt(0)
1108         {}
1110     /**
1111      *
1112      */
1113     virtual ~Node() {}
1115 protected:
1117     friend void incrementRefCount(Node *p);
1118     friend void decrementRefCount(Node *p);
1119  
1120     /**
1121      * For the Ptr smart pointer
1122      */      
1123     int _refCnt;
1125 };
1130 /*#########################################################################
1131 ## NodeList
1132 #########################################################################*/
1134 /**
1135  *
1136  */
1137 class NodeList
1139 public:
1140     /**
1141      *
1142      */
1143     virtual NodePtr item(unsigned long index)
1144         {
1145         if (index>=nodes.size())
1146             return NULL;
1147         return nodes[index];
1148         }
1150     /**
1151      *
1152      */
1153     virtual unsigned long getLength()
1154         {
1155         return (unsigned long) nodes.size();
1156         }
1158     //##################
1159     //# Non-API methods
1160     //##################
1163     /**
1164      *
1165      */
1166     NodeList() {}
1168     /**
1169      *
1170      */
1171     NodeList(const NodeList &other)
1172         {
1173         nodes = other.nodes;
1174         }
1176     /**
1177      *
1178      */
1179     NodeList &operator=(const NodeList &other)
1180         {
1181         nodes = other.nodes;
1182         return *this;
1183         }
1185     /**
1186      *
1187      */
1188     virtual ~NodeList() {}
1190     /**
1191      *
1192      */
1193     virtual void clear()
1194         {
1195         nodes.clear();
1196         }
1198 protected:
1200 friend class NodeImpl;
1201 friend class ElementImpl;
1203     /*
1204      *
1205      */
1206     virtual void add(const NodePtr node)
1207         {
1208         nodes.push_back(node);
1209         }
1211 protected:
1213     std::vector<NodePtr> nodes;
1215 };
1220 /*#########################################################################
1221 ## NamedNodeMap
1222 #########################################################################*/
1224 class NamedNodeMapEntry
1226 public:
1227     NamedNodeMapEntry(const DOMString &theNamespaceURI,
1228                       const DOMString &theName,
1229                       const NodePtr   theNode)
1230         {
1231         namespaceURI = theNamespaceURI;
1232         name         = theName;
1233         node         = theNode;
1234         }
1235     NamedNodeMapEntry(const NamedNodeMapEntry &other)
1236         {
1237         assign(other);
1238         }
1239     NamedNodeMapEntry &operator=(const NamedNodeMapEntry &other)
1240         {
1241         assign(other);
1242         return *this;
1243         }
1244     virtual ~NamedNodeMapEntry()
1245         {
1246         }
1247     void assign(const NamedNodeMapEntry &other)
1248         {
1249         namespaceURI = other.namespaceURI;
1250         name         = other.name;
1251         node         = other.node;
1252         }
1253     DOMString namespaceURI;
1254     DOMString name;
1255     NodePtr   node;
1256 };
1258 /**
1259  *
1260  */
1261 class NamedNodeMap
1263 public:
1265     /**
1266      *
1267      */
1268     virtual NodePtr getNamedItem(const DOMString& name)
1269         {
1270         std::vector<NamedNodeMapEntry>::iterator iter;
1271         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1272             {
1273             if (iter->name == name)
1274                 {
1275                 NodePtr node = iter->node;
1276                 return node;
1277                 }
1278             }
1279         return NULL;
1280         }
1282     /**
1283      *
1284      */
1285     virtual NodePtr setNamedItem(NodePtr arg) throw(DOMException)
1286         {
1287         if (!arg)
1288             return NULL;
1289         DOMString namespaceURI = arg->getNamespaceURI();
1290         DOMString name         = arg->getNodeName();
1291         std::vector<NamedNodeMapEntry>::iterator iter;
1292         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1293             {
1294             if (iter->name == name)
1295                 {
1296                 NodePtr node = iter->node;
1297                 iter->node = arg;
1298                 return node;
1299                 }
1300             }
1301         NamedNodeMapEntry entry(namespaceURI, name, arg);
1302         entries.push_back(entry);
1303         return arg;
1304         }
1307     /**
1308      *
1309      */
1310     virtual NodePtr removeNamedItem(const DOMString& name) throw(DOMException)
1311         {
1312         std::vector<NamedNodeMapEntry>::iterator iter;
1313         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1314             {
1315             if (iter->name == name)
1316                 {
1317                 NodePtr node = iter->node;
1318                 entries.erase(iter);
1319                 return node;
1320                 }
1321             }
1322         return NULL;
1323         }
1325     /**
1326      *
1327      */
1328     virtual NodePtr item(unsigned long index)
1329         {
1330         if (index>=entries.size())
1331             return NULL;
1332         return entries[index].node;
1333         }
1335     /**
1336      *
1337      */
1338     virtual unsigned long getLength()
1339         {
1340         return (unsigned long)entries.size();
1341         }
1343     /**
1344      *
1345      */
1346     virtual NodePtr getNamedItemNS(const DOMString& namespaceURI,
1347                                  const DOMString& localName)
1348         {
1349         std::vector<NamedNodeMapEntry>::iterator iter;
1350         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1351             {
1352             if (iter->namespaceURI == namespaceURI && iter->name == localName)
1353                 {
1354                 NodePtr node = iter->node;
1355                 return node;
1356                 }
1357             }
1358         return NULL;
1359         }
1361     /**
1362      *
1363      */
1364     virtual NodePtr setNamedItemNS(NodePtr arg) throw(DOMException)
1365         {
1366         if (!arg)
1367             return NULL;
1368         DOMString namespaceURI = arg->getNamespaceURI();
1369         DOMString name         = arg->getNodeName();
1370         std::vector<NamedNodeMapEntry>::iterator iter;
1371         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1372             {
1373             if (iter->namespaceURI == namespaceURI && iter->name == name)
1374                 {
1375                 NodePtr node = iter->node;
1376                 iter->node = arg;
1377                 return node;
1378                 }
1379             }
1380         NamedNodeMapEntry entry(namespaceURI, name, arg);
1381         entries.push_back(entry);
1382         return arg;
1383         }
1385     /**
1386      *
1387      */
1388     virtual NodePtr removeNamedItemNS(const DOMString& namespaceURI,
1389                                     const DOMString& localName)
1390                                     throw(DOMException)
1391         {
1392         std::vector<NamedNodeMapEntry>::iterator iter;
1393         for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1394             {
1395             if (iter->namespaceURI == namespaceURI && iter->name == localName)
1396                 {
1397                 NodePtr node = iter->node;
1398                 entries.erase(iter);
1399                 return node;
1400                 }
1401             }
1402         return NULL;
1403         }
1405     //##################
1406     //# Non-API methods
1407     //##################
1409     /**
1410      *
1411      */
1412     NamedNodeMap() {}
1415     /**
1416      *
1417      */
1418     NamedNodeMap(const NamedNodeMap &other)
1419         {
1420         entries = other.entries;
1421         }
1423     /**
1424      *
1425      */
1426     NamedNodeMap &operator=(const NamedNodeMap &other)
1427         {
1428         entries = other.entries;
1429         return *this;
1430         }
1433     /**
1434      *
1435      */
1436     virtual ~NamedNodeMap() {}
1438 protected:
1440     std::vector<NamedNodeMapEntry> entries;
1442 };
1447 /*#########################################################################
1448 ## CharacterData
1449 #########################################################################*/
1451 /**
1452  *
1453  */
1454 class CharacterData : virtual public Node
1456 public:
1458     /**
1459      *
1460      */
1461     virtual DOMString getData() throw(DOMException) = 0;
1463     /**
1464      *
1465      */
1466     virtual void setData(const DOMString& val) throw(DOMException) = 0;
1468     /**
1469      *
1470      */
1471     virtual unsigned long getLength() = 0;
1473     /**
1474      *
1475      */
1476     virtual DOMString substringData(unsigned long offset,
1477                             unsigned long count)
1478                             throw(DOMException) = 0;
1480     /**
1481      *
1482      */
1483     virtual void appendData(const DOMString& arg) throw(DOMException) = 0;
1485     /**
1486      *
1487      */
1488     virtual void insertData(unsigned long offset,
1489                     const DOMString& arg)
1490                     throw(DOMException) = 0;
1492     /**
1493      *
1494      */
1495     virtual void deleteData(unsigned long offset,
1496                     unsigned long count)
1497                     throw(DOMException) = 0;
1499     /**
1500      *
1501      */
1502     virtual void  replaceData(unsigned long offset,
1503                       unsigned long count,
1504                       const DOMString& arg)
1505                       throw(DOMException) = 0;
1508     //##################
1509     //# Non-API methods
1510     //##################
1513     /**
1514      *
1515      */
1516     virtual ~CharacterData() {}
1518 };
1521 typedef Ptr<CharacterData> CharacterDataPtr;
1526 /*#########################################################################
1527 ## Attr
1528 #########################################################################*/
1530 /**
1531  *
1532  */
1533 class Attr : virtual public Node
1535 public:
1537     /**
1538      *
1539      */
1540     virtual DOMString getName() = 0;
1542     /**
1543      *
1544      */
1545     virtual bool getSpecified() = 0;
1547     /**
1548      *
1549      */
1550     virtual DOMString getValue() = 0;
1552     /**
1553      *
1554      */
1555     virtual void setValue(const DOMString& val) throw(DOMException) = 0;
1557     /**
1558      *
1559      */
1560     virtual ElementPtr getOwnerElement() = 0;
1563     /**
1564      *
1565      */
1566     virtual TypeInfo &getSchemaTypeInfo() = 0;
1569     /**
1570      *
1571      */
1572     virtual bool getIsId() = 0;
1574     //##################
1575     //# Non-API methods
1576     //##################
1579     /**
1580      *
1581      */
1582     virtual ~Attr() {}
1584 };
1590 /*#########################################################################
1591 ## Element
1592 #########################################################################*/
1594 /**
1595  *
1596  */
1597 class Element : virtual public Node
1599 public:
1602     /**
1603      *
1604      */
1605     virtual DOMString getTagName() = 0;
1607     /**
1608      *
1609      */
1610     virtual DOMString getAttribute(const DOMString& name) = 0;
1612     /**
1613      *
1614      */
1615     virtual void setAttribute(const DOMString& name,
1616                       const DOMString& value)
1617                       throw(DOMException) = 0;
1619     /**
1620      *
1621      */
1622     virtual void removeAttribute(const DOMString& name)
1623                          throw(DOMException) = 0;
1625     /**
1626      *
1627      */
1628     virtual AttrPtr getAttributeNode(const DOMString& name) = 0;
1630     /**
1631      *
1632      */
1633     virtual AttrPtr setAttributeNode(AttrPtr newAttr)
1634                           throw(DOMException) = 0;
1636     /**
1637      *
1638      */
1639     virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
1640                              throw(DOMException) = 0;
1642     /**
1643      *
1644      */
1645     virtual NodeList getElementsByTagName(const DOMString& name) = 0;
1647     /**
1648      *
1649      */
1650     virtual DOMString getAttributeNS(const DOMString& namespaceURI,
1651                              const DOMString& localName) = 0;
1653     /**
1654      *
1655      */
1656     virtual void setAttributeNS(const DOMString& namespaceURI,
1657                         const DOMString& qualifiedName,
1658                         const DOMString& value)
1659                         throw(DOMException) = 0;
1661     /**
1662      *
1663      */
1664     virtual void removeAttributeNS(const DOMString& namespaceURI,
1665                            const DOMString& localName)
1666                            throw(DOMException) = 0;
1668     /**
1669      *
1670      */
1671     virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
1672                             const DOMString& localName) = 0;
1674     /**
1675      *
1676      */
1677     virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
1678                             throw(DOMException) = 0;
1680     /**
1681      *
1682      */
1683     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1684                                     const DOMString& localName) = 0;
1686     /**
1687      *
1688      */
1689     virtual bool hasAttribute(const DOMString& name) = 0;
1691     /**
1692      *
1693      */
1694     virtual bool hasAttributeNS(const DOMString& namespaceURI,
1695                         const DOMString& localName) = 0;
1697     /**
1698      *
1699      */
1700     virtual TypeInfo &getSchemaTypeInfo() = 0;
1703     /**
1704      *
1705      */
1706     virtual void setIdAttribute(const DOMString &name,
1707                                 bool isId) throw (DOMException) = 0;
1709     /**
1710      *
1711      */
1712     virtual void setIdAttributeNS(const DOMString &namespaceURI,
1713                                   const DOMString &localName,
1714                                   bool isId) throw (DOMException) = 0;
1716     /**
1717      *
1718      */
1719     virtual void setIdAttributeNode(const AttrPtr idAttr,
1720                                     bool isId) throw (DOMException) = 0;
1722     //##################
1723     //# Non-API methods
1724     //##################
1726     /**
1727      *
1728      */
1729     virtual ~Element() {}
1731 };
1737 /*#########################################################################
1738 ## Text
1739 #########################################################################*/
1741 /**
1742  *
1743  */
1744 class Text : virtual public CharacterData
1746 public:
1748     /**
1749      *
1750      */
1751     virtual TextPtr splitText(unsigned long offset)
1752                     throw(DOMException) = 0;
1754     /**
1755      *
1756      */
1757     virtual bool getIsElementContentWhitespace()= 0;
1759     /**
1760      *
1761      */
1762     virtual DOMString getWholeText() = 0;
1765     /**
1766      *
1767      */
1768     virtual TextPtr replaceWholeText(const DOMString &content)
1769                                  throw(DOMException) = 0;
1771     //##################
1772     //# Non-API methods
1773     //##################
1776     /**
1777      *
1778      */
1779     virtual ~Text() {}
1781 };
1785 /*#########################################################################
1786 ## Comment
1787 #########################################################################*/
1789 /**
1790  *
1791  */
1792 class Comment : virtual public CharacterData
1794 public:
1796     //##################
1797     //# Non-API methods
1798     //##################
1801     /**
1802      *
1803      */
1804     virtual ~Comment() {}
1807 };
1811 /*#########################################################################
1812 ## TypeInfo
1813 #########################################################################*/
1815 /**
1816  *
1817  */
1818 class TypeInfo
1820 public:
1822     /**
1823      *
1824      */
1825     virtual DOMString getTypeName()
1826         { return typeName; }
1828     /**
1829      *
1830      */
1831     virtual DOMString getTypeNamespace()
1832         { return typeNameSpace; }
1834     typedef enum
1835         {
1836         DERIVATION_RESTRICTION = 0x00000001,
1837         DERIVATION_EXTENSION   = 0x00000002,
1838         DERIVATION_UNION       = 0x00000004,
1839         DERIVATION_LIST        = 0x00000008
1840         } DerivationMethod;
1843     /**
1844      *
1845      */
1846     virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1847                                const DOMString &typeNameArg,
1848                                DerivationMethod derivationMethod)
1849         { return false; }
1851     //##################
1852     //# Non-API methods
1853     //##################
1856     /**
1857      *
1858      */
1859     TypeInfo() 
1860             {}
1861             
1862     /**
1863      *
1864      */
1865     TypeInfo(const TypeInfo &other)
1866         { assign(other); }
1867         
1868     /**
1869      *
1870      */
1871     TypeInfo &operator=(const TypeInfo &other)
1872         { assign(other); return *this; }
1873         
1874     /**
1875      *
1876      */
1877     virtual ~TypeInfo() {}
1878     
1879 private:
1881     void assign(const TypeInfo &other)
1882         {
1883         typeName      = other.typeName;
1884         typeNameSpace = other.typeNameSpace;
1885         }
1887     DOMString typeName;
1888     DOMString typeNameSpace;
1889 };
1894 /*#########################################################################
1895 ## UserDataHandler
1896 #########################################################################*/
1898 /**
1899  *
1900  */
1901 class UserDataHandler
1903 public:
1905     typedef enum
1906         {
1907         NODE_CLONED     = 1,
1908         NODE_IMPORTED   = 2,
1909         NODE_DELETED    = 3,
1910         NODE_RENAMED    = 4,
1911         NODE_ADOPTED    = 5
1912         } OperationType;
1915     /**
1916      *
1917      */
1918     virtual  void handle(unsigned short operation,
1919                          const DOMString &key,
1920                          const DOMUserData *data,
1921                          const NodePtr src,
1922                          const NodePtr dst) =0;
1924     //##################
1925     //# Non-API methods
1926     //##################
1929     /**
1930      *
1931      */
1932     virtual ~UserDataHandler() {}
1934 };
1937 /*#########################################################################
1938 ## DOMError
1939 #########################################################################*/
1941 /**
1942  *
1943  */
1944 class DOMError
1946 public:
1948     typedef enum
1949         {
1950         SEVERITY_WARNING     = 1,
1951         SEVERITY_ERROR       = 2,
1952         SEVERITY_FATAL_ERROR = 3
1953         } ErrorSeverity;
1956     /**
1957      *
1958      */
1959     virtual unsigned short getSeverity() =0;
1961     /**
1962      *
1963      */
1964     virtual DOMString getMessage() =0;
1966     /**
1967      *
1968      */
1969     virtual DOMString getType() =0;
1971     /**
1972      *
1973      */
1974     virtual DOMObject *getRelatedException() =0;
1976     /**
1977      *
1978      */
1979     virtual DOMObject *getRelatedData() =0;
1981     /**
1982      *
1983      */
1984     virtual DOMLocator *getLocation() =0;
1987     //##################
1988     //# Non-API methods
1989     //##################
1992     /**
1993      *
1994      */
1995     virtual ~DOMError() {}
1997 };
2000 /*#########################################################################
2001 ## DOMErrorHandler
2002 #########################################################################*/
2004 /**
2005  *
2006  */
2007 class DOMErrorHandler
2009 public:
2010     /**
2011      *
2012      */
2013     virtual bool handleError(const DOMError *error) =0;
2015     //##################
2016     //# Non-API methods
2017     //##################
2020     /**
2021      *
2022      */
2023     virtual ~DOMErrorHandler() {}
2025 };
2029 /*#########################################################################
2030 ## DOMLocator
2031 #########################################################################*/
2033 /**
2034  *
2035  */
2036 class DOMLocator
2038 public:
2040     /**
2041      *
2042      */
2043     virtual long getLineNumber() =0;
2045     /**
2046      *
2047      */
2048     virtual long getColumnNumber() =0;
2050     /**
2051      *
2052      */
2053     virtual long getByteOffset() =0;
2055     /**
2056      *
2057      */
2058     virtual long getUtf16Offset() =0;
2061     /**
2062      *
2063      */
2064     virtual NodePtr getRelatedNode() =0;
2067     /**
2068      *
2069      */
2070     virtual DOMString getUri() =0;
2072     //##################
2073     //# Non-API methods
2074     //##################
2076     /**
2077      *
2078      */
2079     virtual ~DOMLocator() {}
2080 };
2083 /*#########################################################################
2084 ## DOMConfiguration
2085 #########################################################################*/
2087 /**
2088  *
2089  */
2090 class DOMConfiguration
2092 public:
2094     /**
2095      *
2096      */
2097     virtual void setParameter(const DOMString &name,
2098                               const DOMUserData *value)
2099                                                            throw (DOMException) =0;
2101     /**
2102      *
2103      */
2104     virtual DOMUserData *getParameter(const DOMString &name)
2105                                       throw (DOMException) =0;
2107     /**
2108      *
2109      */
2110     virtual bool canSetParameter(const DOMString &name,
2111                                  const DOMUserData *data) =0;
2113     /**
2114      *
2115      */
2116     virtual DOMStringList *getParameterNames() =0;
2118     //##################
2119     //# Non-API methods
2120     //##################
2123     /**
2124      *
2125      */
2126     virtual ~DOMConfiguration() {}
2128 };
2135 /*#########################################################################
2136 ## CDATASection
2137 #########################################################################*/
2138 /**
2139  *
2140  */
2141 class CDATASection : virtual public Text
2143 public:
2145     //##################
2146     //# Non-API methods
2147     //##################
2150     /**
2151      *
2152      */
2153     virtual ~CDATASection() {}
2155 };
2160 /*#########################################################################
2161 ## DocumentType
2162 #########################################################################*/
2164 /**
2165  *
2166  */
2167 class DocumentType : virtual public Node
2169 public:
2171     /**
2172      *
2173      */
2174     virtual DOMString getName() = 0;
2176     /**
2177      *
2178      */
2179     virtual NamedNodeMap getEntities() = 0;
2181     /**
2182      *
2183      */
2184     virtual NamedNodeMap getNotations() = 0;
2186     /**
2187      *
2188      */
2189     virtual DOMString getPublicId() = 0;
2191     /**
2192      *
2193      */
2194     virtual DOMString getSystemId() = 0;
2196     /**
2197      *
2198      */
2199     virtual DOMString getInternalSubset() = 0;
2201     //##################
2202     //# Non-API methods
2203     //##################
2205     /**
2206      *
2207      */
2208     virtual ~DocumentType() {}
2210 };
2216 /*#########################################################################
2217 ## Notation
2218 #########################################################################*/
2220 /**
2221  *
2222  */
2223 class Notation : virtual public Node
2225 public:
2227     /**
2228      *
2229      */
2230     virtual DOMString getPublicId() = 0;
2232     /**
2233      *
2234      */
2235     virtual DOMString getSystemId() = 0;
2237     //##################
2238     //# Non-API methods
2239     //##################
2242     /**
2243      *
2244      */
2245     virtual ~Notation() {}
2246 };
2253 /*#########################################################################
2254 ## Entity
2255 #########################################################################*/
2257 /**
2258  *
2259  */
2260 class Entity : virtual public Node
2262 public:
2264     /**
2265      *
2266      */
2267     virtual DOMString getPublicId() = 0;
2269     /**
2270      *
2271      */
2272     virtual DOMString getSystemId() = 0;
2274     /**
2275      *
2276      */
2277     virtual DOMString getNotationName() = 0;
2279     /**
2280      *
2281      */
2282     virtual DOMString getInputEncoding() = 0;
2284     /**
2285      *
2286      */
2287     virtual DOMString getXmlEncoding() = 0;
2289     /**
2290      *
2291      */
2292     virtual DOMString getXmlVersion() = 0;
2294     //##################
2295     //# Non-API methods
2296     //##################
2299     /**
2300      *
2301      */
2302     virtual ~Entity() {}
2303 };
2309 /*#########################################################################
2310 ## EntityReference
2311 #########################################################################*/
2312 /**
2313  *
2314  */
2315 class EntityReference : virtual public Node
2317 public:
2320     //##################
2321     //# Non-API methods
2322     //##################
2324     /**
2325      *
2326      */
2327     virtual ~EntityReference() {}
2328 };
2334 /*#########################################################################
2335 ## ProcessingInstruction
2336 #########################################################################*/
2338 /**
2339  *
2340  */
2341 class ProcessingInstruction : virtual public Node
2343 public:
2345     /**
2346      *
2347      */
2348     virtual DOMString getTarget() = 0;
2350     /**
2351      *
2352      */
2353     virtual DOMString getData() = 0;
2355     /**
2356      *
2357      */
2358    virtual void setData(const DOMString& val) throw(DOMException) = 0;
2360     //##################
2361     //# Non-API methods
2362     //##################
2365     /**
2366      *
2367      */
2368     virtual ~ProcessingInstruction() {}
2370 };
2376 /*#########################################################################
2377 ## DocumentFragment
2378 #########################################################################*/
2379 /**
2380  *
2381  */
2382 class DocumentFragment : virtual public Node
2384 public:
2386     //##################
2387     //# Non-API methods
2388     //##################
2391     /**
2392      *
2393      */
2394     virtual ~DocumentFragment() {}
2395 };
2402 /*#########################################################################
2403 ## Document
2404 #########################################################################*/
2406 /**
2407  *
2408  */
2409 class Document : virtual public Node
2411 public:
2413     /**
2414      *
2415      */
2416     virtual DocumentTypePtr getDoctype() = 0;
2418     /**
2419      *
2420      */
2421     virtual DOMImplementation *getImplementation() = 0;
2423     /**
2424      *
2425      */
2426     virtual ElementPtr getDocumentElement() = 0;
2428     /**
2429      *
2430      */
2431     virtual ElementPtr createElement(const DOMString& tagName)
2432                            throw(DOMException) = 0;
2434     /**
2435      *
2436      */
2437     virtual DocumentFragmentPtr createDocumentFragment() = 0;
2439     /**
2440      *
2441      */
2442     virtual TextPtr createTextNode(const DOMString& data) = 0;
2444     /**
2445      *
2446      */
2447     virtual CommentPtr createComment(const DOMString& data) = 0;
2449     /**
2450      *
2451      */
2452     virtual CDATASectionPtr createCDATASection(const DOMString& data)
2453                                      throw(DOMException) = 0;
2455     /**
2456      *
2457      */
2458     virtual ProcessingInstructionPtr
2459                    createProcessingInstruction(const DOMString& target,
2460                                            const DOMString& data)
2461                                            throw(DOMException) = 0;
2463     /**
2464      *
2465      */
2466     virtual AttrPtr createAttribute(const DOMString& name)
2467                           throw(DOMException) = 0;
2469     /**
2470      *
2471      */
2472     virtual EntityReferencePtr createEntityReference(const DOMString& name)
2473                                            throw(DOMException) = 0;
2475     /**
2476      *
2477      */
2478     virtual NodeList getElementsByTagName(const DOMString& tagname) = 0;
2481     /**
2482      *
2483      */
2484     virtual NodePtr importNode(const NodePtr importedNode,
2485                      bool deep)
2486                      throw(DOMException) = 0;
2488     /**
2489      *
2490      */
2491     virtual ElementPtr createElementNS(const DOMString& namespaceURI,
2492                              const DOMString& qualifiedName)
2493                              throw(DOMException) = 0;
2495     /**
2496      *
2497      */
2498     virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
2499                             const DOMString& qualifiedName)
2500                             throw(DOMException) = 0;
2502     /**
2503      *
2504      */
2505     virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
2506                                      const DOMString& localName) = 0;
2508     /**
2509      *
2510      */
2511     virtual ElementPtr getElementById(const DOMString& elementId) = 0;
2514     /**
2515      *
2516      */
2517     virtual DOMString getInputEncoding() = 0;
2520     /**
2521      *
2522      */
2523     virtual DOMString getXmlEncoding() = 0;
2525     /**
2526      *
2527      */
2528     virtual bool getXmlStandalone() = 0;
2530     /**
2531      *
2532      */
2533     virtual void setXmlStandalone(bool val) throw (DOMException) = 0;
2535     /**
2536      *
2537      */
2538     virtual DOMString getXmlVersion() = 0;
2540     /**
2541      *
2542      */
2543     virtual void setXmlVersion(const DOMString &version)
2544                                    throw (DOMException) = 0;
2546     /**
2547      *
2548      */
2549     virtual bool getStrictErrorChecking() = 0;
2551     /**
2552      *
2553      */
2554     virtual void setStrictErrorChecking(bool val) = 0;
2557     /**
2558      *
2559      */
2560     virtual DOMString getDocumentURI() = 0;
2562     /**
2563      *
2564      */
2565     virtual void setDocumentURI(const DOMString &uri) = 0;
2567     /**
2568      *
2569      */
2570     virtual NodePtr adoptNode(const NodePtr source) throw (DOMException) = 0;
2572     /**
2573      *
2574      */
2575     virtual DOMConfiguration *getDomConfig() = 0;
2577     /**
2578      *
2579      */
2580     virtual void normalizeDocument() = 0;
2582     /**
2583      *
2584      */
2585     virtual NodePtr renameNode(const NodePtr n,
2586                                const DOMString &namespaceURI,
2587                                const DOMString &qualifiedName)
2588                                throw (DOMException) = 0;
2591     //##################
2592     //# Non-API methods
2593     //##################
2595     /**
2596      *
2597      */
2598     virtual ~Document() {}
2600 };
2609 }  //namespace dom
2610 }  //namespace w3c
2611 }  //namespace org
2614 #endif // __DOM_H__
2617 /*#########################################################################
2618 ## E N D    O F    F I L E
2619 #########################################################################*/