source: NonGTP/Xerces/xercesc/dom/DOMImplementation.hpp @ 188

Revision 188, 13.6 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1#ifndef DOMImplementation_HEADER_GUARD_
2#define DOMImplementation_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in
19 *    the documentation and/or other materials provided with the
20 *    distribution.
21 *
22 * 3. The end-user documentation included with the redistribution,
23 *    if any, must include the following acknowledgment:
24 *       "This product includes software developed by the
25 *        Apache Software Foundation (http://www.apache.org/)."
26 *    Alternately, this acknowledgment may appear in the software itself,
27 *    if and wherever such third-party acknowledgments normally appear.
28 *
29 * 4. The names "Xerces" and "Apache Software Foundation" must
30 *    not be used to endorse or promote products derived from this
31 *    software without prior written permission. For written
32 *    permission, please contact apache\@apache.org.
33 *
34 * 5. Products derived from this software may not be called "Apache",
35 *    nor may "Apache" appear in their name, without prior written
36 *    permission of the Apache Software Foundation.
37 *
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This software consists of voluntary contributions made by many
53 * individuals on behalf of the Apache Software Foundation, and was
54 * originally based on software copyright (c) 2001, International
55 * Business Machines, Inc., http://www.ibm.com .  For more information
56 * on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
58 */
59
60/*
61 * $Id: DOMImplementation.hpp,v 1.13 2003/12/01 23:23:25 neilg Exp $
62 */
63
64#include <xercesc/dom/DOMImplementationLS.hpp>
65#include <xercesc/dom/DOMException.hpp>
66#include <xercesc/dom/DOMRangeException.hpp>
67#include <xercesc/util/PlatformUtils.hpp>
68
69XERCES_CPP_NAMESPACE_BEGIN
70
71
72class DOMDocument;
73class DOMDocumentType;
74
75/**
76 * The <code>DOMImplementation</code> interface provides a number of methods
77 * for performing operations that are independent of any particular instance
78 * of the document object model.
79 */
80
81class CDOM_EXPORT DOMImplementation : public DOMImplementationLS
82{
83protected:
84    // -----------------------------------------------------------------------
85    //  Hidden constructors
86    // -----------------------------------------------------------------------
87    /** @name Hidden constructors */
88    //@{   
89        DOMImplementation() {};                                      // no plain constructor
90    //@}
91
92private:
93    // -----------------------------------------------------------------------
94    // Unimplemented constructors and operators
95    // -----------------------------------------------------------------------
96    /** @name Unimplemented constructors and operators */
97    //@{
98        DOMImplementation(const DOMImplementation &);   // no copy construtor.
99        DOMImplementation & operator = (const DOMImplementation &);  // No Assignment
100    //@}
101
102
103public:
104    // -----------------------------------------------------------------------
105    //  All constructors are hidden, just the destructor is available
106    // -----------------------------------------------------------------------
107    /** @name Destructor */
108    //@{
109    /**
110     * Destructor
111     *
112     */
113    virtual ~DOMImplementation() {};
114    //@}
115
116    // -----------------------------------------------------------------------
117    // Virtual DOMImplementation interface
118    // -----------------------------------------------------------------------
119    /** @name Functions introduced in DOM Level 1 */
120    //@{
121    /**
122     * Test if the DOM implementation implements a specific feature.
123     * @param feature The name of the feature to test (case-insensitive). The
124     *   values used by DOM features are defined throughout the DOM Level 2
125     *   specifications and listed in the  section. The name must be an XML
126     *   name. To avoid possible conflicts, as a convention, names referring
127     *   to features defined outside the DOM specification should be made
128     *   unique.
129     * @param version This is the version number of the feature to test. In
130     *   Level 2, the string can be either "2.0" or "1.0". If the version is
131     *   not specified, supporting any version of the feature causes the
132     *   method to return <code>true</code>.
133     * @return <code>true</code> if the feature is implemented in the
134     *   specified version, <code>false</code> otherwise.
135     * @since DOM Level 1
136     */
137    virtual bool  hasFeature(const XMLCh *feature,  const XMLCh *version) const = 0;
138    //@}
139
140    // -----------------------------------------------------------------------
141    // Functions introduced in DOM Level 2
142    // -----------------------------------------------------------------------
143    /** @name Functions introduced in DOM Level 2 */
144    //@{
145    /**
146     * Creates an empty <code>DOMDocumentType</code> node. Entity declarations
147     * and notations are not made available. Entity reference expansions and
148     * default attribute additions do not occur. It is expected that a
149     * future version of the DOM will provide a way for populating a
150     * <code>DOMDocumentType</code>.
151     * @param qualifiedName The qualified name of the document type to be
152     *   created.
153     * @param publicId The external subset public identifier.
154     * @param systemId The external subset system identifier.
155     * @return A new <code>DOMDocumentType</code> node with
156     *   <code>ownerDocument</code> set to <code>null</code>.
157     * @exception DOMException
158     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name
159     *   contains an illegal character.
160     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
161     *   malformed.
162     *   <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
163     *   not support the <code>"XML"</code> feature, if they choose not to
164     *   support this method. Other features introduced in the future, by
165     *   the DOM WG or in extensions defined by other groups, may also
166     *   demand support for this method; please consult the definition of
167     *   the feature to see if it requires this method.
168     * @since DOM Level 2
169     */
170    virtual  DOMDocumentType *createDocumentType(const XMLCh *qualifiedName,
171                                                 const XMLCh *publicId,
172                                                 const XMLCh *systemId) = 0;
173
174    /**
175     * Creates a DOMDocument object of the specified type with its document
176     * element.
177     * @param namespaceURI The namespace URI of the document element to
178     *   create.
179     * @param qualifiedName The qualified name of the document element to be
180     *   created.
181     * @param doctype The type of document to be created or <code>null</code>.
182     *   When <code>doctype</code> is not <code>null</code>, its
183     *   <code>ownerDocument</code> attribute is set to the document
184     *   being created.
185     * @param manager    Pointer to the memory manager to be used to
186     *                   allocate objects.
187     * @return A new <code>DOMDocument</code> object.
188     * @exception DOMException
189     *   INVALID_CHARACTER_ERR: Raised if the specified qualified name
190     *   contains an illegal character.
191     *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
192     *   malformed, if the <code>qualifiedName</code> has a prefix and the
193     *   <code>namespaceURI</code> is <code>null</code>, or if the
194     *   <code>qualifiedName</code> has a prefix that is "xml" and the
195     *   <code>namespaceURI</code> is different from "
196     *   http://www.w3.org/XML/1998/namespace" , or if the DOM
197     *   implementation does not support the <code>"XML"</code> feature but
198     *   a non-null namespace URI was provided, since namespaces were
199     *   defined by XML.
200     *   <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
201     *   been used with a different document or was created from a different
202     *   implementation.
203     *   <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
204     *   not support the "XML" feature, if they choose not to support this
205     *   method. Other features introduced in the future, by the DOM WG or
206     *   in extensions defined by other groups, may also demand support for
207     *   this method; please consult the definition of the feature to see if
208     *   it requires this method.
209     * @since DOM Level 2
210     */
211
212    virtual DOMDocument *createDocument(const XMLCh *namespaceURI,
213                                        const XMLCh *qualifiedName,
214                                        DOMDocumentType *doctype,
215                                        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
216
217    //@}
218    // -----------------------------------------------------------------------
219    // Functions introduced in DOM Level 3
220    // -----------------------------------------------------------------------
221    /** @name Functions introduced in DOM Level 3 */
222    //@{
223    /**
224     * This method makes available a <code>DOMImplementation</code>'s
225     * specialized interface (see ).
226     *
227     * <p><b>"Experimental - subject to change"</b></p>
228     *
229     * @param feature The name of the feature requested (case-insensitive).
230     * @return Returns an alternate <code>DOMImplementation</code> which
231     *   implements the specialized APIs of the specified feature, if any,
232     *   or <code>null</code> if there is no alternate
233     *   <code>DOMImplementation</code> object which implements interfaces
234     *   associated with that feature. Any alternate
235     *   <code>DOMImplementation</code> returned by this method must
236     *   delegate to the primary core <code>DOMImplementation</code> and not
237     *   return results inconsistent with the primary
238     *   <code>DOMImplementation</code>
239     * @since DOM Level 3
240     */
241    virtual DOMImplementation* getInterface(const XMLCh* feature) = 0;
242
243    //@}
244
245    // -----------------------------------------------------------------------
246    // Non-standard extension
247    // -----------------------------------------------------------------------
248    /** @name Non-standard extension */
249    //@{
250    /**
251     * Non-standard extension
252     *
253     * Create a completely empty document that has neither a root element or a doctype node.
254     */
255    virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
256
257    /**
258     * Non-standard extension
259     *
260     *  Factory method for getting a DOMImplementation object.
261     *     The DOM implementation retains ownership of the returned object.
262     *     Application code should NOT delete it.
263     */
264    static DOMImplementation *getImplementation();
265
266    /**
267     * Non-standard extension
268     *
269     *  Load the default error text message for DOMException.
270      * @param msgToLoad The DOM ExceptionCode id to be processed
271      * @param toFill    The buffer that will hold the output on return. The
272      *         size of this buffer should at least be 'maxChars + 1'.
273      * @param maxChars  The maximum number of output characters that can be
274      *         accepted. If the result will not fit, it is an error.
275      * @return <code>true</code> if the message is successfully loaded
276     */
277    static bool loadDOMExceptionMsg
278    (
279        const   DOMException::ExceptionCode  msgToLoad
280        ,       XMLCh* const                 toFill
281        , const unsigned int                 maxChars
282    );
283
284    /**
285     * Non-standard extension
286     *
287     *  Load the default error text message for DOMRangeException.
288      * @param msgToLoad The DOM RangeExceptionCode id to be processed
289      * @param toFill    The buffer that will hold the output on return. The
290      *         size of this buffer should at least be 'maxChars + 1'.
291      * @param maxChars  The maximum number of output characters that can be
292      *         accepted. If the result will not fit, it is an error.
293      * @return <code>true</code> if the message is successfully loaded
294     */
295    static bool loadDOMExceptionMsg
296    (
297        const   DOMRangeException::RangeExceptionCode  msgToLoad
298        ,       XMLCh* const                           toFill
299        , const unsigned int                           maxChars
300    );
301    //@}
302
303};
304
305XERCES_CPP_NAMESPACE_END
306
307#endif
Note: See TracBrowser for help on using the repository browser.