[2674] | 1 | #ifndef DOMDocumentFragment_HEADER_GUARD_ |
---|
| 2 | #define DOMDocumentFragment_HEADER_GUARD_ |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 6 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 7 | * this work for additional information regarding copyright ownership. |
---|
| 8 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 9 | * (the "License"); you may not use this file except in compliance with |
---|
| 10 | * the License. You may obtain a copy of the License at |
---|
| 11 | * |
---|
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 13 | * |
---|
| 14 | * Unless required by applicable law or agreed to in writing, software |
---|
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 17 | * See the License for the specific language governing permissions and |
---|
| 18 | * limitations under the License. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | /* |
---|
| 22 | * $Id: DOMDocumentFragment.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 27 | #include <xercesc/dom/DOMNode.hpp> |
---|
| 28 | |
---|
| 29 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | /** |
---|
| 33 | * DOMDocumentFragment is a "lightweight" or "minimal" |
---|
| 34 | * DOMDocument object. |
---|
| 35 | * |
---|
| 36 | * It is very common to want to be able to |
---|
| 37 | * extract a portion of a document's tree or to create a new fragment of a |
---|
| 38 | * document. Imagine implementing a user command like cut or rearranging a |
---|
| 39 | * document by moving fragments around. It is desirable to have an object |
---|
| 40 | * which can hold such fragments and it is quite natural to use a DOMNode for |
---|
| 41 | * this purpose. While it is true that a <code>DOMDocument</code> object could |
---|
| 42 | * fulfil this role, a <code>DOMDocument</code> object can potentially be a |
---|
| 43 | * heavyweight object, depending on the underlying implementation. What is |
---|
| 44 | * really needed for this is a very lightweight object. |
---|
| 45 | * <code>DOMDocumentFragment</code> is such an object. |
---|
| 46 | * <p>Furthermore, various operations -- such as inserting nodes as children |
---|
| 47 | * of another <code>DOMNode</code> -- may take <code>DOMDocumentFragment</code> |
---|
| 48 | * objects as arguments; this results in all the child nodes of the |
---|
| 49 | * <code>DOMDocumentFragment</code> being moved to the child list of this node. |
---|
| 50 | * <p>The children of a <code>DOMDocumentFragment</code> node are zero or more |
---|
| 51 | * nodes representing the tops of any sub-trees defining the structure of the |
---|
| 52 | * document. <code>DOMDocumentFragment</code> nodes do not need to be |
---|
| 53 | * well-formed XML documents (although they do need to follow the rules |
---|
| 54 | * imposed upon well-formed XML parsed entities, which can have multiple top |
---|
| 55 | * nodes). For example, a <code>DOMDocumentFragment</code> might have only one |
---|
| 56 | * child and that child node could be a <code>DOMText</code> node. Such a |
---|
| 57 | * structure model represents neither an HTML document nor a well-formed XML |
---|
| 58 | * document. |
---|
| 59 | * <p>When a <code>DOMDocumentFragment</code> is inserted into a |
---|
| 60 | * <code>DOMDocument</code> (or indeed any other <code>DOMNode</code> that may take |
---|
| 61 | * children) the children of the <code>DOMDocumentFragment</code> and not the |
---|
| 62 | * <code>DOMDocumentFragment</code> itself are inserted into the |
---|
| 63 | * <code>DOMNode</code>. This makes the <code>DOMDocumentFragment</code> very |
---|
| 64 | * useful when the user wishes to create nodes that are siblings; the |
---|
| 65 | * <code>DOMDocumentFragment</code> acts as the parent of these nodes so that the |
---|
| 66 | * user can use the standard methods from the <code>DOMNode</code> interface, |
---|
| 67 | * such as <code>insertBefore()</code> and <code>appendChild()</code>. |
---|
| 68 | * |
---|
| 69 | * @since DOM Level 1 |
---|
| 70 | */ |
---|
| 71 | |
---|
| 72 | class CDOM_EXPORT DOMDocumentFragment: public DOMNode { |
---|
| 73 | protected: |
---|
| 74 | // ----------------------------------------------------------------------- |
---|
| 75 | // Hidden constructors |
---|
| 76 | // ----------------------------------------------------------------------- |
---|
| 77 | /** @name Hidden constructors */ |
---|
| 78 | //@{ |
---|
| 79 | DOMDocumentFragment() {}; |
---|
| 80 | //@} |
---|
| 81 | |
---|
| 82 | private: |
---|
| 83 | // ----------------------------------------------------------------------- |
---|
| 84 | // Unimplemented constructors and operators |
---|
| 85 | // ----------------------------------------------------------------------- |
---|
| 86 | /** @name Unimplemented constructors and operators */ |
---|
| 87 | //@{ |
---|
| 88 | DOMDocumentFragment(const DOMDocumentFragment &); |
---|
| 89 | DOMDocumentFragment & operator = (const DOMDocumentFragment &); |
---|
| 90 | //@} |
---|
| 91 | |
---|
| 92 | public: |
---|
| 93 | // ----------------------------------------------------------------------- |
---|
| 94 | // All constructors are hidden, just the destructor is available |
---|
| 95 | // ----------------------------------------------------------------------- |
---|
| 96 | /** @name Destructor */ |
---|
| 97 | //@{ |
---|
| 98 | /** |
---|
| 99 | * Destructor |
---|
| 100 | * |
---|
| 101 | */ |
---|
| 102 | virtual ~DOMDocumentFragment() {}; |
---|
| 103 | //@} |
---|
| 104 | |
---|
| 105 | }; |
---|
| 106 | |
---|
| 107 | XERCES_CPP_NAMESPACE_END |
---|
| 108 | |
---|
| 109 | #endif |
---|