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