| 1 | // |
|---|---|
| 2 | // DocumentFragment.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/DocumentFragment.h" |
| 16 | |
| 17 | |
| 18 | namespace Poco { |
| 19 | namespace XML { |
| 20 | |
| 21 | |
| 22 | const XMLString DocumentFragment::NODE_NAME = toXMLString("#document-fragment"); |
| 23 | |
| 24 | |
| 25 | DocumentFragment::DocumentFragment(Document* pOwnerDocument): |
| 26 | AbstractContainerNode(pOwnerDocument) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | |
| 31 | DocumentFragment::DocumentFragment( Document* pOwnerDocument, const DocumentFragment& fragment): |
| 32 | AbstractContainerNode(pOwnerDocument, fragment) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | |
| 37 | DocumentFragment::~DocumentFragment() |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | |
| 42 | const XMLString& DocumentFragment::nodeName() const |
| 43 | { |
| 44 | return NODE_NAME; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | unsigned short DocumentFragment::nodeType() const |
| 49 | { |
| 50 | return Node::DOCUMENT_FRAGMENT_NODE; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | Node* DocumentFragment::copyNode(bool deep, Document* pOwnerDocument) const |
| 55 | { |
| 56 | DocumentFragment* pClone = new DocumentFragment(pOwnerDocument, *this); |
| 57 | if (deep) |
| 58 | { |
| 59 | Node* pCur = firstChild(); |
| 60 | while (pCur) |
| 61 | { |
| 62 | pClone->appendChild(static_cast<AbstractNode*>(pCur)->copyNode(deep, pOwnerDocument))->release(); |
| 63 | pCur = pCur->nextSibling(); |
| 64 | } |
| 65 | } |
| 66 | return pClone; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | } } // namespace Poco::XML |
| 71 |