/src/poco/XML/src/CDATASection.cpp
Line | Count | Source |
1 | | // |
2 | | // CDATASection.cpp |
3 | | // |
4 | | // Library: XML |
5 | | // Package: DOM |
6 | | // Module: DOM |
7 | | // |
8 | | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
9 | | // and Contributors. |
10 | | // |
11 | | // SPDX-License-Identifier: BSL-1.0 |
12 | | // |
13 | | |
14 | | |
15 | | #include "Poco/DOM/CDATASection.h" |
16 | | #include "Poco/DOM/Document.h" |
17 | | #include "Poco/DOM/DOMException.h" |
18 | | |
19 | | |
20 | | namespace Poco { |
21 | | namespace XML { |
22 | | |
23 | | |
24 | | const XMLString CDATASection::NODE_NAME = toXMLString("#cdata-section"); |
25 | | |
26 | | |
27 | | CDATASection::CDATASection(Document* pOwnerDocument, const XMLString& data): |
28 | 14.5k | Text(pOwnerDocument, data) |
29 | 14.5k | { |
30 | 14.5k | } |
31 | | |
32 | | |
33 | | CDATASection::CDATASection(Document* pOwnerDocument, const CDATASection& sec): |
34 | 0 | Text(pOwnerDocument, sec) |
35 | 0 | { |
36 | 0 | } |
37 | | |
38 | | |
39 | | CDATASection::~CDATASection() |
40 | 14.5k | { |
41 | 14.5k | } |
42 | | |
43 | | |
44 | | Text* CDATASection::splitText(unsigned long offset) |
45 | 0 | { |
46 | 0 | Node* pParent = parentNode(); |
47 | 0 | if (!pParent) throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); |
48 | 0 | int n = length() - offset; |
49 | 0 | Text* pNew = ownerDocument()->createCDATASection(substringData(offset, n)); |
50 | 0 | deleteData(offset, n); |
51 | 0 | pParent->insertBefore(pNew, nextSibling())->release(); |
52 | 0 | return pNew; |
53 | 0 | } |
54 | | |
55 | | |
56 | | const XMLString& CDATASection::nodeName() const |
57 | 0 | { |
58 | 0 | return NODE_NAME; |
59 | 0 | } |
60 | | |
61 | | |
62 | | unsigned short CDATASection::nodeType() const |
63 | 1.54M | { |
64 | 1.54M | return Node::CDATA_SECTION_NODE; |
65 | 1.54M | } |
66 | | |
67 | | |
68 | | Node* CDATASection::copyNode(bool deep, Document* pOwnerDocument) const |
69 | 0 | { |
70 | 0 | return new CDATASection(pOwnerDocument, *this); |
71 | 0 | } |
72 | | |
73 | | |
74 | | } } // namespace Poco::XML |