| 1 | // |
| 2 | // ProcessingInstruction.h |
| 3 | // |
| 4 | // Library: XML |
| 5 | // Package: DOM |
| 6 | // Module: DOM |
| 7 | // |
| 8 | // Definition of the DOM ProcessingInstruction 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_ProcessingInstruction_INCLUDED |
| 18 | #define DOM_ProcessingInstruction_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/XML/XML.h" |
| 22 | #include "Poco/DOM/AbstractNode.h" |
| 23 | #include "Poco/XML/XMLString.h" |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | namespace XML { |
| 28 | |
| 29 | |
| 30 | class XML_API ProcessingInstruction: public AbstractNode |
| 31 | /// The ProcessingInstruction interface represents a "processing instruction", |
| 32 | /// used in XML as a way to keep processor-specific information in the text |
| 33 | /// of the document. |
| 34 | { |
| 35 | public: |
| 36 | const XMLString& target() const; |
| 37 | /// Returns the target of this processing instruction. |
| 38 | /// XML defines this as being the first token following |
| 39 | /// the markup that begins the processing instruction. |
| 40 | |
| 41 | const XMLString& data() const; |
| 42 | /// Returns the content of this processing instruction. This is from the first non |
| 43 | /// white space character after the target to the character immediately preceding |
| 44 | /// the ?>. |
| 45 | |
| 46 | const XMLString& getData() const; |
| 47 | /// Returns the content of this processing instruction. This is from the first non |
| 48 | /// white space character after the target to the character immediately preceding |
| 49 | /// the ?>. |
| 50 | |
| 51 | void setData(const XMLString& data); |
| 52 | /// Sets the content of this processing instruction. |
| 53 | |
| 54 | // Node |
| 55 | const XMLString& nodeName() const; |
| 56 | const XMLString& getNodeValue() const; |
| 57 | void setNodeValue(const XMLString& data); |
| 58 | unsigned short nodeType() const; |
| 59 | |
| 60 | protected: |
| 61 | ProcessingInstruction(Document* pOwnerDocument, const XMLString& target, const XMLString& data); |
| 62 | ProcessingInstruction(Document* pOwnerDocument, const ProcessingInstruction& processingInstruction); |
| 63 | ~ProcessingInstruction(); |
| 64 | |
| 65 | Node* copyNode(bool deep, Document* pOwnerDocument) const; |
| 66 | |
| 67 | private: |
| 68 | XMLString _target; |
| 69 | XMLString _data; |
| 70 | |
| 71 | friend class Document; |
| 72 | }; |
| 73 | |
| 74 | |
| 75 | // |
| 76 | // inlines |
| 77 | // |
| 78 | inline const XMLString& ProcessingInstruction::target() const |
| 79 | { |
| 80 | return _target; |
| 81 | } |
| 82 | |
| 83 | |
| 84 | inline const XMLString& ProcessingInstruction::data() const |
| 85 | { |
| 86 | return _data; |
| 87 | } |
| 88 | |
| 89 | |
| 90 | inline const XMLString& ProcessingInstruction::getData() const |
| 91 | { |
| 92 | return _data; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | } } // namespace Poco::XML |
| 97 | |
| 98 | |
| 99 | #endif // DOM_ProcessingInstruction_INCLUDED |
| 100 | |