Xerces-C++ 3.2.0

SAX2XMLReader.hpp
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * $Id: SAX2XMLReader.hpp 983783 2010-08-09 19:20:46Z amassari $
20 */
21
22 #if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP)
23 #define XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP
24
25 #include <xercesc/util/XercesDefs.hpp>
26 #include <xercesc/util/XMLUniDefs.hpp>
27 #include <xercesc/framework/XMLValidator.hpp>
28 #include <xercesc/framework/XMLPScanToken.hpp>
29 #include <xercesc/validators/common/Grammar.hpp>
30
31 XERCES_CPP_NAMESPACE_BEGIN
32
33 class ContentHandler ;
34 class DTDHandler;
35 class EntityResolver;
36 class ErrorHandler;
37 class InputSource;
38 class LexicalHandler;
39 class DeclHandler;
40 class XMLDocumentHandler;
41
42 class SAX2_EXPORT SAX2XMLReader
43 {
44 public:
45 // -----------------------------------------------------------------------
46 // Class types
47 // -----------------------------------------------------------------------
50
70 enum ValSchemes
71 {
72 Val_Never
73 , Val_Always
74 , Val_Auto
75 };
77
78
79 // -----------------------------------------------------------------------
80 // Constructors and Destructor
81 // -----------------------------------------------------------------------
85 SAX2XMLReader()
86 {
87 }
89 virtual ~SAX2XMLReader()
90 {
91 }
93
94 //-----------------------------------------------------------------------
95 // The XMLReader interface
96 //-----------------------------------------------------------------------
99
105 virtual ContentHandler* getContentHandler() const = 0 ;
106
112 virtual DTDHandler* getDTDHandler() const = 0;
113
119 virtual EntityResolver* getEntityResolver() const = 0 ;
120
126 virtual ErrorHandler* getErrorHandler() const = 0 ;
127
135 virtual bool getFeature(const XMLCh* const name) const = 0;
136
155 virtual void* getProperty(const XMLCh* const name) const = 0 ;
156
173 virtual void setContentHandler(ContentHandler* const handler) = 0;
174
190 virtual void setDTDHandler(DTDHandler* const handler) = 0;
191
208 virtual void setEntityResolver(EntityResolver* const resolver) = 0;
209
227 virtual void setErrorHandler(ErrorHandler* const handler) = 0;
228
252 virtual void setFeature(const XMLCh* const name, const bool value) = 0;
253
280 virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
281
307 virtual void parse
308 (
309 const InputSource& source
310 ) = 0;
311
331 virtual void parse
332 (
333 const XMLCh* const systemId
334 ) = 0;
335
355 virtual void parse
356 (
357 const char* const systemId
358 ) = 0;
359
361
362 // -----------------------------------------------------------------------
363 // SAX 2.0-ext
364 // -----------------------------------------------------------------------
372 virtual DeclHandler* getDeclarationHandler() const = 0 ;
373
379 virtual LexicalHandler* getLexicalHandler() const = 0 ;
380
397 virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
398
415 virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
416
418
419 // -----------------------------------------------------------------------
420 // Getter Methods
421 // -----------------------------------------------------------------------
434 virtual XMLValidator* getValidator() const = 0;
435
446 virtual XMLSize_t getErrorCount() const = 0 ;
447
461 virtual bool getExitOnFirstFatalError() const = 0;
462
477 virtual bool getValidationConstraintFatal() const = 0;
478
485 virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
486
492 virtual Grammar* getRootGrammar() = 0;
493
500 virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
501
508 virtual XMLFilePos getSrcOffset() const = 0;
509
511
512 // -----------------------------------------------------------------------
513 // Setter Methods
514 // -----------------------------------------------------------------------
526 virtual void setValidator(XMLValidator* valueToAdopt) = 0;
527
549 virtual void setExitOnFirstFatalError(const bool newState) = 0;
550
576 virtual void setValidationConstraintFatal(const bool newState) = 0;
578
579
580 // -----------------------------------------------------------------------
581 // Progressive scan methods
582 // -----------------------------------------------------------------------
583
586
614 virtual bool parseFirst
615 (
616 const XMLCh* const systemId
617 , XMLPScanToken& toFill
618 ) = 0;
619
647 virtual bool parseFirst
648 (
649 const char* const systemId
650 , XMLPScanToken& toFill
651 ) = 0;
652
680 virtual bool parseFirst
681 (
682 const InputSource& source
683 , XMLPScanToken& toFill
684 ) = 0;
685
710 virtual bool parseNext(XMLPScanToken& token) = 0;
711
733 virtual void parseReset(XMLPScanToken& token) = 0;
734
736
737 // -----------------------------------------------------------------------
738 // Grammar preparsing interface
739 // -----------------------------------------------------------------------
740
769 virtual Grammar* loadGrammar(const InputSource& source,
770 const Grammar::GrammarType grammarType,
771 const bool toCache = false) = 0;
772
797 virtual Grammar* loadGrammar(const XMLCh* const systemId,
798 const Grammar::GrammarType grammarType,
799 const bool toCache = false) = 0;
800
824 virtual Grammar* loadGrammar(const char* const systemId,
825 const Grammar::GrammarType grammarType,
826 const bool toCache = false) = 0;
827
831 virtual void resetCachedGrammarPool() = 0;
832
843 virtual void setInputBufferSize(const XMLSize_t bufferSize);
844
846
847
848 // -----------------------------------------------------------------------
849 // Advanced document handler list maintenance methods
850 // -----------------------------------------------------------------------
851
867 virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
868
878 virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
880
881 private :
882 /* The copy constructor, you cannot call this directly */
883 SAX2XMLReader(const SAX2XMLReader&);
884
885 /* The assignment operator, you cannot call this directly */
886 SAX2XMLReader& operator=(const SAX2XMLReader&);
887
888 };
889
890 inline void SAX2XMLReader::setInputBufferSize(const XMLSize_t /*bufferSize*/)
891 {
892 }
893
894 XERCES_CPP_NAMESPACE_END
895
896 #endif
XMLValidator.hpp
DTDHandler
Receive notification of basic DTD-related events.
Definition: DTDHandler.hpp:59
XercesDefs.hpp
EntityResolver
Basic interface for resolving entities.
Definition: EntityResolver.hpp:86
ErrorHandler
Basic interface for SAX error handlers.
Definition: ErrorHandler.hpp:60
SAX2XMLReader::~SAX2XMLReader
virtual ~SAX2XMLReader()
The destructor.
Definition: SAX2XMLReader.hpp:89
XMLFilePos
XMLUInt64 XMLFilePos
Definition: Xerces_autoconf_config.hpp:137
SAX2_EXPORT
#define SAX2_EXPORT
Definition: XercesDefs.hpp:165
XMLDocumentHandler
This abstract class provides the interface for the scanner to return XML document information up to t...
Definition: XMLDocumentHandler.hpp:42
SAX2XMLReader
Definition: SAX2XMLReader.hpp:42
XMLUniDefs.hpp
SAX2XMLReader::ValSchemes
ValSchemes
ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors.
Definition: SAX2XMLReader.hpp:70
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:118
ContentHandler
Receive notification of general document events.
Definition: ContentHandler.hpp:60
DeclHandler
Receive notification of DTD declaration events.
Definition: DeclHandler.hpp:48
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
SAX2XMLReader::SAX2XMLReader
SAX2XMLReader()
The default constructor.
Definition: SAX2XMLReader.hpp:85
XMLValidator
This abstract class provides the interface for all validators.
Definition: XMLValidator.hpp:52
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:110
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
SAX2XMLReader::setInputBufferSize
virtual void setInputBufferSize(const XMLSize_t bufferSize)
Set maximum input buffer size.
Definition: SAX2XMLReader.hpp:890
LexicalHandler
Receive notification of lexical events.
Definition: LexicalHandler.hpp:46
InputSource
A single input source for an XML entity.
Definition: InputSource.hpp:62