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

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

added xercesc to support

Line 
1#ifndef DOMBuilder_HEADER_GUARD_
2#define DOMBuilder_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 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: DOMBuilder.hpp,v 1.11 2003/03/07 19:58:58 tng Exp $
62 *
63 */
64
65
66#include <xercesc/util/XercesDefs.hpp>
67
68XERCES_CPP_NAMESPACE_BEGIN
69
70
71class DOMErrorHandler;
72class DOMEntityResolver;
73class DOMInputSource;
74class DOMBuilderFilter;
75class DOMNode;
76class DOMDocument;
77class Grammar;
78
79/**
80 * DOMBuilder provides an API for parsing XML documents and building the
81 * corresponding DOM document tree. A DOMBuilder instance is obtained from
82 * the DOMImplementationLS interface by invoking its createDOMBuilder method.
83 * This implementation also allows the applications to install an error and
84 * an entity handler (useful extensions to the DOM specification).
85 *
86 * @since DOM Level 3
87 *
88 */
89class CDOM_EXPORT DOMBuilder
90{
91protected :
92    // -----------------------------------------------------------------------
93    //  Hidden constructors
94    // -----------------------------------------------------------------------
95    /** @name Hidden constructors */
96    //@{   
97    DOMBuilder() {};
98    //@}
99
100private:   
101    // -----------------------------------------------------------------------
102    // Unimplemented constructors and operators
103    // -----------------------------------------------------------------------
104    /** @name Unimplemented constructors and operators */
105    //@{
106    DOMBuilder(const DOMBuilder &);
107    DOMBuilder & operator = (const DOMBuilder &);
108    //@}
109
110public:
111    // -----------------------------------------------------------------------
112    //  All constructors are hidden, just the destructor is available
113    // -----------------------------------------------------------------------
114    /** @name Destructor */
115    //@{
116    /**
117     * Destructor
118     *
119     */
120    virtual ~DOMBuilder() {};
121    //@}
122
123    // -----------------------------------------------------------------------
124    //  Class types
125    // -----------------------------------------------------------------------
126    /** @name Public Constants */
127    //@{
128    /**
129     * Action types for use in parseWithContext.
130     *
131     * <p> <code>ACTION_REPLACE</code>:
132     * Replace the context node with the result of parsing the input source.
133     * For this action to work the context node must be an
134     * <code>DOMElement</code>, <code>DOMText</code>, <code>DOMCDATASection</code>,
135     * <code>DOMComment</code>, <code>DOMProcessingInstruction</code>, or
136     * <code>DOMEntityReference</code> node.</p>
137     *
138     * <p> <code>ACTION_APPEND</code>:
139     * Append the result of parsing the input source to the context node. For
140     * this action to work, the context node must be an <code>DOMElement</code>.</p>
141     *
142     * <p> <code>ACTION_INSERT_AFTER</code>:
143     * Insert the result of parsing the input source after the context node.
144     * For this action to work the context nodes parent must be an
145     * <code>DOMElement</code>.</p>
146     *
147     * <p> <code>ACTION_INSERT_BEFORE</code>:
148     * Insert the result of parsing the input source before the context node.
149     * For this action to work the context nodes parent must be an
150     * <code>DOMElement</code>.</p>
151     *
152     * @see parseWithContext(...)
153     * @since DOM Level 3
154     */
155    enum ActionType
156    {
157        ACTION_REPLACE            = 1,
158        ACTION_APPEND_AS_CHILDREN = 2,
159        ACTION_INSERT_AFTER       = 3,
160        ACTION_INSERT_BEFORE      = 4
161    };
162    //@}
163
164    // -----------------------------------------------------------------------
165    //  Virtual DOMBuilder interface
166    // -----------------------------------------------------------------------
167    /** @name Functions introduced in DOM Level 3 */
168    //@{
169
170    // -----------------------------------------------------------------------
171    //  Getter methods
172    // -----------------------------------------------------------------------
173
174    /**
175      * Get a pointer to the error handler
176      *
177      * This method returns the installed error handler. If no handler
178      * has been installed, then it will be a zero pointer.
179      *
180      * <p><b>"Experimental - subject to change"</b></p>
181      *
182      * @return The pointer to the installed error handler object.
183      * @since DOM Level 3
184      */
185    virtual DOMErrorHandler* getErrorHandler() = 0;
186
187    /**
188      * Get a const pointer to the error handler
189      *
190      * This method returns the installed error handler.  If no handler
191      * has been installed, then it will be a zero pointer.
192      *
193      * <p><b>"Experimental - subject to change"</b></p>
194      *
195      * @return A const pointer to the installed error handler object.
196      * @since DOM Level 3
197      */
198    virtual const DOMErrorHandler* getErrorHandler() const = 0;
199
200    /**
201      * Get a pointer to the entity resolver
202      *
203      * This method returns the installed entity resolver.  If no resolver
204      * has been installed, then it will be a zero pointer.
205      *
206      * <p><b>"Experimental - subject to change"</b></p>
207      *
208      * @return The pointer to the installed entity resolver object.
209      * @since DOM Level 3
210      */
211    virtual DOMEntityResolver* getEntityResolver() = 0;
212
213    /**
214      * Get a const pointer to the entity resolver
215      *
216      * This method returns the installed entity resolver. If no resolver
217      * has been installed, then it will be a zero pointer.
218      *
219      * <p><b>"Experimental - subject to change"</b></p>
220      *
221      * @return A const pointer to the installed entity resolver object.
222      * @since DOM Level 3
223      */
224    virtual const DOMEntityResolver* getEntityResolver() const = 0;
225
226    /**
227      * Get a pointer to the application filter
228      *
229      * This method returns the installed application filter. If no filter
230      * has been installed, then it will be a zero pointer.
231      *
232      * <p><b>"Experimental - subject to change"</b></p>
233      *
234      * @return The pointer to the installed application filter.
235      * @since DOM Level 3
236      */
237    virtual DOMBuilderFilter* getFilter() = 0;
238
239    /**
240      * Get a const pointer to the application filter
241      *
242      * This method returns the installed application filter. If no filter
243      * has been installed, then it will be a zero pointer.
244      *
245      * <p><b>"Experimental - subject to change"</b></p>
246      *
247      * @return A const pointer to the installed application filter
248      * @since DOM Level 3
249      */
250    virtual const DOMBuilderFilter* getFilter() const = 0;
251
252    // -----------------------------------------------------------------------
253    //  Setter methods
254    // -----------------------------------------------------------------------
255    /**
256      * Set the error handler
257      *
258      * This method allows applications to install their own error handler
259      * to trap error and warning messages.
260      *
261      * <i>Any previously set handler is merely dropped, since the parser
262      * does not own them.</i>
263      *
264      * <p><b>"Experimental - subject to change"</b></p>
265      *
266      * @param handler  A const pointer to the user supplied error
267      *                 handler.
268      *
269      * @see #getErrorHandler
270      * @since DOM Level 3
271      */
272    virtual void setErrorHandler(DOMErrorHandler* const handler) = 0;
273
274    /**
275      * Set the entity resolver
276      *
277      * This method allows applications to install their own entity
278      * resolver. By installing an entity resolver, the applications
279      * can trap and potentially redirect references to external
280      * entities.
281      *
282      * <i>Any previously set resolver is merely dropped, since the parser
283      * does not own them.</i>
284      *
285      * <p><b>"Experimental - subject to change"</b></p>
286      *
287      * @param handler  A const pointer to the user supplied entity
288      *                 resolver.
289      *
290      * @see #getEntityResolver
291      * @since DOM Level 3
292      */
293    virtual void setEntityResolver(DOMEntityResolver* const handler) = 0;
294
295    /**
296      * Set the application filter
297      *
298      * When the application provides a filter, the parser will call out to
299      * the filter at the completion of the construction of each Element node.
300      * The filter implementation can choose to remove the element from the
301      * document being constructed (unless the element is the document element)
302      * or to terminate the parse early. If the document is being validated
303      * when it's loaded the validation happens before the filter is called.
304      *
305      * <i>Any previously set filter is merely dropped, since the parser
306      * does not own them.</i>
307      *
308      * <p><b>"Experimental - subject to change"</b></p>
309      *
310      * @param filter  A const pointer to the user supplied application
311      *                filter.
312      *
313      * @see #getFilter
314      * @since DOM Level 3
315      */
316    virtual void setFilter(DOMBuilderFilter* const filter) = 0;
317
318    // -----------------------------------------------------------------------
319    //  Feature methods
320    // -----------------------------------------------------------------------
321    /**
322      * Set the state of a feature
323      *
324      * It is possible for a DOMBuilder to recognize a feature name but to be
325      * unable to set its value.
326      *
327      * <p><b>"Experimental - subject to change"</b></p>
328      *
329      * See http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures for
330      * the list of supported features.
331      *
332      * @param name  The feature name.
333      * @param state The requested state of the feature (true or false).
334      * @exception DOMException
335      *     NOT_SUPPORTED_ERR: Raised when the DOMBuilder recognizes the
336      *     feature name but cannot set the requested value.
337      *     <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
338      *     the feature name.
339      *
340      * @see #setFeature
341      * @see #canSetFeature
342      * @since DOM Level 3
343      */
344    virtual void setFeature(const XMLCh* const name, const bool state) = 0;
345
346    /**
347      * Look up the value of a feature.
348      *
349      * <p><b>"Experimental - subject to change"</b></p>
350      *
351      * @param name The feature name.
352      * @return The current state of the feature (true or false)
353      * @exception DOMException
354      *     NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
355      *     the feature name.
356      *
357      * @see #getFeature
358      * @see #canSetFeature
359      * @since DOM Level 3
360      */
361    virtual bool getFeature(const XMLCh* const name) const = 0;
362
363    /**
364      * Query whether setting a feature to a specific value is supported.
365      *
366      * <p><b>"Experimental - subject to change"</b></p>
367      *
368      * @param name  The feature name.
369      * @param state The requested state of the feature (true or false).
370      * @return <code>true</code> if the feature could be successfully set
371      *     to the specified value, or <code>false</code> if the feature
372      *     is not recognized or the requested value is not supported. The
373      *     value of the feature itself is not changed.
374      *
375      * @see #getFeature
376      * @see #setFeature
377      * @since DOM Level 3
378      */
379    virtual bool canSetFeature(const XMLCh* const name, const bool state) const = 0;
380
381    // -----------------------------------------------------------------------
382    //  Parsing methods
383    // -----------------------------------------------------------------------
384    /**
385      * Parse via an input source object
386      *
387      * This method invokes the parsing process on the XML file specified
388      * by the DOMInputSource parameter. This API is borrowed from the
389      * SAX Parser interface.
390      *
391      * The parser owns the returned DOMDocument.  It will be deleted
392      * when the parser is released.
393      *
394      * <p><b>"Experimental - subject to change"</b></p>
395      *
396      * @param source A const reference to the DOMInputSource object which
397      *               points to the XML file to be parsed.
398      * @return If the DOMBuilder is a synchronous DOMBuilder the newly created
399      *         and populated DOMDocument is returned. If the DOMBuilder is
400      *         asynchronous then <code>null</code> is returned since the
401      *         document object is not yet parsed when this method returns.
402      * @exception SAXException Any SAX exception, possibly
403      *            wrapping another exception.
404      * @exception XMLException An exception from the parser or client
405      *            handler code.
406      * @exception DOMException A DOM exception as per DOM spec.
407      *
408      * @see DOMInputSource#DOMInputSource
409      * @see #setEntityResolver
410      * @see #setErrorHandler
411      * @see resetDocumentPool
412      * @since DOM Level 3
413      */
414    virtual DOMDocument* parse(const DOMInputSource& source) = 0;
415
416    /**
417      * Parse via a file path or URL
418      *
419      * This method invokes the parsing process on the XML file specified by
420      * the Unicode string parameter 'systemId'.
421      *
422      * The parser owns the returned DOMDocument.  It will be deleted
423      * when the parser is released.
424      *
425      * <p><b>"Experimental - subject to change"</b></p>
426      *
427      * @param systemId A const XMLCh pointer to the Unicode string which
428      *                 contains the path to the XML file to be parsed.
429      * @return If the DOMBuilder is a synchronous DOMBuilder the newly created
430      *         and populated DOMDocument is returned. If the DOMBuilder is
431      *         asynchronous then <code>null</code> is returned since the
432      *         document object is not yet parsed when this method returns.
433      * @exception SAXException Any SAX exception, possibly
434      *            wrapping another exception.
435      * @exception XMLException An exception from the parser or client
436      *            handler code.
437      * @exception DOMException A DOM exception as per DOM spec.
438      *
439      * @see #parse(DOMInputSource,...)
440      * @see resetDocumentPool
441      * @since DOM Level 3
442      */
443    virtual DOMDocument* parseURI(const XMLCh* const systemId) = 0;
444
445    /**
446      * Parse via a file path or URL (in the local code page)
447      *
448      * This method invokes the parsing process on the XML file specified by
449      * the native char* string parameter 'systemId'.
450      *
451      * The parser owns the returned DOMDocument.  It will be deleted
452      * when the parser is released.
453      *
454      * <p><b>"Experimental - subject to change"</b></p>
455      *
456      * @param systemId A const char pointer to a native string which
457      *                 contains the path to the XML file to be parsed.
458      * @return If the DOMBuilder is a synchronous DOMBuilder the newly created
459      *         and populated DOMDocument is returned. If the DOMBuilder is
460      *         asynchronous then <code>null</code> is returned since the
461      *         document object is not yet parsed when this method returns.
462      * @exception SAXException Any SAX exception, possibly
463      *            wrapping another exception.
464      * @exception XMLException An exception from the parser or client
465      *            handler code.
466      * @exception DOMException A DOM exception as per DOM spec.
467      *
468      * @see #parse(DOMInputSource,...)
469      * @see resetDocumentPool
470      */
471    virtual DOMDocument* parseURI(const char* const systemId) = 0;
472
473    /**
474      * Parse via an input source object
475      *
476      * This method invokes the parsing process on the XML file specified
477      * by the DOMInputSource parameter, and inserts the content into an
478      * existing document at the position specified with the contextNode
479      * and action arguments. When parsing the input stream the context node
480      * is used for resolving unbound namespace prefixes.
481      *
482      * <p><b>"Experimental - subject to change"</b></p>
483      *
484      * @param source A const reference to the DOMInputSource object which
485      *               points to the XML file to be parsed.
486      * @param contextNode The node that is used as the context for the data
487      *                    that is being parsed. This node must be a Document
488      *                    node, a DocumentFragment node, or a node of a type
489      *                    that is allowed as a child of an element, e.g. it
490      *                    can not be an attribute node.
491      * @param action This parameter describes which action should be taken
492      *               between the new set of node being inserted and the
493      *               existing children of the context node.
494      * @exception DOMException
495      *     NOT_SUPPORTED_ERR: Raised when the DOMBuilder doesn't support
496      *     this method.
497      *     <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is
498      *     readonly.
499      * @since DOM Level 3
500      */
501    virtual void parseWithContext
502    (
503        const   DOMInputSource& source
504        ,       DOMNode* const contextNode
505        , const short action
506    ) = 0;
507    //@}
508
509    // -----------------------------------------------------------------------
510    //  Non-standard Extension
511    // -----------------------------------------------------------------------
512    /** @name Non-standard Extension */
513    //@{
514
515    /**
516      * Query the current value of a property in a DOMBuilder.
517      *
518      * The builder owns the returned pointer.  The memory allocated for
519      * the returned pointer will be destroyed when the builder is deleted.
520      *
521      * To ensure assessiblity of the returned information after the builder
522      * is deleted, callers need to copy and store the returned information
523      * somewhere else; otherwise you may get unexpected result.  Since the returned
524      * pointer is a generic void pointer, see
525      * http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderProperties to learn
526      * exactly what type of property value each property returns for replication.
527      *
528      * @param name The unique identifier (URI) of the property being set.
529      * @return     The current value of the property.  The pointer spans the same
530      *             life-time as the parser.  A null pointer is returned if nothing
531      *             was specified externally.
532      * @exception DOMException
533      *     <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
534      *     the requested property.
535      */
536    virtual void* getProperty(const XMLCh* const name) const = 0 ;
537
538    /**
539      * Set the value of any property in a DOMBuilder.
540      * See http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderProperties for
541      * the list of supported properties.
542      *
543      * It takes a void pointer as the property value.  Application is required to initialize this void
544      * pointer to a correct type.  See http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderProperties
545      * to learn exactly what type of property value each property expects for processing.
546      * Passing a void pointer that was initialized with a wrong type will lead to unexpected result.
547      * If the same property is set more than once, the last one takes effect.
548      *
549      * @param name The unique identifier (URI) of the property being set.
550      * @param value The requested value for the property.
551      *            See http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderProperties to learn
552      *            exactly what type of property value each property expects for processing.
553      *            Passing a void pointer that was initialized with a wrong type will lead
554      *            to unexpected result.
555      * @exception DOMException
556      *     <br>NOT_FOUND_ERR: Raised when the DOMBuilder does not recognize
557      *     the requested property.
558      */
559    virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
560
561    /**
562     * Called to indicate that this DOMBuilder is no longer in use
563     * and that the implementation may relinquish any resources associated with it.
564     *
565     * Access to a released object will lead to unexpected result.
566     */
567    virtual void              release() = 0;
568
569    /** Reset the documents vector pool and release all the associated memory
570      * back to the system.
571      *
572      * When parsing a document using a DOM parser, all memory allocated
573      * for a DOM tree is associated to the DOM document.
574      *
575      * If you do multiple parse using the same DOM parser instance, then
576      * multiple DOM documents will be generated and saved in a vector pool.
577      * All these documents (and thus all the allocated memory)
578      * won't be deleted until the parser instance is destroyed.
579      *
580      * If you don't need these DOM documents anymore and don't want to
581      * destroy the DOM parser instance at this moment, then you can call this method
582      * to reset the document vector pool and release all the allocated memory
583      * back to the system.
584      *
585      * It is an error to call this method if you are in the middle of a
586      * parse (e.g. in the mid of a progressive parse).
587      *
588      * @exception IOException An exception from the parser if this function
589      *            is called when a parse is in progress.
590      *
591      */
592    virtual void              resetDocumentPool() = 0;
593
594    /**
595      * Preparse schema grammar (XML Schema, DTD, etc.) via an input source
596      * object.
597      *
598      * This method invokes the preparsing process on a schema grammar XML
599      * file specified by the DOMInputSource parameter. If the 'toCache' flag
600      * is enabled, the parser will cache the grammars for re-use. If a grammar
601      * key is found in the pool, no caching of any grammar will take place.
602      *
603      * <p><b>"Experimental - subject to change"</b></p>
604      *
605      * @param source A const reference to the DOMInputSource object which
606      *               points to the schema grammar file to be preparsed.
607      * @param grammarType The grammar type (Schema or DTD).
608      * @param toCache If <code>true</code>, we cache the preparsed grammar,
609      *                otherwise, no chaching. Default is <code>false</code>.
610      * @return The preparsed schema grammar object (SchemaGrammar or
611      *         DTDGrammar). That grammar object is owned by the parser.
612      *
613      * @exception SAXException Any SAX exception, possibly
614      *            wrapping another exception.
615      * @exception XMLException An exception from the parser or client
616      *            handler code.
617      * @exception DOMException A DOM exception as per DOM spec.
618      *
619      * @see DOMInputSource#DOMInputSource
620      */
621    virtual Grammar* loadGrammar(const DOMInputSource& source,
622                                 const short grammarType,
623                                 const bool toCache = false) = 0;
624
625    /**
626      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
627      *
628      * This method invokes the preparsing process on a schema grammar XML
629      * file specified by the file path parameter. If the 'toCache' flag is
630      * enabled, the parser will cache the grammars for re-use. If a grammar
631      * key is found in the pool, no caching of any grammar will take place.
632      *
633      * <p><b>"Experimental - subject to change"</b></p>
634      *
635      * @param systemId A const XMLCh pointer to the Unicode string which
636      *                 contains the path to the XML grammar file to be
637      *                 preparsed.
638      * @param grammarType The grammar type (Schema or DTD).
639      * @param toCache If <code>true</code>, we cache the preparsed grammar,
640      *                otherwise, no chaching. Default is <code>false</code>.
641      * @return The preparsed schema grammar object (SchemaGrammar or
642      *         DTDGrammar). That grammar object is owned by the parser.
643      *
644      * @exception SAXException Any SAX exception, possibly
645      *            wrapping another exception.
646      * @exception XMLException An exception from the parser or client
647      *            handler code.
648      * @exception DOMException A DOM exception as per DOM spec.
649      */
650    virtual Grammar* loadGrammar(const XMLCh* const systemId,
651                                 const short grammarType,
652                                 const bool toCache = false) = 0;
653
654    /**
655      * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
656      *
657      * This method invokes the preparsing process on a schema grammar XML
658      * file specified by the file path parameter. If the 'toCache' flag is
659      * enabled, the parser will cache the grammars for re-use. If a grammar
660      * key is found in the pool, no caching of any grammar will take place.
661      *
662      * <p><b>"Experimental - subject to change"</b></p>
663      *
664      * @param systemId A const char pointer to a native string which contains
665      *                 the path to the XML grammar file to be preparsed.
666      * @param grammarType The grammar type (Schema or DTD).
667      * @param toCache If <code>true</code>, we cache the preparsed grammar,
668      *                otherwise, no chaching. Default is <code>false</code>.
669      * @return The preparsed schema grammar object (SchemaGrammar or
670      *         DTDGrammar). That grammar object is owned by the parser.
671      *
672      *
673      * @exception SAXException Any SAX exception, possibly
674      *            wrapping another exception.
675      * @exception XMLException An exception from the parser or client
676      *            handler code.
677      * @exception DOMException A DOM exception as per DOM spec.
678      */
679    virtual Grammar* loadGrammar(const char* const systemId,
680                                 const short grammarType,
681                                 const bool toCache = false) = 0;
682
683    /**
684     * Retrieve the grammar that is associated with the specified namespace key
685     *
686     * @param  nameSpaceKey Namespace key
687     * @return Grammar associated with the Namespace key.
688     */
689    virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) const = 0;
690
691    /**
692     * Retrieve the grammar where the root element is declared.
693     *
694     * @return Grammar where root element declared
695     */
696    virtual Grammar* getRootGrammar() const = 0;
697
698    /**
699     * Returns the string corresponding to a URI id from the URI string pool.
700     *
701     * @param uriId id of the string in the URI string pool.
702     * @return URI string corresponding to the URI id.
703     */
704    virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
705
706    /**
707      * Clear the cached grammar pool
708      */
709    virtual void resetCachedGrammarPool() = 0;
710
711    /**
712      * Returns the current src offset within the input source.
713      *
714      * @return offset within the input source
715      */
716    virtual unsigned int getSrcOffset() const = 0;
717
718    //@}
719
720};
721
722
723XERCES_CPP_NAMESPACE_END
724
725#endif
Note: See TracBrowser for help on using the repository browser.