1 | // |
---|
2 | // DocumentType.h |
---|
3 | // |
---|
4 | // $Id: //poco/1.3/XML/include/Poco/DOM/DocumentType.h#1 $ |
---|
5 | // |
---|
6 | // Library: XML |
---|
7 | // Package: DOM |
---|
8 | // Module: DOM |
---|
9 | // |
---|
10 | // Definition of the DOM DocumentType class. |
---|
11 | // |
---|
12 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
---|
13 | // and Contributors. |
---|
14 | // |
---|
15 | // Permission is hereby granted, free of charge, to any person or organization |
---|
16 | // obtaining a copy of the software and accompanying documentation covered by |
---|
17 | // this license (the "Software") to use, reproduce, display, distribute, |
---|
18 | // execute, and transmit the Software, and to prepare derivative works of the |
---|
19 | // Software, and to permit third-parties to whom the Software is furnished to |
---|
20 | // do so, all subject to the following: |
---|
21 | // |
---|
22 | // The copyright notices in the Software and this entire statement, including |
---|
23 | // the above license grant, this restriction and the following disclaimer, |
---|
24 | // must be included in all copies of the Software, in whole or in part, and |
---|
25 | // all derivative works of the Software, unless such copies or derivative |
---|
26 | // works are solely in the form of machine-executable object code generated by |
---|
27 | // a source language processor. |
---|
28 | // |
---|
29 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
30 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
31 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
---|
32 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
---|
33 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
---|
34 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
35 | // DEALINGS IN THE SOFTWARE. |
---|
36 | // |
---|
37 | |
---|
38 | |
---|
39 | #ifndef DOM_DocumentType_INCLUDED |
---|
40 | #define DOM_DocumentType_INCLUDED |
---|
41 | |
---|
42 | |
---|
43 | #include "Poco/XML/XML.h" |
---|
44 | #include "Poco/DOM/AbstractContainerNode.h" |
---|
45 | |
---|
46 | |
---|
47 | namespace Poco { |
---|
48 | namespace XML { |
---|
49 | |
---|
50 | |
---|
51 | class NamedNodeMap; |
---|
52 | |
---|
53 | |
---|
54 | class XML_API DocumentType: public AbstractContainerNode |
---|
55 | /// Each Document has a doctype attribute whose value is either null or a DocumentType |
---|
56 | /// object. The DocumentType interface in the DOM Level 1 Core provides an |
---|
57 | /// interface to the list of entities that are defined for the document, and |
---|
58 | /// little else because the effect of namespaces and the various XML scheme |
---|
59 | /// efforts on DTD representation are not clearly understood as of this writing. |
---|
60 | /// |
---|
61 | /// The DOM Level 1 doesn't support editing DocumentType nodes. |
---|
62 | { |
---|
63 | public: |
---|
64 | const XMLString& name() const; |
---|
65 | /// The name of the DTD; i.e., the name immediately following the |
---|
66 | /// DOCTYPE keyword. |
---|
67 | |
---|
68 | NamedNodeMap* entities() const; |
---|
69 | /// A NamedNodeMap containing the general entities, |
---|
70 | /// both external and internal, declared in the DTD. |
---|
71 | /// Duplicates are discarded. |
---|
72 | /// |
---|
73 | /// Note: In this implementation, only the |
---|
74 | /// external entities are reported. |
---|
75 | /// Every node in this map also implements the |
---|
76 | /// Entity interface. |
---|
77 | /// |
---|
78 | /// The returned NamedNodeMap must be released with a call |
---|
79 | /// to release() when no longer needed. |
---|
80 | |
---|
81 | NamedNodeMap* notations() const; |
---|
82 | /// A NamedNodeMap containing the notations declared in the DTD. Duplicates |
---|
83 | /// are discarded. Every node in this map also implements the Notation interface. |
---|
84 | /// The DOM Level 1 does not support editing notations, therefore notations |
---|
85 | /// cannot be altered in any way. |
---|
86 | /// |
---|
87 | /// The returned NamedNodeMap must be released with a call |
---|
88 | /// to release() when no longer needed. |
---|
89 | |
---|
90 | // DOM Level 2 |
---|
91 | const XMLString& publicId() const; |
---|
92 | /// Returns the public identifier of the external DTD subset. |
---|
93 | |
---|
94 | const XMLString& systemId() const; |
---|
95 | /// Returns the system identifier of the external DTD subset. |
---|
96 | |
---|
97 | const XMLString& internalSubset() const; |
---|
98 | /// Returns the internal DTD subset. This implementation |
---|
99 | /// returns an empty string. |
---|
100 | |
---|
101 | // Node |
---|
102 | const XMLString& nodeName() const; |
---|
103 | unsigned short nodeType() const; |
---|
104 | |
---|
105 | protected: |
---|
106 | DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId); |
---|
107 | DocumentType(Document* pOwner, const DocumentType& dt); |
---|
108 | ~DocumentType(); |
---|
109 | |
---|
110 | Node* copyNode(bool deep, Document* pOwnerDocument) const; |
---|
111 | |
---|
112 | private: |
---|
113 | XMLString _name; |
---|
114 | XMLString _publicId; |
---|
115 | XMLString _systemId; |
---|
116 | |
---|
117 | friend class DOMImplementation; |
---|
118 | friend class Document; |
---|
119 | friend class DOMBuilder; |
---|
120 | }; |
---|
121 | |
---|
122 | |
---|
123 | // |
---|
124 | // inlines |
---|
125 | // |
---|
126 | inline const XMLString& DocumentType::name() const |
---|
127 | { |
---|
128 | return _name; |
---|
129 | } |
---|
130 | |
---|
131 | |
---|
132 | inline const XMLString& DocumentType::publicId() const |
---|
133 | { |
---|
134 | return _publicId; |
---|
135 | } |
---|
136 | |
---|
137 | |
---|
138 | inline const XMLString& DocumentType::systemId() const |
---|
139 | { |
---|
140 | return _systemId; |
---|
141 | } |
---|
142 | |
---|
143 | |
---|
144 | } } // namespace Poco::XML |
---|
145 | |
---|
146 | |
---|
147 | #endif // DOM_DocumentType_INCLUDED |
---|