1 | #ifndef DOMImplementation_HEADER_GUARD_
|
---|
2 | #define DOMImplementation_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: DOMImplementation.hpp,v 1.14 2004/09/08 13:55:39 peiyongz Exp $
|
---|
22 | */
|
---|
23 |
|
---|
24 | #include <xercesc/dom/DOMImplementationLS.hpp>
|
---|
25 | #include <xercesc/dom/DOMException.hpp>
|
---|
26 | #include <xercesc/dom/DOMRangeException.hpp>
|
---|
27 | #include <xercesc/util/PlatformUtils.hpp>
|
---|
28 |
|
---|
29 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
30 |
|
---|
31 |
|
---|
32 | class DOMDocument;
|
---|
33 | class DOMDocumentType;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * The <code>DOMImplementation</code> interface provides a number of methods
|
---|
37 | * for performing operations that are independent of any particular instance
|
---|
38 | * of the document object model.
|
---|
39 | */
|
---|
40 |
|
---|
41 | class CDOM_EXPORT DOMImplementation : public DOMImplementationLS
|
---|
42 | {
|
---|
43 | protected:
|
---|
44 | // -----------------------------------------------------------------------
|
---|
45 | // Hidden constructors
|
---|
46 | // -----------------------------------------------------------------------
|
---|
47 | /** @name Hidden constructors */
|
---|
48 | //@{
|
---|
49 | DOMImplementation() {}; // no plain constructor
|
---|
50 | //@}
|
---|
51 |
|
---|
52 | private:
|
---|
53 | // -----------------------------------------------------------------------
|
---|
54 | // Unimplemented constructors and operators
|
---|
55 | // -----------------------------------------------------------------------
|
---|
56 | /** @name Unimplemented constructors and operators */
|
---|
57 | //@{
|
---|
58 | DOMImplementation(const DOMImplementation &); // no copy construtor.
|
---|
59 | DOMImplementation & operator = (const DOMImplementation &); // No Assignment
|
---|
60 | //@}
|
---|
61 |
|
---|
62 |
|
---|
63 | public:
|
---|
64 | // -----------------------------------------------------------------------
|
---|
65 | // All constructors are hidden, just the destructor is available
|
---|
66 | // -----------------------------------------------------------------------
|
---|
67 | /** @name Destructor */
|
---|
68 | //@{
|
---|
69 | /**
|
---|
70 | * Destructor
|
---|
71 | *
|
---|
72 | */
|
---|
73 | virtual ~DOMImplementation() {};
|
---|
74 | //@}
|
---|
75 |
|
---|
76 | // -----------------------------------------------------------------------
|
---|
77 | // Virtual DOMImplementation interface
|
---|
78 | // -----------------------------------------------------------------------
|
---|
79 | /** @name Functions introduced in DOM Level 1 */
|
---|
80 | //@{
|
---|
81 | /**
|
---|
82 | * Test if the DOM implementation implements a specific feature.
|
---|
83 | * @param feature The name of the feature to test (case-insensitive). The
|
---|
84 | * values used by DOM features are defined throughout the DOM Level 2
|
---|
85 | * specifications and listed in the section. The name must be an XML
|
---|
86 | * name. To avoid possible conflicts, as a convention, names referring
|
---|
87 | * to features defined outside the DOM specification should be made
|
---|
88 | * unique.
|
---|
89 | * @param version This is the version number of the feature to test. In
|
---|
90 | * Level 2, the string can be either "2.0" or "1.0". If the version is
|
---|
91 | * not specified, supporting any version of the feature causes the
|
---|
92 | * method to return <code>true</code>.
|
---|
93 | * @return <code>true</code> if the feature is implemented in the
|
---|
94 | * specified version, <code>false</code> otherwise.
|
---|
95 | * @since DOM Level 1
|
---|
96 | */
|
---|
97 | virtual bool hasFeature(const XMLCh *feature, const XMLCh *version) const = 0;
|
---|
98 | //@}
|
---|
99 |
|
---|
100 | // -----------------------------------------------------------------------
|
---|
101 | // Functions introduced in DOM Level 2
|
---|
102 | // -----------------------------------------------------------------------
|
---|
103 | /** @name Functions introduced in DOM Level 2 */
|
---|
104 | //@{
|
---|
105 | /**
|
---|
106 | * Creates an empty <code>DOMDocumentType</code> node. Entity declarations
|
---|
107 | * and notations are not made available. Entity reference expansions and
|
---|
108 | * default attribute additions do not occur. It is expected that a
|
---|
109 | * future version of the DOM will provide a way for populating a
|
---|
110 | * <code>DOMDocumentType</code>.
|
---|
111 | * @param qualifiedName The qualified name of the document type to be
|
---|
112 | * created.
|
---|
113 | * @param publicId The external subset public identifier.
|
---|
114 | * @param systemId The external subset system identifier.
|
---|
115 | * @return A new <code>DOMDocumentType</code> node with
|
---|
116 | * <code>ownerDocument</code> set to <code>null</code>.
|
---|
117 | * @exception DOMException
|
---|
118 | * INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
---|
119 | * contains an illegal character.
|
---|
120 | * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
---|
121 | * malformed.
|
---|
122 | * <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
|
---|
123 | * not support the <code>"XML"</code> feature, if they choose not to
|
---|
124 | * support this method. Other features introduced in the future, by
|
---|
125 | * the DOM WG or in extensions defined by other groups, may also
|
---|
126 | * demand support for this method; please consult the definition of
|
---|
127 | * the feature to see if it requires this method.
|
---|
128 | * @since DOM Level 2
|
---|
129 | */
|
---|
130 | virtual DOMDocumentType *createDocumentType(const XMLCh *qualifiedName,
|
---|
131 | const XMLCh *publicId,
|
---|
132 | const XMLCh *systemId) = 0;
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Creates a DOMDocument object of the specified type with its document
|
---|
136 | * element.
|
---|
137 | * @param namespaceURI The namespace URI of the document element to
|
---|
138 | * create.
|
---|
139 | * @param qualifiedName The qualified name of the document element to be
|
---|
140 | * created.
|
---|
141 | * @param doctype The type of document to be created or <code>null</code>.
|
---|
142 | * When <code>doctype</code> is not <code>null</code>, its
|
---|
143 | * <code>ownerDocument</code> attribute is set to the document
|
---|
144 | * being created.
|
---|
145 | * @param manager Pointer to the memory manager to be used to
|
---|
146 | * allocate objects.
|
---|
147 | * @return A new <code>DOMDocument</code> object.
|
---|
148 | * @exception DOMException
|
---|
149 | * INVALID_CHARACTER_ERR: Raised if the specified qualified name
|
---|
150 | * contains an illegal character.
|
---|
151 | * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
|
---|
152 | * malformed, if the <code>qualifiedName</code> has a prefix and the
|
---|
153 | * <code>namespaceURI</code> is <code>null</code>, or if the
|
---|
154 | * <code>qualifiedName</code> has a prefix that is "xml" and the
|
---|
155 | * <code>namespaceURI</code> is different from "
|
---|
156 | * http://www.w3.org/XML/1998/namespace" , or if the DOM
|
---|
157 | * implementation does not support the <code>"XML"</code> feature but
|
---|
158 | * a non-null namespace URI was provided, since namespaces were
|
---|
159 | * defined by XML.
|
---|
160 | * <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
|
---|
161 | * been used with a different document or was created from a different
|
---|
162 | * implementation.
|
---|
163 | * <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
|
---|
164 | * not support the "XML" feature, if they choose not to support this
|
---|
165 | * method. Other features introduced in the future, by the DOM WG or
|
---|
166 | * in extensions defined by other groups, may also demand support for
|
---|
167 | * this method; please consult the definition of the feature to see if
|
---|
168 | * it requires this method.
|
---|
169 | * @since DOM Level 2
|
---|
170 | */
|
---|
171 |
|
---|
172 | virtual DOMDocument *createDocument(const XMLCh *namespaceURI,
|
---|
173 | const XMLCh *qualifiedName,
|
---|
174 | DOMDocumentType *doctype,
|
---|
175 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
---|
176 |
|
---|
177 | //@}
|
---|
178 | // -----------------------------------------------------------------------
|
---|
179 | // Functions introduced in DOM Level 3
|
---|
180 | // -----------------------------------------------------------------------
|
---|
181 | /** @name Functions introduced in DOM Level 3 */
|
---|
182 | //@{
|
---|
183 | /**
|
---|
184 | * This method makes available a <code>DOMImplementation</code>'s
|
---|
185 | * specialized interface (see ).
|
---|
186 | *
|
---|
187 | * <p><b>"Experimental - subject to change"</b></p>
|
---|
188 | *
|
---|
189 | * @param feature The name of the feature requested (case-insensitive).
|
---|
190 | * @return Returns an alternate <code>DOMImplementation</code> which
|
---|
191 | * implements the specialized APIs of the specified feature, if any,
|
---|
192 | * or <code>null</code> if there is no alternate
|
---|
193 | * <code>DOMImplementation</code> object which implements interfaces
|
---|
194 | * associated with that feature. Any alternate
|
---|
195 | * <code>DOMImplementation</code> returned by this method must
|
---|
196 | * delegate to the primary core <code>DOMImplementation</code> and not
|
---|
197 | * return results inconsistent with the primary
|
---|
198 | * <code>DOMImplementation</code>
|
---|
199 | * @since DOM Level 3
|
---|
200 | */
|
---|
201 | virtual DOMImplementation* getInterface(const XMLCh* feature) = 0;
|
---|
202 |
|
---|
203 | //@}
|
---|
204 |
|
---|
205 | // -----------------------------------------------------------------------
|
---|
206 | // Non-standard extension
|
---|
207 | // -----------------------------------------------------------------------
|
---|
208 | /** @name Non-standard extension */
|
---|
209 | //@{
|
---|
210 | /**
|
---|
211 | * Non-standard extension
|
---|
212 | *
|
---|
213 | * Create a completely empty document that has neither a root element or a doctype node.
|
---|
214 | */
|
---|
215 | virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
|
---|
216 |
|
---|
217 | /**
|
---|
218 | * Non-standard extension
|
---|
219 | *
|
---|
220 | * Factory method for getting a DOMImplementation object.
|
---|
221 | * The DOM implementation retains ownership of the returned object.
|
---|
222 | * Application code should NOT delete it.
|
---|
223 | */
|
---|
224 | static DOMImplementation *getImplementation();
|
---|
225 |
|
---|
226 | /**
|
---|
227 | * Non-standard extension
|
---|
228 | *
|
---|
229 | * Load the default error text message for DOMException.
|
---|
230 | * @param msgToLoad The DOM ExceptionCode id to be processed
|
---|
231 | * @param toFill The buffer that will hold the output on return. The
|
---|
232 | * size of this buffer should at least be 'maxChars + 1'.
|
---|
233 | * @param maxChars The maximum number of output characters that can be
|
---|
234 | * accepted. If the result will not fit, it is an error.
|
---|
235 | * @return <code>true</code> if the message is successfully loaded
|
---|
236 | */
|
---|
237 | static bool loadDOMExceptionMsg
|
---|
238 | (
|
---|
239 | const DOMException::ExceptionCode msgToLoad
|
---|
240 | , XMLCh* const toFill
|
---|
241 | , const unsigned int maxChars
|
---|
242 | );
|
---|
243 |
|
---|
244 | /**
|
---|
245 | * Non-standard extension
|
---|
246 | *
|
---|
247 | * Load the default error text message for DOMRangeException.
|
---|
248 | * @param msgToLoad The DOM RangeExceptionCode id to be processed
|
---|
249 | * @param toFill The buffer that will hold the output on return. The
|
---|
250 | * size of this buffer should at least be 'maxChars + 1'.
|
---|
251 | * @param maxChars The maximum number of output characters that can be
|
---|
252 | * accepted. If the result will not fit, it is an error.
|
---|
253 | * @return <code>true</code> if the message is successfully loaded
|
---|
254 | */
|
---|
255 | static bool loadDOMExceptionMsg
|
---|
256 | (
|
---|
257 | const DOMRangeException::RangeExceptionCode msgToLoad
|
---|
258 | , XMLCh* const toFill
|
---|
259 | , const unsigned int maxChars
|
---|
260 | );
|
---|
261 | //@}
|
---|
262 |
|
---|
263 | };
|
---|
264 |
|
---|
265 | XERCES_CPP_NAMESPACE_END
|
---|
266 |
|
---|
267 | #endif
|
---|