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 /**
50 * What type of string do we want? Pick one of the following
51 * Then below, select one of the corresponding typedefs.
52 */
54 #include <glibmm.h>
55 //#include <string>
57 //# Unfortunate hack for a name collision
58 #ifdef SEVERITY_ERROR
59 #undef SEVERITY_ERROR
60 #endif
62 #define XMLNSNAME "http://www.w3.org/2000/xmlns/"
64 namespace org
65 {
66 namespace w3c
67 {
68 namespace dom
69 {
72 /**
73 * This is the org::w3c::dom::DOMString definition.
74 * Which type do we want?
75 */
76 typedef Glib::ustring DOMString;
77 typedef gunichar XMLCh;
79 //typedef std::string DOMString;
80 //typedef unsigned short XMLCh;
83 /**
84 * At least 64 bit time stamp value.
85 */
86 typedef unsigned long long DOMTimeStamp;
88 /**
89 * This is used for storing refs to user-supplied data.
90 */
91 typedef void DOMUserData;
94 /*#########################################################################
95 ## NodePtr
96 #########################################################################*/
98 /**
99 * A simple Smart Pointer class that handles Nodes and all of its
100 * descendants. This is very similar to shared_ptr, but it is customized
101 * to handle our needs.
102 */
103 template<class T> class Ptr
104 {
105 public:
107 /**
108 * Simple constructor
109 */
110 Ptr()
111 { _ref = 0; }
113 /**
114 * Constructor upon a reference
115 */
116 template<class Y> Ptr(const Ptr<Y> &other)
117 {
118 _ref = other._ref;
119 incrementRefCount(_ref);
120 }
122 /**
123 * Constructor upon a reference
124 */
125 Ptr(T * refArg, bool addRef = true)
126 {
127 _ref = refArg;
128 if(addRef)
129 incrementRefCount(_ref);
130 }
133 /**
134 * Copy constructor
135 */
136 Ptr(const Ptr &other)
137 {
138 _ref = other._ref;
139 incrementRefCount(_ref);
140 }
142 /**
143 * Destructor
144 */
145 virtual ~Ptr()
146 {
147 decrementRefCount(_ref);
148 }
151 /**
152 * Assignment operator
153 */
154 template<class Y> Ptr &operator=(const Ptr<Y> &other)
155 {
156 decrementRefCount(_ref);
157 _ref = other._ref;
158 incrementRefCount(_ref);
159 return *this;
160 }
162 /**
163 * Assignment operator
164 */
165 Ptr &operator=(const Ptr &other)
166 {
167 decrementRefCount(_ref);
168 _ref = other._ref;
169 incrementRefCount(_ref);
170 return *this;
171 }
173 /**
174 * Assignment operator
175 */
176 template<class Y> Ptr &operator=(Y * ref)
177 {
178 decrementRefCount(_ref);
179 _ref = ref;
180 incrementRefCount(_ref);
181 return *this;
182 }
184 /**
185 * Assignment operator
186 */
187 template<class Y> Ptr &operator=(const Y * ref)
188 {
189 decrementRefCount(_ref);
190 _ref = (Y *) ref;
191 incrementRefCount(_ref);
192 return *this;
193 }
195 /**
196 * Return the reference
197 */
198 T * get() const
199 {
200 return _ref;
201 }
203 /**
204 * Dereference operator
205 */
206 T &operator*() const
207 {
208 return *_ref;
209 }
211 /**
212 * Point-to operator
213 */
214 T *operator->() const
215 {
216 return _ref;
217 }
219 /**
220 * NOT bool operator. How to check if we are null without a comparison
221 */
222 bool operator! () const
223 {
224 return (_ref == 0);
225 }
227 /**
228 * Swap what I reference with the other guy
229 */
230 void swap(Ptr &other)
231 {
232 T *tmp = _ref;
233 _ref = other._ref;
234 other._ref = tmp;
235 }
237 //The referenced item
238 T *_ref;
239 };
242 /**
243 * Global definitions. Many of these are used to mimic behaviour of
244 * a real pointer
245 */
247 /**
248 * Equality
249 */
250 template<class T, class U> inline bool
251 operator==(const Ptr<T> &a, const Ptr<U> &b)
252 {
253 return a.get() == b.get();
254 }
256 /**
257 * Inequality
258 */
259 template<class T, class U> inline bool
260 operator!=(const Ptr<T> &a, const Ptr<U> &b)
261 {
262 return a.get() != b.get();
263 }
265 /**
266 * Equality
267 */
268 template<class T> inline bool
269 operator==(const Ptr<T> &a, T * b)
270 {
271 return a.get() == b;
272 }
274 /**
275 * Inequality
276 */
277 template<class T> inline bool
278 operator!=(const Ptr<T> &a, T * b)
279 {
280 return a.get() != b;
281 }
283 /**
284 * Equality
285 */
286 template<class T> inline bool
287 operator==(T * a, const Ptr<T> &b)
288 {
289 return a == b.get();
290 }
292 /**
293 * Inequality
294 */
295 template<class T> inline bool
296 operator!=(T * a, const Ptr<T> &b)
297 {
298 return a != b.get();
299 }
302 /**
303 * Less than
304 */
305 template<class T> inline bool
306 operator<(const Ptr<T> &a, const Ptr<T> &b)
307 {
308 return std::less<T *>()(a.get(), b.get());
309 }
311 /**
312 * Swap
313 */
314 template<class T> void
315 swap(Ptr<T> &a, Ptr<T> &b)
316 {
317 a.swap(b);
318 }
321 /**
322 * Get the pointer globally, for <algo>
323 */
324 template<class T> T *
325 get_pointer(const Ptr<T> &p)
326 {
327 return p.get();
328 }
330 /**
331 * Static cast
332 */
333 template<class T, class U> Ptr<T>
334 static_pointer_cast(const Ptr<U> &p)
335 {
336 return static_cast<T *>(p.get());
337 }
339 /**
340 * Const cast
341 */
342 template<class T, class U> Ptr<T>
343 const_pointer_cast(const Ptr<U> &p)
344 {
345 return const_cast<T *>(p.get());
346 }
348 /**
349 * Dynamic cast
350 */
351 template<class T, class U> Ptr<T>
352 dynamic_pointer_cast(const Ptr<U> &p)
353 {
354 return dynamic_cast<T *>(p.get());
355 }
358 /**
359 * This is used for opaque references to arbitrary objects from
360 * the DOM tree.
361 */
362 typedef void DOMObject;
365 /**
366 * Forward references. These are needed because of extensive
367 * inter-referencing within the DOM tree.
368 */
369 class NodeList;
370 class NamedNodeMap;
371 class DOMException;
372 class DOMStringList;
373 class NameList;
374 class DOMImplementationList;
375 class DOMImplementationSource;
376 class DOMImplementation;
377 class TypeInfo;
378 class UserDataHandler;
379 class DOMError;
380 class DOMErrorHandler;
381 class DOMLocator;
382 class DOMConfiguration;
384 /**
385 * Smart pointer definitions. Most methods that return references to
386 * Nodes of various types, will return one of these smart pointers instead,
387 * to allow refcounting and GC.
388 */
389 class Node;
390 typedef Ptr<Node> NodePtr;
391 class CharacterData;
392 typedef Ptr<CharacterData> CharacterDataPtr;
393 class Attr;
394 typedef Ptr<Attr> AttrPtr;
395 class Element;
396 typedef Ptr<Element> ElementPtr;
397 class Text;
398 typedef Ptr<Text> TextPtr;
399 class Comment;
400 typedef Ptr<Comment> CommentPtr;
401 class DocumentType;
402 typedef Ptr<DocumentType> DocumentTypePtr;
403 class CDATASection;
404 typedef Ptr<CDATASection> CDATASectionPtr;
405 class Notation;
406 typedef Ptr<Notation> NotationPtr;
407 class Entity;
408 typedef Ptr<Entity> EntityPtr;
409 class EntityReference;
410 typedef Ptr<EntityReference> EntityReferencePtr;
411 class ProcessingInstruction;
412 typedef Ptr<ProcessingInstruction> ProcessingInstructionPtr;
413 class DocumentFragment;
414 typedef Ptr<DocumentFragment> DocumentFragmentPtr;
415 class Document;
416 typedef Ptr<Document> DocumentPtr;
421 /**
422 * NOTE: We were originally intending to split ALL specifications into
423 * interface and implementation. After consideration, though, it behooves
424 * us to simplify things by implementing the base exception and
425 * container classes directly:
426 *
427 * DOMException
428 * DOMStringList
429 * NameList
430 * DOMImplementationList
431 * DOMImplementationSource
432 * DOMImplementation
433 * NodeList
434 * NamedNodeMap
435 */
438 /*#########################################################################
439 ## DOMException
440 #########################################################################*/
442 /**
443 * An Exception class. Not an interface, since this is something that
444 * all implementations must support.
445 */
446 class DOMException
447 {
449 public:
451 /**
452 * ExceptionCode
453 */
454 typedef enum
455 {
456 INDEX_SIZE_ERR = 1,
457 DOMSTRING_SIZE_ERR = 2,
458 HIERARCHY_REQUEST_ERR = 3,
459 WRONG_DOCUMENT_ERR = 4,
460 INVALID_CHARACTER_ERR = 5,
461 NO_DATA_ALLOWED_ERR = 6,
462 NO_MODIFICATION_ALLOWED_ERR = 7,
463 NOT_FOUND_ERR = 8,
464 NOT_SUPPORTED_ERR = 9,
465 INUSE_ATTRIBUTE_ERR = 10,
466 INVALID_STATE_ERR = 11,
467 SYNTAX_ERR = 12,
468 INVALID_MODIFICATION_ERR = 13,
469 NAMESPACE_ERR = 14,
470 INVALID_ACCESS_ERR = 15,
471 VALIDATION_ERR = 16,
472 TYPE_MISMATCH_ERR = 17
473 } ExceptionCode;
477 DOMException(const DOMString &reasonMsg)
478 { msg = reasonMsg; }
480 DOMException(short theCode)
481 {
482 code = theCode;
483 }
485 virtual ~DOMException() throw()
486 {}
488 /**
489 * What type of exception? One of the ExceptionCodes above.
490 */
491 unsigned short code;
493 /**
494 * Some text describing the context that generated this exception.
495 */
496 DOMString msg;
498 /**
499 * Get a string, translated from the code.
500 * Like std::exception. Not in spec.
501 */
502 const char *what()
503 { return (const char *)msg.c_str(); }
507 };
514 /*#########################################################################
515 ## DOMStringList
516 #########################################################################*/
518 /**
519 * This holds a list of DOMStrings. This is likely the response to a query,
520 * or the value of an attribute.
521 */
522 class DOMStringList
523 {
524 public:
526 /**
527 * Get the nth string of the list
528 */
529 virtual DOMString item(unsigned long index)
530 {
531 if (index>=strings.size())
532 return "";
533 return strings[index];
534 }
536 /**
537 * How many strings in this list?
538 */
539 virtual unsigned long getLength()
540 {
541 return (unsigned long) strings.size();
542 }
544 /**
545 * Is the argument string present in this list? Lexically, not identically.
546 */
547 virtual bool contains(const DOMString &str)
548 {
549 for (unsigned int i=0; i<strings.size() ; i++)
550 {
551 if (strings[i] == str)
552 return true;
553 }
554 return false;
555 }
558 //##################
559 //# Non-API methods
560 //##################
562 /**
563 *
564 */
565 DOMStringList() {}
568 /**
569 *
570 */
571 DOMStringList(const DOMStringList &other)
572 {
573 strings = other.strings;
574 }
576 /**
577 *
578 */
579 DOMStringList &operator=(const DOMStringList &other)
580 {
581 strings = other.strings;
582 return *this;
583 }
585 /**
586 *
587 */
588 virtual ~DOMStringList() {}
591 protected:
593 /**
594 *
595 */
596 virtual void add(const DOMString &str)
597 {
598 strings.push_back(str);
599 }
601 std::vector<DOMString>strings;
603 };
607 /*#########################################################################
608 ## NameList
609 #########################################################################*/
612 /**
613 * Constains a list of namespaced names.
614 */
615 class NameList
616 {
617 private:
619 class NamePair
620 {
621 public:
622 NamePair(const DOMString &theNamespaceURI, const DOMString &theName)
623 {
624 namespaceURI = theNamespaceURI;
625 name = theName;
626 }
627 NamePair(const NamePair &other)
628 {
629 namespaceURI = other.namespaceURI;
630 name = other.name;
631 }
632 NamePair &operator=(const NamePair &other)
633 {
634 namespaceURI = other.namespaceURI;
635 name = other.name;
636 return *this;
637 }
638 virtual ~NamePair() {}
640 DOMString namespaceURI;
641 DOMString name;
642 };
644 public:
646 /**
647 * Returns a name at the given index. If out of range, return -1.
648 */
649 virtual DOMString getName(unsigned long index)
650 {
651 if (index>=namePairs.size())
652 return "";
653 return namePairs[index].name;
654 }
656 /**
657 * Returns a namespace at the given index. If out of range, return -1.
658 */
659 virtual DOMString getNamespaceURI(unsigned long index)
660 {
661 if (index>=namePairs.size())
662 return "";
663 return namePairs[index].namespaceURI;
664 }
666 /**
667 * Return the number of entries in this list.
668 */
669 virtual unsigned long getLength()
670 {
671 return (unsigned long)namePairs.size();
672 }
674 /**
675 * Return whether the name argument is present in the list.
676 * This is done lexically, not identically.
677 */
678 virtual bool contains(const DOMString &name)
679 {
680 for (unsigned int i=0; i<namePairs.size() ; i++)
681 {
682 if (namePairs[i].name == name )
683 return true;
684 }
685 return false;
686 }
688 /**
689 * Return whether the namespaced name argument is present in the list.
690 * This is done lexically, not identically.
691 */
692 virtual bool containsNS(const DOMString namespaceURI,const DOMString &name)
693 {
694 for (unsigned int i=0; i<namePairs.size() ; i++)
695 {
696 if (namePairs[i].namespaceURI == namespaceURI ||
697 namePairs[i].name == name )
698 return true;
699 }
700 return false;
701 }
704 //##################
705 //# Non-API methods
706 //##################
708 /**
709 *
710 */
711 NameList() {}
713 /**
714 *
715 */
716 NameList(const NameList &other)
717 {
718 namePairs = other.namePairs;
719 }
721 /**
722 *
723 */
724 NameList &operator=(const NameList &other)
725 {
726 namePairs = other.namePairs;
727 return *this;
728 }
730 /**
731 *
732 */
733 virtual ~NameList() {}
736 protected:
738 std::vector<NamePair> namePairs;
740 };
742 /*#########################################################################
743 ## DOMImplementationList
744 #########################################################################*/
746 /**
747 * Contains a list of DOMImplementations, with accessors.
748 */
749 class DOMImplementationList
750 {
751 public:
753 /**
754 * Return a DOMImplementation at the given index. If
755 * out of range, return NULL.
756 */
757 virtual DOMImplementation *item(unsigned long index)
758 {
759 if (index >implementations.size())
760 return NULL;
761 return implementations[index];
762 }
764 /**
765 * Return the number of DOMImplementations in this list.
766 */
767 virtual unsigned long getLength()
768 {
769 return (unsigned long) implementations.size();
770 }
773 //##################
774 //# Non-API methods
775 //##################
777 /**
778 *
779 */
780 DOMImplementationList() {}
783 /**
784 *
785 */
786 DOMImplementationList(const DOMImplementationList &other)
787 {
788 implementations = other.implementations;
789 }
791 /**
792 *
793 */
794 DOMImplementationList &operator=(const DOMImplementationList &other)
795 {
796 implementations = other.implementations;
797 return *this;
798 }
800 /**
801 *
802 */
803 virtual ~DOMImplementationList() {}
805 protected:
807 std::vector<DOMImplementation *>implementations;
809 };
812 /*#########################################################################
813 ## DOMImplementationSource
814 #########################################################################*/
816 /**
817 * This is usually the first item to be called when creating a Document.
818 * You will either find one DOMImplementation with a given set of features,
819 * or return a list that match. Using "" will get any implementation
820 * available.
821 */
822 class DOMImplementationSource
823 {
824 public:
826 /**
827 * Return the first DOMImplementation with the given set of features.
828 * Use "" to fetch any implementation.
829 */
830 virtual DOMImplementation *getDOMImplementation(const DOMString &features) = 0;
832 /**
833 * Return a list of DOMImplementations with the given set of features.
834 * Use "" to fetch any implementation.
835 */
836 virtual DOMImplementationList getDOMImplementationList(const DOMString &features) = 0;
838 //##################
839 //# Non-API methods
840 //##################
842 /**
843 *
844 */
845 virtual ~DOMImplementationSource() {}
847 };
853 /*#########################################################################
854 ## DOMImplementation
855 #########################################################################*/
857 /**
858 * This is the class that actually creates a Document.
859 */
860 class DOMImplementation
861 {
862 public:
864 /**
865 * Determine if this implementation has the given feature and version.
866 */
867 virtual bool hasFeature(const DOMString& feature, const DOMString& version) = 0;
870 /**
871 * Create a document type to be used in creating documents.
872 */
873 virtual DocumentTypePtr createDocumentType(
874 const DOMString& qualifiedName,
875 const DOMString& publicId,
876 const DOMString& systemId)
877 throw(DOMException) = 0;
879 /**
880 * Create a DOM document.
881 */
882 virtual DocumentPtr createDocument(const DOMString& namespaceURI,
883 const DOMString& qualifiedName,
884 DocumentTypePtr doctype)
885 throw(DOMException) = 0;
886 /**
887 * Return the thing which is the feature of this implementation. Since
888 * this is a "one size fits all" call, you will need to typecast the
889 * result to the expected type.
890 */
891 virtual DOMObject *getFeature(const DOMString& feature,
892 const DOMString& version) = 0;
895 //##################
896 //# Non-API methods
897 //##################
899 /**
900 *
901 */
902 virtual ~DOMImplementation() {}
904 };
910 /*#########################################################################
911 ## Node
912 #########################################################################*/
914 /**
915 * The basic Node class, which is the root of most other
916 * classes in DOM. Thus it is by far the most important, and the one
917 * whose implementation we must perform correctly.
918 */
919 class Node
920 {
921 public:
923 /**
924 * Which of the DOM Core node types is this node?
925 */
926 typedef enum
927 {
928 ELEMENT_NODE = 1,
929 ATTRIBUTE_NODE = 2,
930 TEXT_NODE = 3,
931 CDATA_SECTION_NODE = 4,
932 ENTITY_REFERENCE_NODE = 5,
933 ENTITY_NODE = 6,
934 PROCESSING_INSTRUCTION_NODE = 7,
935 COMMENT_NODE = 8,
936 DOCUMENT_NODE = 9,
937 DOCUMENT_TYPE_NODE = 10,
938 DOCUMENT_FRAGMENT_NODE = 11,
939 NOTATION_NODE = 12
940 } NodeType;
942 /**
943 * Return the name of this node.
944 */
945 virtual DOMString getNodeName() = 0;
947 /**
948 * Return the value of this node. The interpretation of the
949 * value is type-specific.
950 */
951 virtual DOMString getNodeValue() throw (DOMException) = 0;
953 /**
954 * Set the value of this node. The interpretation of the
955 * value is type-specific.
956 */
957 virtual void setNodeValue(const DOMString& val) throw (DOMException) = 0;
959 /**
960 * Return the type of this Node. One of the NodeType values above.
961 */
962 virtual unsigned short getNodeType() = 0;
964 /**
965 * Return the parent which references this node as a child in the DOM
966 * tree. Return NULL if there is none.
967 */
968 virtual NodePtr getParentNode() = 0;
970 /**
971 * Return a list of the children of this Node.
972 * NOTE: the spec expects this to be a "live" list that always
973 * reflects an accurate list of what the Node current possesses, not
974 * a snapshot. How do we do this?
975 */
976 virtual NodeList getChildNodes() = 0;
978 /**
979 * Return the first sibling of the chidren of this node. Return
980 * null if there is none.
981 */
982 virtual NodePtr getFirstChild() = 0;
984 /**
985 * Return the last sibling of the children of this node. Return
986 * null if there is none.
987 */
988 virtual NodePtr getLastChild() = 0;
990 /**
991 * Return the node that is previous to this one in the parent's
992 * list of children. Return null if there is none.
993 */
994 virtual NodePtr getPreviousSibling() = 0;
996 /**
997 * Return the node that is after this one in the parent's list
998 * of children. Return null if there is none.
999 */
1000 virtual NodePtr getNextSibling() = 0;
1002 /**
1003 * Get the list of all attributes of this node.
1004 */
1005 virtual NamedNodeMap &getAttributes() = 0;
1008 /**
1009 * Return the document that created or inherited this node.
1010 */
1011 virtual DocumentPtr getOwnerDocument() = 0;
1013 /**
1014 * Insert a node as a new child. Place it before the referenced child.
1015 * Place it at the end if the referenced child does not exist.
1016 */
1017 virtual NodePtr insertBefore(const NodePtr newChild,
1018 const NodePtr refChild)
1019 throw(DOMException) = 0;
1021 /**
1022 * Insert a node as a new child. Replace the referenced child with it.
1023 * Place it at the end if the referenced child does not exist.
1024 */
1025 virtual NodePtr replaceChild(const NodePtr newChild,
1026 const NodePtr oldChild)
1027 throw(DOMException) = 0;
1029 /**
1030 * Remove a node from the list of children. Do nothing if the
1031 * node is not a member of the child list.
1032 */
1033 virtual NodePtr removeChild(const NodePtr oldChild)
1034 throw(DOMException) = 0;
1036 /**
1037 * Add the node to the end of this node's child list.
1038 */
1039 virtual NodePtr appendChild(const NodePtr newChild)
1040 throw(DOMException) = 0;
1042 /**
1043 * Return true if this node has one or more children, else return false.
1044 */
1045 virtual bool hasChildNodes() = 0;
1047 /**
1048 * Return a new node which has the name, type, value, attributes, and
1049 * child list as this one.
1050 * If 'deep' is true, continue cloning recursively with this node's children,
1051 * so that the child list also contains clones of their respective nodes.
1052 */
1053 virtual NodePtr cloneNode(bool deep) = 0;
1055 /**
1056 * Adjust this node and its children to have its namespaces and
1057 * prefixes in "canonical" order.
1058 */
1059 virtual void normalize() = 0;
1061 /**
1062 * Return true if the named feature is supported by this node,
1063 * else false.
1064 */
1065 virtual bool isSupported(const DOMString& feature,
1066 const DOMString& version) = 0;
1068 /**
1069 * Return the namespace of this node. This would be whether the
1070 * namespace were declared explicitly on this node, it has a namespace
1071 * prefix, or it is inherits the namespace from an ancestor node.
1072 */
1073 virtual DOMString getNamespaceURI() = 0;
1075 /**
1076 * Return the namespace prefix of this node, if any. For example, if
1077 * the tag were <svg:image> then the prefix would be "svg"
1078 */
1079 virtual DOMString getPrefix() = 0;
1081 /**
1082 * Sets the namespace prefix of this node to the given value. This
1083 * does not change the namespaceURI value.
1084 */
1085 virtual void setPrefix(const DOMString& val) throw(DOMException) = 0;
1087 /**
1088 * Return the local name of this node. This is merely the name without
1089 * any namespace or prefix.
1090 */
1091 virtual DOMString getLocalName() = 0;
1093 /**
1094 * Return true if this node has one or more attributes, else false.
1095 */
1096 virtual bool hasAttributes() = 0;
1098 /**
1099 * Return the base URI of this node. This is basically the "location" of this
1100 * node, and is used in resolving the relative locations of other URIs.
1101 */
1102 virtual DOMString getBaseURI() = 0;
1104 /**
1105 * DocumentPosition.
1106 * This is used to describe the position of one node relative
1107 * to another in a document
1108 */
1109 typedef enum
1110 {
1111 DOCUMENT_POSITION_DISCONNECTED = 0x01,
1112 DOCUMENT_POSITION_PRECEDING = 0x02,
1113 DOCUMENT_POSITION_FOLLOWING = 0x04,
1114 DOCUMENT_POSITION_CONTAINS = 0x08,
1115 DOCUMENT_POSITION_CONTAINED_BY = 0x10,
1116 DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
1117 } DocumentPosition;
1120 /**
1121 * Get the position of this node relative to the node argument.
1122 */
1123 virtual unsigned short compareDocumentPosition(
1124 const NodePtr other) = 0;
1126 /**
1127 * This is a DOM L3 method. Return the text value of this node and its
1128 * children. This is done by concatenating all of the TEXT_NODE and
1129 * CDATA_SECTION nodes of this node and its children, in order, together.
1130 * Very handy.
1131 */
1132 virtual DOMString getTextContent() throw(DOMException) = 0;
1135 /**
1136 * This is a DOM L3 method. Remember, this is a destructive call. This
1137 * will replace all of the child nodes of this node with a single TEXT_NODE
1138 * with the given text value.
1139 */
1140 virtual void setTextContent(const DOMString &val) throw(DOMException) = 0;
1143 /**
1144 * This will search the tree from this node up, for a prefix that
1145 * has been assigned to the namespace argument. Return "" if not found.
1146 */
1147 virtual DOMString lookupPrefix(const DOMString &namespaceURI) =0;
1150 /**
1151 * Return true if this node is in the namespace of the argument, without
1152 * requiring an explicit namespace declaration or a suffix.
1153 */
1154 virtual bool isDefaultNamespace(const DOMString &namespaceURI) =0;
1157 /**
1158 * This will search the tree from this node up, for a namespace that
1159 * has been assigned the suffix in the argument. Return "" if not found.
1160 */
1161 virtual DOMString lookupNamespaceURI(const DOMString &prefix) =0;
1164 /**
1165 * Return true if the argument node is equal to this one. Use W3C rules
1166 * for equality.
1167 */
1168 virtual bool isEqualNode(const NodePtr node) =0;
1172 /**
1173 * Return an opaque reference to the named feature. Return null if
1174 * not supported. Using other than "" for the version will look for
1175 * a feature with the given version.
1176 */
1177 virtual DOMObject *getFeature(const DOMString &feature,
1178 const DOMString &version) =0;
1180 /**
1181 * Store a user data reference in this node, using the given key.
1182 * A handler is an optional function object that will be called during
1183 * future settings of this value. See UserDataHandler for more info.
1184 */
1185 virtual DOMUserData *setUserData(const DOMString &key,
1186 const DOMUserData *data,
1187 const UserDataHandler *handler) =0;
1190 /**
1191 * Return a reference to the named user data object. Return null
1192 * if it does not exist.
1193 */
1194 virtual DOMUserData *getUserData(const DOMString &key) =0;
1196 //##################
1197 //# Non-API methods
1198 //##################
1200 /**
1201 *
1202 */
1203 Node() : _refCnt(0)
1204 {}
1206 /**
1207 *
1208 */
1209 virtual ~Node() {}
1211 protected:
1213 friend void incrementRefCount(Node *p);
1214 friend void decrementRefCount(Node *p);
1216 /**
1217 * For the Ptr smart pointer
1218 */
1219 int _refCnt;
1221 };
1226 /*#########################################################################
1227 ## NodeList
1228 #########################################################################*/
1230 /**
1231 * Contains a list of Nodes. This is the standard API container for Nodes,
1232 * and is used in lieu of other lists, arrays, etc, in order to provide
1233 * a consistent API and algorithm.
1234 */
1235 class NodeList
1236 {
1237 public:
1239 /**
1240 * Retrieve the Node at the given index. Return NULL
1241 * if out of range.
1242 */
1243 virtual NodePtr item(unsigned long index)
1244 {
1245 if (index>=nodes.size())
1246 return NULL;
1247 return nodes[index];
1248 }
1250 /**
1251 *
1252 */
1253 virtual unsigned long getLength()
1254 {
1255 return (unsigned long) nodes.size();
1256 }
1258 //##################
1259 //# Non-API methods
1260 //##################
1263 /**
1264 *
1265 */
1266 NodeList() {}
1268 /**
1269 *
1270 */
1271 NodeList(const NodeList &other)
1272 {
1273 nodes = other.nodes;
1274 }
1276 /**
1277 *
1278 */
1279 NodeList &operator=(const NodeList &other)
1280 {
1281 nodes = other.nodes;
1282 return *this;
1283 }
1285 /**
1286 *
1287 */
1288 virtual ~NodeList() {}
1290 /**
1291 *
1292 */
1293 virtual void clear()
1294 {
1295 nodes.clear();
1296 }
1298 protected:
1300 friend class NodeImpl;
1301 friend class ElementImpl;
1303 /*
1304 *
1305 */
1306 virtual void add(const NodePtr node)
1307 {
1308 nodes.push_back(node);
1309 }
1311 protected:
1313 std::vector<NodePtr> nodes;
1315 };
1320 /*#########################################################################
1321 ## NamedNodeMap
1322 #########################################################################*/
1324 class NamedNodeMapEntry
1325 {
1326 public:
1327 NamedNodeMapEntry(const DOMString &theNamespaceURI,
1328 const DOMString &theName,
1329 const NodePtr theNode)
1330 {
1331 namespaceURI = theNamespaceURI;
1332 name = theName;
1333 node = theNode;
1334 }
1335 NamedNodeMapEntry(const NamedNodeMapEntry &other)
1336 {
1337 assign(other);
1338 }
1339 NamedNodeMapEntry &operator=(const NamedNodeMapEntry &other)
1340 {
1341 assign(other);
1342 return *this;
1343 }
1344 virtual ~NamedNodeMapEntry()
1345 {
1346 }
1347 void assign(const NamedNodeMapEntry &other)
1348 {
1349 namespaceURI = other.namespaceURI;
1350 name = other.name;
1351 node = other.node;
1352 }
1353 DOMString namespaceURI;
1354 DOMString name;
1355 NodePtr node;
1356 };
1358 /**
1359 *
1360 */
1361 class NamedNodeMap
1362 {
1363 public:
1365 /**
1366 *
1367 */
1368 virtual NodePtr getNamedItem(const DOMString& name)
1369 {
1370 std::vector<NamedNodeMapEntry>::iterator iter;
1371 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1372 {
1373 if (iter->name == name)
1374 {
1375 NodePtr node = iter->node;
1376 return node;
1377 }
1378 }
1379 return NULL;
1380 }
1382 /**
1383 *
1384 */
1385 virtual NodePtr setNamedItem(NodePtr arg) throw(DOMException)
1386 {
1387 if (!arg)
1388 return NULL;
1389 DOMString namespaceURI = arg->getNamespaceURI();
1390 DOMString name = arg->getNodeName();
1391 std::vector<NamedNodeMapEntry>::iterator iter;
1392 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1393 {
1394 if (iter->name == name)
1395 {
1396 NodePtr node = iter->node;
1397 iter->node = arg;
1398 return node;
1399 }
1400 }
1401 NamedNodeMapEntry entry(namespaceURI, name, arg);
1402 entries.push_back(entry);
1403 return arg;
1404 }
1407 /**
1408 *
1409 */
1410 virtual NodePtr removeNamedItem(const DOMString& name) throw(DOMException)
1411 {
1412 std::vector<NamedNodeMapEntry>::iterator iter;
1413 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1414 {
1415 if (iter->name == name)
1416 {
1417 NodePtr node = iter->node;
1418 entries.erase(iter);
1419 return node;
1420 }
1421 }
1422 return NULL;
1423 }
1425 /**
1426 *
1427 */
1428 virtual NodePtr item(unsigned long index)
1429 {
1430 if (index>=entries.size())
1431 return NULL;
1432 return entries[index].node;
1433 }
1435 /**
1436 *
1437 */
1438 virtual unsigned long getLength()
1439 {
1440 return (unsigned long)entries.size();
1441 }
1443 /**
1444 *
1445 */
1446 virtual NodePtr getNamedItemNS(const DOMString& namespaceURI,
1447 const DOMString& localName)
1448 {
1449 std::vector<NamedNodeMapEntry>::iterator iter;
1450 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1451 {
1452 if (iter->namespaceURI == namespaceURI && iter->name == localName)
1453 {
1454 NodePtr node = iter->node;
1455 return node;
1456 }
1457 }
1458 return NULL;
1459 }
1461 /**
1462 *
1463 */
1464 virtual NodePtr setNamedItemNS(NodePtr arg) throw(DOMException)
1465 {
1466 if (!arg)
1467 return NULL;
1468 DOMString namespaceURI = arg->getNamespaceURI();
1469 DOMString name = arg->getNodeName();
1470 std::vector<NamedNodeMapEntry>::iterator iter;
1471 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1472 {
1473 if (iter->namespaceURI == namespaceURI && iter->name == name)
1474 {
1475 NodePtr node = iter->node;
1476 iter->node = arg;
1477 return node;
1478 }
1479 }
1480 NamedNodeMapEntry entry(namespaceURI, name, arg);
1481 entries.push_back(entry);
1482 return arg;
1483 }
1485 /**
1486 *
1487 */
1488 virtual NodePtr removeNamedItemNS(const DOMString& namespaceURI,
1489 const DOMString& localName)
1490 throw(DOMException)
1491 {
1492 std::vector<NamedNodeMapEntry>::iterator iter;
1493 for (iter = entries.begin() ; iter!=entries.end() ; iter++)
1494 {
1495 if (iter->namespaceURI == namespaceURI && iter->name == localName)
1496 {
1497 NodePtr node = iter->node;
1498 entries.erase(iter);
1499 return node;
1500 }
1501 }
1502 return NULL;
1503 }
1505 //##################
1506 //# Non-API methods
1507 //##################
1509 /**
1510 *
1511 */
1512 NamedNodeMap() {}
1515 /**
1516 *
1517 */
1518 NamedNodeMap(const NamedNodeMap &other)
1519 {
1520 entries = other.entries;
1521 }
1523 /**
1524 *
1525 */
1526 NamedNodeMap &operator=(const NamedNodeMap &other)
1527 {
1528 entries = other.entries;
1529 return *this;
1530 }
1533 /**
1534 *
1535 */
1536 virtual ~NamedNodeMap() {}
1538 protected:
1540 std::vector<NamedNodeMapEntry> entries;
1542 };
1547 /*#########################################################################
1548 ## CharacterData
1549 #########################################################################*/
1551 /**
1552 *
1553 */
1554 class CharacterData : virtual public Node
1555 {
1556 public:
1558 /**
1559 *
1560 */
1561 virtual DOMString getData() throw(DOMException) = 0;
1563 /**
1564 *
1565 */
1566 virtual void setData(const DOMString& val) throw(DOMException) = 0;
1568 /**
1569 *
1570 */
1571 virtual unsigned long getLength() = 0;
1573 /**
1574 *
1575 */
1576 virtual DOMString substringData(unsigned long offset,
1577 unsigned long count)
1578 throw(DOMException) = 0;
1580 /**
1581 *
1582 */
1583 virtual void appendData(const DOMString& arg) throw(DOMException) = 0;
1585 /**
1586 *
1587 */
1588 virtual void insertData(unsigned long offset,
1589 const DOMString& arg)
1590 throw(DOMException) = 0;
1592 /**
1593 *
1594 */
1595 virtual void deleteData(unsigned long offset,
1596 unsigned long count)
1597 throw(DOMException) = 0;
1599 /**
1600 *
1601 */
1602 virtual void replaceData(unsigned long offset,
1603 unsigned long count,
1604 const DOMString& arg)
1605 throw(DOMException) = 0;
1608 //##################
1609 //# Non-API methods
1610 //##################
1613 /**
1614 *
1615 */
1616 virtual ~CharacterData() {}
1618 };
1621 typedef Ptr<CharacterData> CharacterDataPtr;
1626 /*#########################################################################
1627 ## Attr
1628 #########################################################################*/
1630 /**
1631 *
1632 */
1633 class Attr : virtual public Node
1634 {
1635 public:
1637 /**
1638 *
1639 */
1640 virtual DOMString getName() = 0;
1642 /**
1643 *
1644 */
1645 virtual bool getSpecified() = 0;
1647 /**
1648 *
1649 */
1650 virtual DOMString getValue() = 0;
1652 /**
1653 *
1654 */
1655 virtual void setValue(const DOMString& val) throw(DOMException) = 0;
1657 /**
1658 *
1659 */
1660 virtual ElementPtr getOwnerElement() = 0;
1663 /**
1664 *
1665 */
1666 virtual TypeInfo &getSchemaTypeInfo() = 0;
1669 /**
1670 *
1671 */
1672 virtual bool getIsId() = 0;
1674 //##################
1675 //# Non-API methods
1676 //##################
1679 /**
1680 *
1681 */
1682 virtual ~Attr() {}
1684 };
1690 /*#########################################################################
1691 ## Element
1692 #########################################################################*/
1694 /**
1695 *
1696 */
1697 class Element : virtual public Node
1698 {
1699 public:
1702 /**
1703 *
1704 */
1705 virtual DOMString getTagName() = 0;
1707 /**
1708 *
1709 */
1710 virtual DOMString getAttribute(const DOMString& name) = 0;
1712 /**
1713 *
1714 */
1715 virtual void setAttribute(const DOMString& name,
1716 const DOMString& value)
1717 throw(DOMException) = 0;
1719 /**
1720 *
1721 */
1722 virtual void removeAttribute(const DOMString& name)
1723 throw(DOMException) = 0;
1725 /**
1726 *
1727 */
1728 virtual AttrPtr getAttributeNode(const DOMString& name) = 0;
1730 /**
1731 *
1732 */
1733 virtual AttrPtr setAttributeNode(AttrPtr newAttr)
1734 throw(DOMException) = 0;
1736 /**
1737 *
1738 */
1739 virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
1740 throw(DOMException) = 0;
1742 /**
1743 *
1744 */
1745 virtual NodeList getElementsByTagName(const DOMString& name) = 0;
1747 /**
1748 *
1749 */
1750 virtual DOMString getAttributeNS(const DOMString& namespaceURI,
1751 const DOMString& localName) = 0;
1753 /**
1754 *
1755 */
1756 virtual void setAttributeNS(const DOMString& namespaceURI,
1757 const DOMString& qualifiedName,
1758 const DOMString& value)
1759 throw(DOMException) = 0;
1761 /**
1762 *
1763 */
1764 virtual void removeAttributeNS(const DOMString& namespaceURI,
1765 const DOMString& localName)
1766 throw(DOMException) = 0;
1768 /**
1769 *
1770 */
1771 virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
1772 const DOMString& localName) = 0;
1774 /**
1775 *
1776 */
1777 virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
1778 throw(DOMException) = 0;
1780 /**
1781 *
1782 */
1783 virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1784 const DOMString& localName) = 0;
1786 /**
1787 *
1788 */
1789 virtual bool hasAttribute(const DOMString& name) = 0;
1791 /**
1792 *
1793 */
1794 virtual bool hasAttributeNS(const DOMString& namespaceURI,
1795 const DOMString& localName) = 0;
1797 /**
1798 *
1799 */
1800 virtual TypeInfo &getSchemaTypeInfo() = 0;
1803 /**
1804 *
1805 */
1806 virtual void setIdAttribute(const DOMString &name,
1807 bool isId) throw (DOMException) = 0;
1809 /**
1810 *
1811 */
1812 virtual void setIdAttributeNS(const DOMString &namespaceURI,
1813 const DOMString &localName,
1814 bool isId) throw (DOMException) = 0;
1816 /**
1817 *
1818 */
1819 virtual void setIdAttributeNode(const AttrPtr idAttr,
1820 bool isId) throw (DOMException) = 0;
1822 //##################
1823 //# Non-API methods
1824 //##################
1826 /**
1827 *
1828 */
1829 virtual ~Element() {}
1831 };
1837 /*#########################################################################
1838 ## Text
1839 #########################################################################*/
1841 /**
1842 *
1843 */
1844 class Text : virtual public CharacterData
1845 {
1846 public:
1848 /**
1849 *
1850 */
1851 virtual TextPtr splitText(unsigned long offset)
1852 throw(DOMException) = 0;
1854 /**
1855 *
1856 */
1857 virtual bool getIsElementContentWhitespace()= 0;
1859 /**
1860 *
1861 */
1862 virtual DOMString getWholeText() = 0;
1865 /**
1866 *
1867 */
1868 virtual TextPtr replaceWholeText(const DOMString &content)
1869 throw(DOMException) = 0;
1871 //##################
1872 //# Non-API methods
1873 //##################
1876 /**
1877 *
1878 */
1879 virtual ~Text() {}
1881 };
1885 /*#########################################################################
1886 ## Comment
1887 #########################################################################*/
1889 /**
1890 *
1891 */
1892 class Comment : virtual public CharacterData
1893 {
1894 public:
1896 //##################
1897 //# Non-API methods
1898 //##################
1901 /**
1902 *
1903 */
1904 virtual ~Comment() {}
1907 };
1911 /*#########################################################################
1912 ## TypeInfo
1913 #########################################################################*/
1915 /**
1916 *
1917 */
1918 class TypeInfo
1919 {
1920 public:
1922 /**
1923 *
1924 */
1925 virtual DOMString getTypeName()
1926 { return typeName; }
1928 /**
1929 *
1930 */
1931 virtual DOMString getTypeNamespace()
1932 { return typeNameSpace; }
1934 typedef enum
1935 {
1936 DERIVATION_RESTRICTION = 0x00000001,
1937 DERIVATION_EXTENSION = 0x00000002,
1938 DERIVATION_UNION = 0x00000004,
1939 DERIVATION_LIST = 0x00000008
1940 } DerivationMethod;
1943 /**
1944 *
1945 */
1946 virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1947 const DOMString &typeNameArg,
1948 DerivationMethod derivationMethod)
1949 { (void)typeNamespaceArg; (void)typeNameArg; (void)derivationMethod; return false; }
1951 //##################
1952 //# Non-API methods
1953 //##################
1956 /**
1957 *
1958 */
1959 TypeInfo()
1960 {}
1962 /**
1963 *
1964 */
1965 TypeInfo(const TypeInfo &other)
1966 { assign(other); }
1968 /**
1969 *
1970 */
1971 TypeInfo &operator=(const TypeInfo &other)
1972 { assign(other); return *this; }
1974 /**
1975 *
1976 */
1977 virtual ~TypeInfo() {}
1979 private:
1981 void assign(const TypeInfo &other)
1982 {
1983 typeName = other.typeName;
1984 typeNameSpace = other.typeNameSpace;
1985 }
1987 DOMString typeName;
1988 DOMString typeNameSpace;
1989 };
1994 /*#########################################################################
1995 ## UserDataHandler
1996 #########################################################################*/
1998 /**
1999 *
2000 */
2001 class UserDataHandler
2002 {
2003 public:
2005 typedef enum
2006 {
2007 NODE_CLONED = 1,
2008 NODE_IMPORTED = 2,
2009 NODE_DELETED = 3,
2010 NODE_RENAMED = 4,
2011 NODE_ADOPTED = 5
2012 } OperationType;
2015 /**
2016 *
2017 */
2018 virtual void handle(unsigned short operation,
2019 const DOMString &key,
2020 const DOMUserData *data,
2021 const NodePtr src,
2022 const NodePtr dst) =0;
2024 //##################
2025 //# Non-API methods
2026 //##################
2029 /**
2030 *
2031 */
2032 virtual ~UserDataHandler() {}
2034 };
2037 /*#########################################################################
2038 ## DOMError
2039 #########################################################################*/
2041 /**
2042 *
2043 */
2044 class DOMError
2045 {
2046 public:
2048 typedef enum
2049 {
2050 SEVERITY_WARNING = 1,
2051 SEVERITY_ERROR = 2,
2052 SEVERITY_FATAL_ERROR = 3
2053 } ErrorSeverity;
2056 /**
2057 *
2058 */
2059 virtual unsigned short getSeverity() =0;
2061 /**
2062 *
2063 */
2064 virtual DOMString getMessage() =0;
2066 /**
2067 *
2068 */
2069 virtual DOMString getType() =0;
2071 /**
2072 *
2073 */
2074 virtual DOMObject *getRelatedException() =0;
2076 /**
2077 *
2078 */
2079 virtual DOMObject *getRelatedData() =0;
2081 /**
2082 *
2083 */
2084 virtual DOMLocator *getLocation() =0;
2087 //##################
2088 //# Non-API methods
2089 //##################
2092 /**
2093 *
2094 */
2095 virtual ~DOMError() {}
2097 };
2100 /*#########################################################################
2101 ## DOMErrorHandler
2102 #########################################################################*/
2104 /**
2105 *
2106 */
2107 class DOMErrorHandler
2108 {
2109 public:
2110 /**
2111 *
2112 */
2113 virtual bool handleError(const DOMError *error) =0;
2115 //##################
2116 //# Non-API methods
2117 //##################
2120 /**
2121 *
2122 */
2123 virtual ~DOMErrorHandler() {}
2125 };
2129 /*#########################################################################
2130 ## DOMLocator
2131 #########################################################################*/
2133 /**
2134 *
2135 */
2136 class DOMLocator
2137 {
2138 public:
2140 /**
2141 *
2142 */
2143 virtual long getLineNumber() =0;
2145 /**
2146 *
2147 */
2148 virtual long getColumnNumber() =0;
2150 /**
2151 *
2152 */
2153 virtual long getByteOffset() =0;
2155 /**
2156 *
2157 */
2158 virtual long getUtf16Offset() =0;
2161 /**
2162 *
2163 */
2164 virtual NodePtr getRelatedNode() =0;
2167 /**
2168 *
2169 */
2170 virtual DOMString getUri() =0;
2172 //##################
2173 //# Non-API methods
2174 //##################
2176 /**
2177 *
2178 */
2179 virtual ~DOMLocator() {}
2180 };
2183 /*#########################################################################
2184 ## DOMConfiguration
2185 #########################################################################*/
2187 /**
2188 *
2189 */
2190 class DOMConfiguration
2191 {
2192 public:
2194 /**
2195 *
2196 */
2197 virtual void setParameter(const DOMString &name,
2198 const DOMUserData *value)
2199 throw (DOMException) =0;
2201 /**
2202 *
2203 */
2204 virtual DOMUserData *getParameter(const DOMString &name)
2205 throw (DOMException) =0;
2207 /**
2208 *
2209 */
2210 virtual bool canSetParameter(const DOMString &name,
2211 const DOMUserData *data) =0;
2213 /**
2214 *
2215 */
2216 virtual DOMStringList *getParameterNames() =0;
2218 //##################
2219 //# Non-API methods
2220 //##################
2223 /**
2224 *
2225 */
2226 virtual ~DOMConfiguration() {}
2228 };
2235 /*#########################################################################
2236 ## CDATASection
2237 #########################################################################*/
2238 /**
2239 *
2240 */
2241 class CDATASection : virtual public Text
2242 {
2243 public:
2245 //##################
2246 //# Non-API methods
2247 //##################
2250 /**
2251 *
2252 */
2253 virtual ~CDATASection() {}
2255 };
2260 /*#########################################################################
2261 ## DocumentType
2262 #########################################################################*/
2264 /**
2265 *
2266 */
2267 class DocumentType : virtual public Node
2268 {
2269 public:
2271 /**
2272 *
2273 */
2274 virtual DOMString getName() = 0;
2276 /**
2277 *
2278 */
2279 virtual NamedNodeMap getEntities() = 0;
2281 /**
2282 *
2283 */
2284 virtual NamedNodeMap getNotations() = 0;
2286 /**
2287 *
2288 */
2289 virtual DOMString getPublicId() = 0;
2291 /**
2292 *
2293 */
2294 virtual DOMString getSystemId() = 0;
2296 /**
2297 *
2298 */
2299 virtual DOMString getInternalSubset() = 0;
2301 //##################
2302 //# Non-API methods
2303 //##################
2305 /**
2306 *
2307 */
2308 virtual ~DocumentType() {}
2310 };
2316 /*#########################################################################
2317 ## Notation
2318 #########################################################################*/
2320 /**
2321 *
2322 */
2323 class Notation : virtual public Node
2324 {
2325 public:
2327 /**
2328 *
2329 */
2330 virtual DOMString getPublicId() = 0;
2332 /**
2333 *
2334 */
2335 virtual DOMString getSystemId() = 0;
2337 //##################
2338 //# Non-API methods
2339 //##################
2342 /**
2343 *
2344 */
2345 virtual ~Notation() {}
2346 };
2353 /*#########################################################################
2354 ## Entity
2355 #########################################################################*/
2357 /**
2358 *
2359 */
2360 class Entity : virtual public Node
2361 {
2362 public:
2364 /**
2365 *
2366 */
2367 virtual DOMString getPublicId() = 0;
2369 /**
2370 *
2371 */
2372 virtual DOMString getSystemId() = 0;
2374 /**
2375 *
2376 */
2377 virtual DOMString getNotationName() = 0;
2379 /**
2380 *
2381 */
2382 virtual DOMString getInputEncoding() = 0;
2384 /**
2385 *
2386 */
2387 virtual DOMString getXmlEncoding() = 0;
2389 /**
2390 *
2391 */
2392 virtual DOMString getXmlVersion() = 0;
2394 //##################
2395 //# Non-API methods
2396 //##################
2399 /**
2400 *
2401 */
2402 virtual ~Entity() {}
2403 };
2409 /*#########################################################################
2410 ## EntityReference
2411 #########################################################################*/
2412 /**
2413 *
2414 */
2415 class EntityReference : virtual public Node
2416 {
2417 public:
2420 //##################
2421 //# Non-API methods
2422 //##################
2424 /**
2425 *
2426 */
2427 virtual ~EntityReference() {}
2428 };
2434 /*#########################################################################
2435 ## ProcessingInstruction
2436 #########################################################################*/
2438 /**
2439 *
2440 */
2441 class ProcessingInstruction : virtual public Node
2442 {
2443 public:
2445 /**
2446 *
2447 */
2448 virtual DOMString getTarget() = 0;
2450 /**
2451 *
2452 */
2453 virtual DOMString getData() = 0;
2455 /**
2456 *
2457 */
2458 virtual void setData(const DOMString& val) throw(DOMException) = 0;
2460 //##################
2461 //# Non-API methods
2462 //##################
2465 /**
2466 *
2467 */
2468 virtual ~ProcessingInstruction() {}
2470 };
2476 /*#########################################################################
2477 ## DocumentFragment
2478 #########################################################################*/
2479 /**
2480 *
2481 */
2482 class DocumentFragment : virtual public Node
2483 {
2484 public:
2486 //##################
2487 //# Non-API methods
2488 //##################
2491 /**
2492 *
2493 */
2494 virtual ~DocumentFragment() {}
2495 };
2502 /*#########################################################################
2503 ## Document
2504 #########################################################################*/
2506 /**
2507 *
2508 */
2509 class Document : virtual public Node
2510 {
2511 public:
2513 /**
2514 *
2515 */
2516 virtual DocumentTypePtr getDoctype() = 0;
2518 /**
2519 *
2520 */
2521 virtual DOMImplementation *getImplementation() = 0;
2523 /**
2524 *
2525 */
2526 virtual ElementPtr getDocumentElement() = 0;
2528 /**
2529 *
2530 */
2531 virtual ElementPtr createElement(const DOMString& tagName)
2532 throw(DOMException) = 0;
2534 /**
2535 *
2536 */
2537 virtual DocumentFragmentPtr createDocumentFragment() = 0;
2539 /**
2540 *
2541 */
2542 virtual TextPtr createTextNode(const DOMString& data) = 0;
2544 /**
2545 *
2546 */
2547 virtual CommentPtr createComment(const DOMString& data) = 0;
2549 /**
2550 *
2551 */
2552 virtual CDATASectionPtr createCDATASection(const DOMString& data)
2553 throw(DOMException) = 0;
2555 /**
2556 *
2557 */
2558 virtual ProcessingInstructionPtr
2559 createProcessingInstruction(const DOMString& target,
2560 const DOMString& data)
2561 throw(DOMException) = 0;
2563 /**
2564 *
2565 */
2566 virtual AttrPtr createAttribute(const DOMString& name)
2567 throw(DOMException) = 0;
2569 /**
2570 *
2571 */
2572 virtual EntityReferencePtr createEntityReference(const DOMString& name)
2573 throw(DOMException) = 0;
2575 /**
2576 *
2577 */
2578 virtual NodeList getElementsByTagName(const DOMString& tagname) = 0;
2581 /**
2582 *
2583 */
2584 virtual NodePtr importNode(const NodePtr importedNode,
2585 bool deep)
2586 throw(DOMException) = 0;
2588 /**
2589 *
2590 */
2591 virtual ElementPtr createElementNS(const DOMString& namespaceURI,
2592 const DOMString& qualifiedName)
2593 throw(DOMException) = 0;
2595 /**
2596 *
2597 */
2598 virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
2599 const DOMString& qualifiedName)
2600 throw(DOMException) = 0;
2602 /**
2603 *
2604 */
2605 virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
2606 const DOMString& localName) = 0;
2608 /**
2609 *
2610 */
2611 virtual ElementPtr getElementById(const DOMString& elementId) = 0;
2614 /**
2615 *
2616 */
2617 virtual DOMString getInputEncoding() = 0;
2620 /**
2621 *
2622 */
2623 virtual DOMString getXmlEncoding() = 0;
2625 /**
2626 *
2627 */
2628 virtual bool getXmlStandalone() = 0;
2630 /**
2631 *
2632 */
2633 virtual void setXmlStandalone(bool val) throw (DOMException) = 0;
2635 /**
2636 *
2637 */
2638 virtual DOMString getXmlVersion() = 0;
2640 /**
2641 *
2642 */
2643 virtual void setXmlVersion(const DOMString &version)
2644 throw (DOMException) = 0;
2646 /**
2647 *
2648 */
2649 virtual bool getStrictErrorChecking() = 0;
2651 /**
2652 *
2653 */
2654 virtual void setStrictErrorChecking(bool val) = 0;
2657 /**
2658 *
2659 */
2660 virtual DOMString getDocumentURI() = 0;
2662 /**
2663 *
2664 */
2665 virtual void setDocumentURI(const DOMString &uri) = 0;
2667 /**
2668 *
2669 */
2670 virtual NodePtr adoptNode(const NodePtr source) throw (DOMException) = 0;
2672 /**
2673 *
2674 */
2675 virtual DOMConfiguration *getDomConfig() = 0;
2677 /**
2678 *
2679 */
2680 virtual void normalizeDocument() = 0;
2682 /**
2683 *
2684 */
2685 virtual NodePtr renameNode(const NodePtr n,
2686 const DOMString &namespaceURI,
2687 const DOMString &qualifiedName)
2688 throw (DOMException) = 0;
2691 //##################
2692 //# Non-API methods
2693 //##################
2695 /**
2696 *
2697 */
2698 virtual ~Document() {}
2700 };
2709 } //namespace dom
2710 } //namespace w3c
2711 } //namespace org
2714 #endif // __DOM_H__
2717 /*#########################################################################
2718 ## E N D O F F I L E
2719 #########################################################################*/