1 #ifndef __DOMIMPL_H__
2 #define __DOMIMPL_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) 2005 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 */
33 #include "dom.h"
35 #include <map>
37 namespace org
38 {
39 namespace w3c
40 {
41 namespace dom
42 {
46 class DOMImplementationSourceImpl;
47 class DOMImplementationImpl;
48 class NodeImpl;
49 typedef Ptr<NodeImpl> NodeImplPtr;
50 class CharacterDataImpl;
51 class AttrImpl;
52 typedef Ptr<AttrImpl> AttrImplPtr;
53 class ElementImpl;
54 typedef Ptr<ElementImpl> ElementImplPtr;
55 class TextImpl;
56 class CommentImpl;
57 class TypeInfoImpl;
58 class UserDataHandlerImpl;
59 class DOMErrorImpl;
60 class DOMErrorHandlerImpl;
61 class DOMLocatorImpl;
62 class DOMConfigurationImpl;
63 class CDATASectionImpl;
64 class DocumentTypeImpl;
65 typedef Ptr<DocumentTypeImpl> DocumentTypeImplPtr;
66 class NotationImpl;
67 class EntityImpl;
68 class EntityReferenceImpl;
69 class ProcessingInstructionImpl;
70 class DocumentFragmentImpl;
71 class DocumentImpl;
72 typedef Ptr<DocumentImpl> DocumentImplPtr;
76 /*#########################################################################
77 ## DOMImplementationSourceImpl
78 #########################################################################*/
80 class DOMImplementationSourceImpl : public DOMImplementationSource
81 {
82 public:
84 /**
85 *
86 */
87 virtual DOMImplementation *getDOMImplementation(const DOMString &features);
89 /**
90 *
91 */
92 virtual DOMImplementationList getDOMImplementationList(const DOMString &features);
95 //##################
96 //# Non-API methods
97 //##################
99 /**
100 *
101 */
102 DOMImplementationSourceImpl();
104 /**
105 *
106 */
107 virtual ~DOMImplementationSourceImpl();
109 protected:
112 DOMImplementationImpl *domImpl;
113 DOMImplementationList domImplList;
114 };
120 /*#########################################################################
121 ## DOMImplementationImpl
122 #########################################################################*/
123 /**
124 *
125 */
126 class DOMImplementationImpl : public DOMImplementation
127 {
128 public:
131 /**
132 *
133 */
134 DOMImplementationImpl();
136 /**
137 *
138 */
139 virtual ~DOMImplementationImpl();
141 /**
142 *
143 */
144 virtual bool hasFeature(const DOMString& feature, const DOMString& version);
147 /**
148 *
149 */
150 virtual DocumentTypePtr createDocumentType(const DOMString& qualifiedName,
151 const DOMString& publicId,
152 const DOMString& systemId)
153 throw(DOMException);
155 /**
156 *
157 */
158 virtual DocumentPtr createDocument(const DOMString& namespaceURI,
159 const DOMString& qualifiedName,
160 DocumentTypePtr doctype)
161 throw(DOMException);
162 /**
163 *
164 */
165 virtual DOMObject *getFeature(const DOMString& feature,
166 const DOMString& version);
169 protected:
171 };
176 /*#########################################################################
177 ## NodeImpl
178 #########################################################################*/
180 /**
181 *
182 */
183 class NodeImpl : virtual public Node
184 {
186 friend class DocumentImpl;
188 public:
190 /**
191 *
192 */
193 virtual DOMString getNodeName();
195 /**
196 *
197 */
198 virtual DOMString getNodeValue() throw (DOMException);
200 /**
201 *
202 */
203 virtual void setNodeValue(const DOMString& val) throw (DOMException);
205 /**
206 *
207 */
208 virtual unsigned short getNodeType();
210 /**
211 *
212 */
213 virtual NodePtr getParentNode();
215 /**
216 *
217 */
218 virtual NodeList getChildNodes();
220 /**
221 *
222 */
223 virtual NodePtr getFirstChild();
225 /**
226 *
227 */
228 virtual NodePtr getLastChild();
230 /**
231 *
232 */
233 virtual NodePtr getPreviousSibling();
235 /**
236 *
237 */
238 virtual NodePtr getNextSibling();
240 /**
241 *
242 */
243 virtual NamedNodeMap &getAttributes();
246 /**
247 *
248 */
249 virtual DocumentPtr getOwnerDocument();
251 /**
252 *
253 */
254 virtual NodePtr insertBefore(const NodePtr newChild,
255 const NodePtr refChild)
256 throw(DOMException);
258 /**
259 *
260 */
261 virtual NodePtr replaceChild(const NodePtr newChild,
262 const NodePtr oldChild)
263 throw(DOMException);
265 /**
266 *
267 */
268 virtual NodePtr removeChild(const NodePtr oldChild)
269 throw(DOMException);
271 /**
272 *
273 */
274 virtual NodePtr appendChild(const NodePtr newChild)
275 throw(DOMException);
277 /**
278 *
279 */
280 virtual bool hasChildNodes();
282 /**
283 *
284 */
285 virtual NodePtr cloneNode(bool deep);
287 /**
288 *
289 */
290 virtual void normalize();
292 /**
293 *
294 */
295 virtual bool isSupported(const DOMString& feature,
296 const DOMString& version);
298 /**
299 *
300 */
301 virtual DOMString getNamespaceURI();
303 /**
304 *
305 */
306 virtual DOMString getPrefix();
308 /**
309 *
310 */
311 virtual void setPrefix(const DOMString& val) throw(DOMException);
313 /**
314 *
315 */
316 virtual DOMString getLocalName();
318 /**
319 *
320 */
321 virtual bool hasAttributes();
323 /**
324 *
325 */
326 virtual DOMString getBaseURI();
328 /**
329 *
330 */
331 virtual unsigned short compareDocumentPosition(const NodePtr other);
333 /**
334 *
335 */
336 virtual DOMString getTextContent() throw(DOMException);
339 /**
340 *
341 */
342 virtual void setTextContent(const DOMString &val) throw(DOMException);
345 /**
346 *
347 */
348 virtual DOMString lookupPrefix(const DOMString &namespaceURI);
351 /**
352 *
353 */
354 virtual bool isDefaultNamespace(const DOMString &namespaceURI);
357 /**
358 *
359 */
360 virtual DOMString lookupNamespaceURI(const DOMString &prefix);
363 /**
364 *
365 */
366 virtual bool isEqualNode(const NodePtr node);
370 /**
371 *
372 */
373 virtual DOMObject *getFeature(const DOMString &feature,
374 const DOMString &version);
376 /**
377 *
378 */
379 virtual DOMUserData *setUserData(const DOMString &key,
380 const DOMUserData *data,
381 const UserDataHandler *handler);
384 /**
385 *
386 */
387 virtual DOMUserData *getUserData(const DOMString &key);
390 //##################
391 //# Non-API methods
392 //##################
394 /**
395 *
396 */
397 virtual void bindingsAdd(const DOMString &prefix, const DOMString &namespaceURI)
398 {
399 bindings[prefix] = namespaceURI;
400 }
402 /**
403 *
404 */
405 virtual void bindingsClear()
406 {
407 bindings.clear();
408 }
410 DOMString bindingsFind(const DOMString &prefix)
411 {
412 std::map<DOMString, DOMString>::iterator iter =
413 bindings.find(prefix);
414 if (iter != bindings.end())
415 {
416 DOMString ret = iter->second;
417 return ret;
418 }
419 if (parent.get())
420 {
421 DOMString ret = parent->bindingsFind(prefix);
422 if (ret.size() > 0)
423 return ret;
424 }
425 return "";
426 }
428 /**
429 *
430 */
431 virtual void setNodeName(const DOMString &qualifiedName);
433 /**
434 *
435 */
436 virtual void setNamespaceURI(const DOMString &theNamespaceURI);
438 /**
439 *
440 */
441 DOMString lookupNamespacePrefix(const DOMString &namespaceURI,
442 NodePtr originalElement);
443 /**
444 *
445 */
446 NodeImpl();
448 /**
449 *
450 */
451 NodeImpl(const NodeImpl &other);
453 /**
454 *
455 */
456 NodeImpl &operator=(const NodeImpl &other);
458 /**
459 *
460 */
461 NodeImpl(DocumentImplPtr owner);
463 /**
464 *
465 */
466 NodeImpl(DocumentImplPtr owner, const DOMString &nodeName);
468 /**
469 *
470 */
471 NodeImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
472 const DOMString &nodeName);
474 /**
475 *
476 */
477 virtual ~NodeImpl();
480 /**
481 *
482 */
483 void assign(const NodeImpl &other);
485 protected:
487 /**
488 * Set up the internal values
489 */
490 void init();
492 unsigned short nodeType;
494 NodeImplPtr parent;
496 NodeImplPtr prev;
498 NodeImplPtr next;
500 DOMUserData *userData;
502 DOMString prefix;
504 DOMString localName;
506 DOMString nodeName;
508 DOMString namespaceURI;
510 DOMString baseURI;
512 DOMString nodeValue;
514 NodeImplPtr firstChild;
515 NodeImplPtr lastChild;
517 DocumentImplPtr ownerDocument;
519 NamedNodeMap attributes;
521 class UserDataEntry
522 {
523 public:
524 UserDataEntry(const DOMString &theKey,
525 const DOMUserData *theData,
526 const UserDataHandler *theHandler)
527 {
528 next = NULL;
529 key = theKey;
530 data = (DOMUserData *)theData;
531 handler = (UserDataHandler *)theHandler;
532 }
534 virtual ~UserDataEntry()
535 {
536 //delete anything after me, too
537 if (next)
538 delete next;
539 }
541 UserDataEntry *next;
542 DOMString key;
543 DOMUserData *data;
544 UserDataHandler *handler;
545 };
547 UserDataEntry *userDataEntries;
549 TypeInfo typeInfo;
551 //### Our prefix->namespaceURI bindings
553 std::map<DOMString, DOMString> bindings;
556 };
560 /*#########################################################################
561 ## CharacterDataImpl
562 #########################################################################*/
564 /**
565 *
566 */
567 class CharacterDataImpl : virtual public CharacterData, protected NodeImpl
568 {
569 public:
571 /**
572 *
573 */
574 virtual DOMString getData() throw(DOMException);
576 /**
577 *
578 */
579 virtual void setData(const DOMString& val) throw(DOMException);
581 /**
582 *
583 */
584 virtual unsigned long getLength();
586 /**
587 *
588 */
589 virtual DOMString substringData(unsigned long offset,
590 unsigned long count)
591 throw(DOMException);
593 /**
594 *
595 */
596 virtual void appendData(const DOMString& arg) throw(DOMException);
598 /**
599 *
600 */
601 virtual void insertData(unsigned long offset,
602 const DOMString& arg)
603 throw(DOMException);
605 /**
606 *
607 */
608 virtual void deleteData(unsigned long offset,
609 unsigned long count)
610 throw(DOMException);
612 /**
613 *
614 */
615 virtual void replaceData(unsigned long offset,
616 unsigned long count,
617 const DOMString& arg)
618 throw(DOMException);
621 //##################
622 //# Non-API methods
623 //##################
625 /**
626 *
627 */
628 CharacterDataImpl();
631 /**
632 *
633 */
634 CharacterDataImpl(DocumentImplPtr owner, const DOMString &value);
636 /**
637 *
638 */
639 virtual ~CharacterDataImpl();
641 protected:
643 //'data' is the nodeValue
645 };
651 /*#########################################################################
652 ## AttrImpl
653 #########################################################################*/
655 /**
656 *
657 */
658 class AttrImpl : virtual public Attr, public NodeImpl
659 {
660 public:
662 /**
663 *
664 */
665 virtual DOMString getName();
667 /**
668 *
669 */
670 virtual bool getSpecified();
672 /**
673 *
674 */
675 virtual DOMString getValue();
677 /**
678 *
679 */
680 virtual void setValue(const DOMString& val) throw(DOMException);
682 /**
683 *
684 */
685 virtual ElementPtr getOwnerElement();
688 /**
689 *
690 */
691 virtual TypeInfo &getSchemaTypeInfo();
694 /**
695 *
696 */
697 virtual bool getIsId();
701 //##################
702 //# Non-API methods
703 //##################
705 /**
706 *
707 */
708 virtual void setOwnerElement(const ElementPtr elem);
710 /**
711 *
712 */
713 AttrImpl(DocumentImplPtr owner, const DOMString &name);
715 /**
716 *
717 */
718 AttrImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
719 const DOMString &name);
721 /**
722 *
723 */
724 virtual ~AttrImpl();
726 protected:
729 ElementPtr ownerElement;
732 };
738 /*#########################################################################
739 ## ElementImpl
740 #########################################################################*/
742 /**
743 *
744 */
745 class ElementImpl : virtual public Element, public NodeImpl
746 {
747 public:
749 /**
750 *
751 */
752 virtual DOMString getTagName();
754 /**
755 *
756 */
757 virtual DOMString getAttribute(const DOMString& name);
759 /**
760 *
761 */
762 virtual void setAttribute(const DOMString& name,
763 const DOMString& value)
764 throw(DOMException);
766 /**
767 *
768 */
769 virtual void removeAttribute(const DOMString& name)
770 throw(DOMException);
772 /**
773 *
774 */
775 virtual AttrPtr getAttributeNode(const DOMString& name);
777 /**
778 *
779 */
780 virtual AttrPtr setAttributeNode(AttrPtr newAttr)
781 throw(DOMException);
783 /**
784 *
785 */
786 virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
787 throw(DOMException);
789 /**
790 *
791 */
792 virtual NodeList getElementsByTagName(const DOMString& name);
794 /**
795 *
796 */
797 virtual DOMString getAttributeNS(const DOMString& namespaceURI,
798 const DOMString& localName);
800 /**
801 *
802 */
803 virtual void setAttributeNS(const DOMString& namespaceURI,
804 const DOMString& qualifiedName,
805 const DOMString& value)
806 throw(DOMException);
808 /**
809 *
810 */
811 virtual void removeAttributeNS(const DOMString& namespaceURI,
812 const DOMString& localName)
813 throw(DOMException);
815 /**
816 *
817 */
818 virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
819 const DOMString& localName);
821 /**
822 *
823 */
824 virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
825 throw(DOMException);
827 /**
828 *
829 */
830 virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
831 const DOMString& localName);
833 /**
834 *
835 */
836 virtual bool hasAttribute(const DOMString& name);
838 /**
839 *
840 */
841 virtual bool hasAttributeNS(const DOMString& namespaceURI,
842 const DOMString& localName);
844 /**
845 *
846 */
847 virtual TypeInfo &getSchemaTypeInfo();
850 /**
851 *
852 */
853 virtual void setIdAttribute(const DOMString &name,
854 bool isId) throw (DOMException);
856 /**
857 *
858 */
859 virtual void setIdAttributeNS(const DOMString &namespaceURI,
860 const DOMString &localName,
861 bool isId) throw (DOMException);
863 /**
864 *
865 */
866 virtual void setIdAttributeNode(const AttrPtr idAttr,
867 bool isId) throw (DOMException);
871 //##################
872 //# Non-API methods
873 //##################
876 /**
877 *
878 */
879 ElementImpl();
881 /**
882 *
883 */
884 ElementImpl(DocumentImplPtr owner, const DOMString &tagName);
886 /**
887 *
888 */
889 ElementImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
890 const DOMString &tagName);
892 /**
893 *
894 */
895 virtual ~ElementImpl();
897 /**
898 *
899 */
900 void normalizeNamespaces();
902 protected:
904 friend class DocumentImpl;
906 static void getElementsByTagNameRecursive(NodeList &list,
907 const DOMString& name, ElementPtr elem);
908 static void getElementsByTagNameNSRecursive(NodeList &list,
909 const DOMString& namespaceURI, const DOMString& tagName,
910 ElementPtr elem);
911 };
917 /*#########################################################################
918 ## TextImpl
919 #########################################################################*/
921 /**
922 *
923 */
924 class TextImpl : virtual public Text, protected CharacterDataImpl
925 {
926 public:
928 /**
929 *
930 */
931 virtual TextPtr splitText(unsigned long offset)
932 throw(DOMException);
934 /**
935 *
936 */
937 virtual bool getIsElementContentWhitespace();
939 /**
940 *
941 */
942 virtual DOMString getWholeText();
945 /**
946 *
947 */
948 virtual TextPtr replaceWholeText(const DOMString &content)
949 throw(DOMException);
951 //##################
952 //# Non-API methods
953 //##################
955 /**
956 *
957 */
958 TextImpl();
961 /**
962 *
963 */
964 TextImpl(DocumentImplPtr owner, const DOMString &val);
966 /**
967 *
968 */
969 virtual ~TextImpl();
971 protected:
973 };
977 /*#########################################################################
978 ## CommentImpl
979 #########################################################################*/
981 /**
982 *
983 */
984 class CommentImpl : virtual public Comment, protected CharacterDataImpl
985 {
986 public:
988 //##################
989 //# Non-API methods
990 //##################
992 /**
993 *
994 */
995 CommentImpl();
997 /**
998 *
999 */
1000 CommentImpl(DocumentImplPtr owner, const DOMString &theValue);
1002 /**
1003 *
1004 */
1005 virtual ~CommentImpl();
1006 };
1010 /*#########################################################################
1011 ## TypeInfoImpl
1012 #########################################################################*/
1014 /**
1015 *
1016 */
1017 class TypeInfoImpl : public TypeInfo
1018 {
1019 public:
1021 /**
1022 *
1023 */
1024 virtual DOMString getTypeName();
1026 /**
1027 *
1028 */
1029 virtual DOMString getTypeNamespace();
1031 /**
1032 *
1033 */
1034 virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
1035 const DOMString &typeNameArg,
1036 const DerivationMethod derivationMethod);
1039 //##################
1040 //# Non-API methods
1041 //##################
1044 /**
1045 *
1046 */
1047 TypeInfoImpl(const DOMString &typeNamespaceArg,
1048 const DOMString &typeNameArg,
1049 const DerivationMethod derivationMethod);
1051 /**
1052 *
1053 */
1054 virtual ~TypeInfoImpl();
1056 protected:
1058 DOMString typeName;
1060 DOMString typeNamespace;
1062 unsigned short derivationMethod;
1064 };
1069 /*#########################################################################
1070 ## UserDataHandlerImpl
1071 #########################################################################*/
1073 /**
1074 *
1075 */
1076 class UserDataHandlerImpl : public UserDataHandler
1077 {
1078 public:
1080 /**
1081 *
1082 */
1083 virtual void handle(unsigned short operation,
1084 const DOMString &key,
1085 const DOMUserData *data,
1086 const NodePtr src,
1087 const NodePtr dst);
1089 //##################
1090 //# Non-API methods
1091 //##################
1094 protected:
1096 /**
1097 *
1098 */
1099 UserDataHandlerImpl();
1101 /**
1102 *
1103 */
1104 virtual ~UserDataHandlerImpl();
1105 };
1108 /*#########################################################################
1109 ## DOMErrorImpl
1110 #########################################################################*/
1112 /**
1113 *
1114 */
1115 class DOMErrorImpl : public DOMError
1116 {
1117 public:
1119 /**
1120 *
1121 */
1122 virtual unsigned short getSeverity();
1124 /**
1125 *
1126 */
1127 virtual DOMString getMessage();
1129 /**
1130 *
1131 */
1132 virtual DOMString getType();
1134 /**
1135 *
1136 */
1137 virtual DOMObject *getRelatedException();
1139 /**
1140 *
1141 */
1142 virtual DOMObject *getRelatedData();
1144 /**
1145 *
1146 */
1147 virtual DOMLocator *getLocation();
1150 //##################
1151 //# Non-API methods
1152 //##################
1155 protected:
1157 /**
1158 *
1159 */
1160 DOMErrorImpl();
1162 /**
1163 *
1164 */
1165 virtual ~DOMErrorImpl();
1167 unsigned short severity;
1169 DOMString message;
1171 DOMString type;
1174 };
1177 /*#########################################################################
1178 ## DOMErrorHandlerImpl
1179 #########################################################################*/
1181 /**
1182 *
1183 */
1184 class DOMErrorHandlerImpl : public DOMErrorHandler
1185 {
1186 public:
1188 /**
1189 *
1190 */
1191 virtual bool handleError(const DOMError *error);
1195 //##################
1196 //# Non-API methods
1197 //##################
1201 protected:
1203 /**
1204 *
1205 */
1206 DOMErrorHandlerImpl();
1208 /**
1209 *
1210 */
1211 virtual ~DOMErrorHandlerImpl();
1214 };
1218 /*#########################################################################
1219 ## DOMLocatorImpl
1220 #########################################################################*/
1222 /**
1223 *
1224 */
1225 class DOMLocatorImpl : public DOMLocator
1226 {
1227 public:
1229 /**
1230 *
1231 */
1232 virtual long getLineNumber();
1234 /**
1235 *
1236 */
1237 virtual long getColumnNumber();
1239 /**
1240 *
1241 */
1242 virtual long getByteOffset();
1244 /**
1245 *
1246 */
1247 virtual long getUtf16Offset();
1250 /**
1251 *
1252 */
1253 virtual NodePtr getRelatedNode();
1256 /**
1257 *
1258 */
1259 virtual DOMString getUri();
1263 //##################
1264 //# Non-API methods
1265 //##################
1268 /**
1269 *
1270 */
1271 DOMLocatorImpl();
1273 /**
1274 *
1275 */
1276 virtual ~DOMLocatorImpl();
1278 protected:
1281 long lineNumber;
1283 long columnNumber;
1285 long byteOffset;
1287 long utf16Offset;
1289 NodePtr relatedNode;
1291 DOMString uri;
1292 };
1295 /*#########################################################################
1296 ## DOMConfigurationImpl
1297 #########################################################################*/
1299 /**
1300 *
1301 */
1302 class DOMConfigurationImpl : public DOMConfiguration
1303 {
1304 public:
1306 /**
1307 *
1308 */
1309 virtual void setParameter(const DOMString &name,
1310 const DOMUserData *value) throw (DOMException);
1312 /**
1313 *
1314 */
1315 virtual DOMUserData *getParameter(const DOMString &name)
1316 throw (DOMException);
1318 /**
1319 *
1320 */
1321 virtual bool canSetParameter(const DOMString &name,
1322 const DOMUserData *data);
1324 /**
1325 *
1326 */
1327 virtual DOMStringList *getParameterNames();
1330 //##################
1331 //# Non-API methods
1332 //##################
1334 /**
1335 *
1336 */
1337 DOMConfigurationImpl();
1339 /**
1340 *
1341 */
1342 virtual ~DOMConfigurationImpl();
1344 protected:
1346 };
1353 /*#########################################################################
1354 ## CDATASectionImpl
1355 #########################################################################*/
1356 /**
1357 *
1358 */
1359 class CDATASectionImpl : public CDATASection, public TextImpl
1360 {
1361 public:
1363 //##################
1364 //# Non-API methods
1365 //##################
1367 /**
1368 *
1369 */
1370 CDATASectionImpl();
1373 /**
1374 *
1375 */
1376 CDATASectionImpl(DocumentImplPtr owner, const DOMString &value);
1378 /**
1379 *
1380 */
1381 virtual ~CDATASectionImpl();
1383 };
1388 /*#########################################################################
1389 ## DocumentTypeImpl
1390 #########################################################################*/
1392 /**
1393 *
1394 */
1395 class DocumentTypeImpl : public DocumentType, public NodeImpl
1396 {
1397 public:
1399 /**
1400 *
1401 */
1402 virtual DOMString getName();
1404 /**
1405 *
1406 */
1407 virtual NamedNodeMap getEntities();
1409 /**
1410 *
1411 */
1412 virtual NamedNodeMap getNotations();
1414 /**
1415 *
1416 */
1417 virtual DOMString getPublicId();
1419 /**
1420 *
1421 */
1422 virtual DOMString getSystemId();
1424 /**
1425 *
1426 */
1427 virtual DOMString getInternalSubset();
1429 //##################
1430 //# Non-API methods
1431 //##################
1433 /**
1434 *
1435 */
1436 DocumentTypeImpl();
1438 /**
1439 *
1440 */
1441 DocumentTypeImpl(const DOMString& name,
1442 const DOMString& publicId,
1443 const DOMString& systemId);
1444 /**
1445 *
1446 */
1447 virtual ~DocumentTypeImpl();
1450 protected:
1451 DOMString name;
1452 DOMString publicId;
1453 DOMString systemId;
1455 NamedNodeMap entities;
1456 NamedNodeMap notations;
1458 };
1464 /*#########################################################################
1465 ## NotationImpl
1466 #########################################################################*/
1468 /**
1469 *
1470 */
1471 class NotationImpl : public Notation, public NodeImpl
1472 {
1473 public:
1475 /**
1476 *
1477 */
1478 virtual DOMString getPublicId();
1480 /**
1481 *
1482 */
1483 virtual DOMString getSystemId();
1486 //##################
1487 //# Non-API methods
1488 //##################
1490 /**
1491 *
1492 */
1493 NotationImpl();
1495 /**
1496 *
1497 */
1498 NotationImpl(DocumentImplPtr owner);
1500 /**
1501 *
1502 */
1503 virtual ~NotationImpl();
1506 protected:
1510 DOMString publicId;
1512 DOMString systemId;
1513 };
1520 /*#########################################################################
1521 ## EntityImpl
1522 #########################################################################*/
1524 /**
1525 *
1526 */
1527 class EntityImpl : public Entity, public NodeImpl
1528 {
1529 public:
1531 /**
1532 *
1533 */
1534 virtual DOMString getPublicId();
1536 /**
1537 *
1538 */
1539 virtual DOMString getSystemId();
1541 /**
1542 *
1543 */
1544 virtual DOMString getNotationName();
1546 /**
1547 *
1548 */
1549 virtual DOMString getInputEncoding();
1551 /**
1552 *
1553 */
1554 virtual DOMString getXmlEncoding();
1556 /**
1557 *
1558 */
1559 virtual DOMString getXmlVersion();
1562 //##################
1563 //# Non-API methods
1564 //##################
1566 /**
1567 *
1568 */
1569 EntityImpl();
1572 /**
1573 *
1574 */
1575 EntityImpl(DocumentImplPtr owner);
1577 /**
1578 *
1579 */
1580 virtual ~EntityImpl();
1582 protected:
1586 DOMString publicId;
1588 DOMString systemId;
1590 DOMString notationName;
1592 DOMString inputEncoding;
1594 DOMString xmlEncoding;
1596 DOMString xmlVersion;
1598 };
1604 /*#########################################################################
1605 ## EntityReferenceImpl
1606 #########################################################################*/
1607 /**
1608 *
1609 */
1610 class EntityReferenceImpl : public EntityReference, public NodeImpl
1611 {
1612 public:
1614 //##################
1615 //# Non-API methods
1616 //##################
1618 /**
1619 *
1620 */
1621 EntityReferenceImpl();
1624 /**
1625 *
1626 */
1627 EntityReferenceImpl(DocumentImplPtr owner, const DOMString &theName);
1629 /**
1630 *
1631 */
1632 virtual ~EntityReferenceImpl();
1634 };
1640 /*#########################################################################
1641 ## ProcessingInstructionImpl
1642 #########################################################################*/
1644 /**
1645 *
1646 */
1647 class ProcessingInstructionImpl :
1648 public ProcessingInstruction,
1649 public NodeImpl
1650 {
1651 public:
1653 /**
1654 *
1655 */
1656 virtual DOMString getTarget();
1658 /**
1659 *
1660 */
1661 virtual DOMString getData();
1663 /**
1664 *
1665 */
1666 virtual void setData(const DOMString& val) throw(DOMException);
1669 //##################
1670 //# Non-API methods
1671 //##################
1674 /**
1675 *
1676 */
1677 ProcessingInstructionImpl();
1680 /**
1681 *
1682 */
1683 ProcessingInstructionImpl(DocumentImplPtr owner,
1684 const DOMString &target,
1685 const DOMString &data);
1687 /**
1688 *
1689 */
1690 virtual ~ProcessingInstructionImpl();
1693 protected:
1696 //'target' is nodeName
1698 //'data' is nodeValue
1701 };
1707 /*#########################################################################
1708 ## DocumentFragmentImpl
1709 #########################################################################*/
1710 /**
1711 *
1712 */
1713 class DocumentFragmentImpl : public DocumentFragment, public NodeImpl
1714 {
1716 public:
1718 //##################
1719 //# Non-API methods
1720 //##################
1722 /**
1723 *
1724 */
1725 DocumentFragmentImpl();
1727 /**
1728 *
1729 */
1730 DocumentFragmentImpl(DocumentImplPtr owner);
1732 /**
1733 *
1734 */
1735 virtual ~DocumentFragmentImpl();
1737 };
1744 /*#########################################################################
1745 ## DocumentImpl
1746 #########################################################################*/
1748 /**
1749 *
1750 */
1751 class DocumentImpl : virtual public Document, public NodeImpl
1752 {
1753 public:
1755 /**
1756 *
1757 */
1758 virtual DocumentTypePtr getDoctype();
1760 /**
1761 *
1762 */
1763 virtual DOMImplementation *getImplementation();
1765 /**
1766 *
1767 */
1768 virtual ElementPtr getDocumentElement();
1770 /**
1771 *
1772 */
1773 virtual ElementPtr createElement(const DOMString& tagName)
1774 throw(DOMException);
1776 /**
1777 *
1778 */
1779 virtual DocumentFragmentPtr createDocumentFragment();
1781 /**
1782 *
1783 */
1784 virtual TextPtr createTextNode(const DOMString& data);
1786 /**
1787 *
1788 */
1789 virtual CommentPtr createComment(const DOMString& data);
1791 /**
1792 *
1793 */
1794 virtual CDATASectionPtr createCDATASection(const DOMString& data)
1795 throw(DOMException);
1797 /**
1798 *
1799 */
1800 virtual ProcessingInstructionPtr createProcessingInstruction(
1801 const DOMString& target,
1802 const DOMString& data)
1803 throw(DOMException);
1805 /**
1806 *
1807 */
1808 virtual AttrPtr createAttribute(const DOMString& name)
1809 throw(DOMException);
1811 /**
1812 *
1813 */
1814 virtual EntityReferencePtr createEntityReference(const DOMString& name)
1815 throw(DOMException);
1817 /**
1818 *
1819 */
1820 virtual NodeList getElementsByTagName(const DOMString& tagname);
1823 /**
1824 *
1825 */
1826 virtual NodePtr importNode(const NodePtr importedNode,
1827 bool deep)
1828 throw(DOMException);
1830 /**
1831 *
1832 */
1833 virtual ElementPtr createElementNS(const DOMString& namespaceURI,
1834 const DOMString& qualifiedName)
1835 throw(DOMException);
1837 /**
1838 *
1839 */
1840 virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
1841 const DOMString& qualifiedName)
1842 throw(DOMException);
1844 /**
1845 *
1846 */
1847 virtual NodeList getElementsByTagNameNS(const DOMString& namespaceURI,
1848 const DOMString& localName);
1850 /**
1851 *
1852 */
1853 virtual ElementPtr getElementById(const DOMString& elementId);
1856 /**
1857 *
1858 */
1859 virtual DOMString getInputEncoding();
1862 /**
1863 *
1864 */
1865 virtual DOMString getXmlEncoding();
1867 /**
1868 *
1869 */
1870 virtual bool getXmlStandalone();
1872 /**
1873 *
1874 */
1875 virtual void setXmlStandalone(bool val) throw (DOMException);
1877 /**
1878 *
1879 */
1880 virtual DOMString getXmlVersion();
1882 /**
1883 *
1884 */
1885 virtual void setXmlVersion(const DOMString &version) throw (DOMException);
1887 /**
1888 *
1889 */
1890 virtual bool getStrictErrorChecking();
1892 /**
1893 *
1894 */
1895 virtual void setStrictErrorChecking(bool val);
1898 /**
1899 *
1900 */
1901 virtual DOMString getDocumentURI();
1903 /**
1904 *
1905 */
1906 virtual void setDocumentURI(const DOMString &uri);
1908 /**
1909 *
1910 */
1911 virtual NodePtr adoptNode(const NodePtr source) throw (DOMException);
1913 /**
1914 *
1915 */
1916 virtual DOMConfiguration *getDomConfig();
1918 /**
1919 *
1920 */
1921 virtual void normalizeDocument();
1923 /**
1924 *
1925 */
1926 virtual NodePtr renameNode(const NodePtr n,
1927 const DOMString &name,
1928 const DOMString &qualifiedName)
1929 throw (DOMException);
1932 //##################
1933 //# Non-API methods
1934 //##################
1936 DocumentImpl(const DOMImplementation *domImpl,
1937 const DOMString &namespaceURI,
1938 const DOMString &qualifiedName,
1939 const DocumentTypePtr doctype);
1941 virtual ~DocumentImpl();
1944 DOMString *stringCache(const DOMString &val);
1946 int namespaceIndex;
1948 protected:
1950 DOMImplementation *parent;
1952 DOMString documentURI;
1954 DOMString qualifiedName;
1956 DocumentTypePtr doctype;
1958 ElementImplPtr documentElement;
1960 class NamedElementItem
1961 {
1962 public:
1963 NamedElementItem()
1964 {
1965 next = NULL;
1966 }
1967 NamedElementItem(const DOMString &nameArg, ElementPtr elemArg)
1968 {
1969 next = NULL;
1970 name = nameArg;
1971 elem = elemArg;
1972 }
1973 ~NamedElementItem()
1974 {
1975 if (next)
1976 delete next;
1977 }
1978 NamedElementItem *next;
1979 DOMString name;
1980 ElementPtr elem;
1981 };
1983 NamedElementItem elementsById;
1986 DOMString xmlEncoding;
1988 DOMString inputEncoding;
1990 DOMString xmlVersion;
1992 bool xmlStandalone;
1994 bool strictErrorChecking;
1996 DOMConfiguration *domConfig;
1998 NamedNodeMap namespaceURIs;
2001 };
2013 } //namespace dom
2014 } //namespace w3c
2015 } //namespace org
2018 #endif // __DOMIMPL_H__
2021 /*#########################################################################
2022 ## E N D O F F I L E
2023 #########################################################################*/