| 1 | // | 
|---|
| 2 | // DocumentType.h | 
|---|
| 3 | // | 
|---|
| 4 | // Library: XML | 
|---|
| 5 | // Package: DOM | 
|---|
| 6 | // Module:  DOM | 
|---|
| 7 | // | 
|---|
| 8 | // Definition of the DOM DocumentType class. | 
|---|
| 9 | // | 
|---|
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | 
|---|
| 11 | // and Contributors. | 
|---|
| 12 | // | 
|---|
| 13 | // SPDX-License-Identifier:	BSL-1.0 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | #ifndef DOM_DocumentType_INCLUDED | 
|---|
| 18 | #define DOM_DocumentType_INCLUDED | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | #include "Poco/XML/XML.h" | 
|---|
| 22 | #include "Poco/DOM/AbstractContainerNode.h" | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 | namespace Poco { | 
|---|
| 26 | namespace XML { | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 | class NamedNodeMap; | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | class XML_API DocumentType: public AbstractContainerNode | 
|---|
| 33 | /// Each Document has a doctype attribute whose value is either null or a DocumentType | 
|---|
| 34 | /// object. The DocumentType interface in the DOM Level 1 Core provides an | 
|---|
| 35 | /// interface to the list of entities that are defined for the document, and | 
|---|
| 36 | /// little else because the effect of namespaces and the various XML scheme | 
|---|
| 37 | /// efforts on DTD representation are not clearly understood as of this writing. | 
|---|
| 38 | /// | 
|---|
| 39 | /// The DOM Level 1 doesn't support editing DocumentType nodes. | 
|---|
| 40 | { | 
|---|
| 41 | public: | 
|---|
| 42 | const XMLString& name() const; | 
|---|
| 43 | /// The name of the DTD; i.e., the name immediately following the | 
|---|
| 44 | /// DOCTYPE keyword. | 
|---|
| 45 |  | 
|---|
| 46 | NamedNodeMap* entities() const; | 
|---|
| 47 | /// A NamedNodeMap containing the general entities, | 
|---|
| 48 | /// both external and internal, declared in the DTD. | 
|---|
| 49 | /// Duplicates are discarded. | 
|---|
| 50 | /// | 
|---|
| 51 | /// Note: In this implementation, only the | 
|---|
| 52 | /// external entities are reported. | 
|---|
| 53 | /// Every node in this map also implements the | 
|---|
| 54 | /// Entity interface. | 
|---|
| 55 | /// | 
|---|
| 56 | /// The returned NamedNodeMap must be released with a call | 
|---|
| 57 | /// to release() when no longer needed. | 
|---|
| 58 |  | 
|---|
| 59 | NamedNodeMap* notations() const; | 
|---|
| 60 | /// A NamedNodeMap containing the notations declared in the DTD. Duplicates | 
|---|
| 61 | /// are discarded. Every node in this map also implements the Notation interface. | 
|---|
| 62 | /// The DOM Level 1 does not support editing notations, therefore notations | 
|---|
| 63 | /// cannot be altered in any way. | 
|---|
| 64 | /// | 
|---|
| 65 | /// The returned NamedNodeMap must be released with a call | 
|---|
| 66 | /// to release() when no longer needed. | 
|---|
| 67 |  | 
|---|
| 68 | // DOM Level 2 | 
|---|
| 69 | const XMLString& publicId() const; | 
|---|
| 70 | /// Returns the public identifier of the external DTD subset. | 
|---|
| 71 |  | 
|---|
| 72 | const XMLString& systemId() const; | 
|---|
| 73 | /// Returns the system identifier of the external DTD subset. | 
|---|
| 74 |  | 
|---|
| 75 | const XMLString& internalSubset() const; | 
|---|
| 76 | /// Returns the internal DTD subset. This implementation | 
|---|
| 77 | /// returns an empty string. | 
|---|
| 78 |  | 
|---|
| 79 | // Node | 
|---|
| 80 | const XMLString& nodeName() const; | 
|---|
| 81 | unsigned short nodeType() const; | 
|---|
| 82 |  | 
|---|
| 83 | protected: | 
|---|
| 84 | DocumentType(Document* pOwner, const XMLString& name, const XMLString& publicId, const XMLString& systemId); | 
|---|
| 85 | DocumentType(Document* pOwner, const DocumentType& dt); | 
|---|
| 86 | ~DocumentType(); | 
|---|
| 87 |  | 
|---|
| 88 | Node* copyNode(bool deep, Document* pOwnerDocument) const; | 
|---|
| 89 |  | 
|---|
| 90 | private: | 
|---|
| 91 | XMLString _name; | 
|---|
| 92 | XMLString _publicId; | 
|---|
| 93 | XMLString _systemId; | 
|---|
| 94 |  | 
|---|
| 95 | friend class DOMImplementation; | 
|---|
| 96 | friend class Document; | 
|---|
| 97 | friend class DOMBuilder; | 
|---|
| 98 | }; | 
|---|
| 99 |  | 
|---|
| 100 |  | 
|---|
| 101 | // | 
|---|
| 102 | // inlines | 
|---|
| 103 | // | 
|---|
| 104 | inline const XMLString& DocumentType::name() const | 
|---|
| 105 | { | 
|---|
| 106 | return _name; | 
|---|
| 107 | } | 
|---|
| 108 |  | 
|---|
| 109 |  | 
|---|
| 110 | inline const XMLString& DocumentType::publicId() const | 
|---|
| 111 | { | 
|---|
| 112 | return _publicId; | 
|---|
| 113 | } | 
|---|
| 114 |  | 
|---|
| 115 |  | 
|---|
| 116 | inline const XMLString& DocumentType::systemId() const | 
|---|
| 117 | { | 
|---|
| 118 | return _systemId; | 
|---|
| 119 | } | 
|---|
| 120 |  | 
|---|
| 121 |  | 
|---|
| 122 | } } // namespace Poco::XML | 
|---|
| 123 |  | 
|---|
| 124 |  | 
|---|
| 125 | #endif // DOM_DocumentType_INCLUDED | 
|---|
| 126 |  | 
|---|