SAX2XMLReader.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id$
*/
#if !defined(XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP)
#define XERCESC_INCLUDE_GUARD_SAX2XMLREADER_HPP
#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/framework/XMLValidator.hpp>
#include <xercesc/framework/XMLPScanToken.hpp>
#include <xercesc/validators/common/Grammar.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class ContentHandler ;
class DTDHandler;
class EntityResolver;
class ErrorHandler;
class InputSource;
class LexicalHandler;
class DeclHandler;
class XMLDocumentHandler;
class SAX2_EXPORT SAX2XMLReader
{
public:
// -----------------------------------------------------------------------
// Class types
// -----------------------------------------------------------------------
enum ValSchemes
{
Val_Never
, Val_Always
, Val_Auto
};
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
SAX2XMLReader()
{
}
virtual ~SAX2XMLReader()
{
}
//-----------------------------------------------------------------------
// The XMLReader interface
//-----------------------------------------------------------------------
virtual ContentHandler* getContentHandler() const = 0 ;
virtual DTDHandler* getDTDHandler() const = 0;
virtual EntityResolver* getEntityResolver() const = 0 ;
virtual ErrorHandler* getErrorHandler() const = 0 ;
virtual bool getFeature(const XMLCh* const name) const = 0;
virtual void* getProperty(const XMLCh* const name) const = 0 ;
virtual void setContentHandler(ContentHandler* const handler) = 0;
virtual void setDTDHandler(DTDHandler* const handler) = 0;
virtual void setEntityResolver(EntityResolver* const resolver) = 0;
virtual void setErrorHandler(ErrorHandler* const handler) = 0;
virtual void setFeature(const XMLCh* const name, const bool value) = 0;
virtual void setProperty(const XMLCh* const name, void* value) = 0 ;
virtual void parse
(
const InputSource& source
) = 0;
virtual void parse
(
const XMLCh* const systemId
) = 0;
virtual void parse
(
const char* const systemId
) = 0;
// -----------------------------------------------------------------------
// SAX 2.0-ext
// -----------------------------------------------------------------------
virtual DeclHandler* getDeclarationHandler() const = 0 ;
virtual LexicalHandler* getLexicalHandler() const = 0 ;
virtual void setDeclarationHandler(DeclHandler* const handler) = 0;
virtual void setLexicalHandler(LexicalHandler* const handler) = 0;
// -----------------------------------------------------------------------
// Getter Methods
// -----------------------------------------------------------------------
virtual XMLValidator* getValidator() const = 0;
virtual XMLSize_t getErrorCount() const = 0 ;
virtual bool getExitOnFirstFatalError() const = 0;
virtual bool getValidationConstraintFatal() const = 0;
virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0;
virtual Grammar* getRootGrammar() = 0;
virtual const XMLCh* getURIText(unsigned int uriId) const = 0;
virtual XMLFilePos getSrcOffset() const = 0;
// -----------------------------------------------------------------------
// Setter Methods
// -----------------------------------------------------------------------
virtual void setValidator(XMLValidator* valueToAdopt) = 0;
virtual void setExitOnFirstFatalError(const bool newState) = 0;
virtual void setValidationConstraintFatal(const bool newState) = 0;
// -----------------------------------------------------------------------
// Progressive scan methods
// -----------------------------------------------------------------------
virtual bool parseFirst
(
const XMLCh* const systemId
, XMLPScanToken& toFill
) = 0;
virtual bool parseFirst
(
const char* const systemId
, XMLPScanToken& toFill
) = 0;
virtual bool parseFirst
(
const InputSource& source
, XMLPScanToken& toFill
) = 0;
virtual bool parseNext(XMLPScanToken& token) = 0;
virtual void parseReset(XMLPScanToken& token) = 0;
// -----------------------------------------------------------------------
// Grammar preparsing interface
// -----------------------------------------------------------------------
virtual Grammar* loadGrammar(const InputSource& source,
const Grammar::GrammarType grammarType,
const bool toCache = false) = 0;
virtual Grammar* loadGrammar(const XMLCh* const systemId,
const Grammar::GrammarType grammarType,
const bool toCache = false) = 0;
virtual Grammar* loadGrammar(const char* const systemId,
const Grammar::GrammarType grammarType,
const bool toCache = false) = 0;
virtual void resetCachedGrammarPool() = 0;
virtual void setInputBufferSize(const XMLSize_t bufferSize);
// -----------------------------------------------------------------------
// Advanced document handler list maintenance methods
// -----------------------------------------------------------------------
virtual void installAdvDocHandler(XMLDocumentHandler* const toInstall) = 0;
virtual bool removeAdvDocHandler(XMLDocumentHandler* const toRemove) = 0;
private :
/* The copy constructor, you cannot call this directly */
SAX2XMLReader(const SAX2XMLReader&);
/* The assignment operator, you cannot call this directly */
SAX2XMLReader& operator=(const SAX2XMLReader&);
};
inline void SAX2XMLReader::setInputBufferSize(const XMLSize_t /*bufferSize*/)
{
}
XERCES_CPP_NAMESPACE_END
#endif
XMLUniDefs.hpp
XMLValidator.hpp
XercesDefs.hpp
SAX2_EXPORT
#define SAX2_EXPORT
Definition XercesDefs.hpp:165
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
XMLSize_t
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
XMLCh
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
XMLFilePos
XMLUInt64 XMLFilePos
Definition Xerces_autoconf_config.hpp:139
ContentHandler
Receive notification of general document events.
Definition ContentHandler.hpp:61
DTDHandler
Receive notification of basic DTD-related events.
Definition DTDHandler.hpp:60
DeclHandler
Receive notification of DTD declaration events.
Definition DeclHandler.hpp:49
EntityResolver
Basic interface for resolving entities.
Definition EntityResolver.hpp:87
ErrorHandler
Basic interface for SAX error handlers.
Definition ErrorHandler.hpp:61
InputSource
A single input source for an XML entity.
Definition InputSource.hpp:63
LexicalHandler
Receive notification of lexical events.
Definition LexicalHandler.hpp:47
SAX2XMLReader
Definition SAX2XMLReader.hpp:43
SAX2XMLReader::setProperty
virtual void setProperty(const XMLCh *const name, void *value)=0
Set the value of any property in a SAX2 XMLReader.
SAX2XMLReader::getURIText
virtual const XMLCh * getURIText(unsigned int uriId) const =0
Returns the string corresponding to a URI id from the URI string pool.
SAX2XMLReader::setValidationConstraintFatal
virtual void setValidationConstraintFatal(const bool newState)=0
This method allows users to set the parser's behaviour when it encounters a validation constraint err...
SAX2XMLReader::getRootGrammar
virtual Grammar * getRootGrammar()=0
Retrieve the grammar where the root element is declared.
SAX2XMLReader::parse
virtual void parse(const InputSource &source)=0
Parse an XML document.
SAX2XMLReader::loadGrammar
virtual Grammar * loadGrammar(const XMLCh *const systemId, const Grammar::GrammarType grammarType, const bool toCache=false)=0
Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL.
SAX2XMLReader::setValidator
virtual void setValidator(XMLValidator *valueToAdopt)=0
This method is used to set a validator.
SAX2XMLReader::setLexicalHandler
virtual void setLexicalHandler(LexicalHandler *const handler)=0
Allow an application to register a lexical event handler.
SAX2XMLReader::loadGrammar
virtual Grammar * loadGrammar(const InputSource &source, const Grammar::GrammarType grammarType, const bool toCache=false)=0
Preparse schema grammar (XML Schema, DTD, etc.) via an input source object.
SAX2XMLReader::getSrcOffset
virtual XMLFilePos getSrcOffset() const =0
Returns the current src offset within the input source.
SAX2XMLReader::getProperty
virtual void * getProperty(const XMLCh *const name) const =0
Query the current value of a property in a SAX2 XMLReader.
SAX2XMLReader::removeAdvDocHandler
virtual bool removeAdvDocHandler(XMLDocumentHandler *const toRemove)=0
This method removes the 'advanced' document handler callback from the underlying parser scanner.
SAX2XMLReader::installAdvDocHandler
virtual void installAdvDocHandler(XMLDocumentHandler *const toInstall)=0
This method installs the specified 'advanced' document callback handler, thereby allowing the user to...
SAX2XMLReader::parseReset
virtual void parseReset(XMLPScanToken &token)=0
Reset the parser after a progressive parse.
SAX2XMLReader::setDeclarationHandler
virtual void setDeclarationHandler(DeclHandler *const handler)=0
Allow an application to register a declaration event handler.
SAX2XMLReader::~SAX2XMLReader
virtual ~SAX2XMLReader()
The destructor.
Definition SAX2XMLReader.hpp:89
SAX2XMLReader::getExitOnFirstFatalError
virtual bool getExitOnFirstFatalError() const =0
This method returns the state of the parser's exit-on-First-Fatal-Error flag.
SAX2XMLReader::getFeature
virtual bool getFeature(const XMLCh *const name) const =0
Query the current state of any feature in a SAX2 XMLReader.
SAX2XMLReader::setInputBufferSize
virtual void setInputBufferSize(const XMLSize_t bufferSize)
Set maximum input buffer size.
Definition SAX2XMLReader.hpp:890
SAX2XMLReader::getLexicalHandler
virtual LexicalHandler * getLexicalHandler() const =0
This method returns the installed lexical handler.
SAX2XMLReader::resetCachedGrammarPool
virtual void resetCachedGrammarPool()=0
Clear the cached grammar pool.
SAX2XMLReader::setErrorHandler
virtual void setErrorHandler(ErrorHandler *const handler)=0
Allow an application to register an error event handler.
SAX2XMLReader::getValidator
virtual XMLValidator * getValidator() const =0
This method is used to get the current validator.
SAX2XMLReader::getDeclarationHandler
virtual DeclHandler * getDeclarationHandler() const =0
This method returns the installed declaration handler.
SAX2XMLReader::setContentHandler
virtual void setContentHandler(ContentHandler *const handler)=0
Allow an application to register a document event handler.
SAX2XMLReader::getDTDHandler
virtual DTDHandler * getDTDHandler() const =0
This method returns the installed DTD handler.
SAX2XMLReader::setFeature
virtual void setFeature(const XMLCh *const name, const bool value)=0
Set the state of any feature in a SAX2 XMLReader.
SAX2XMLReader::getErrorCount
virtual XMLSize_t getErrorCount() const =0
Get error count from the last parse operation.
SAX2XMLReader::parseFirst
virtual bool parseFirst(const char *const systemId, XMLPScanToken &toFill)=0
Begin a progressive parse operation.
SAX2XMLReader::parse
virtual void parse(const char *const systemId)=0
Parse an XML document from a system identifier (URI).
SAX2XMLReader::parseFirst
virtual bool parseFirst(const InputSource &source, XMLPScanToken &toFill)=0
Begin a progressive parse operation.
SAX2XMLReader::setEntityResolver
virtual void setEntityResolver(EntityResolver *const resolver)=0
Allow an application to register a custom entity resolver.
SAX2XMLReader::setDTDHandler
virtual void setDTDHandler(DTDHandler *const handler)=0
Allow an application to register a DTD event handler.
SAX2XMLReader::loadGrammar
virtual Grammar * loadGrammar(const char *const systemId, const Grammar::GrammarType grammarType, const bool toCache=false)=0
Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL.
SAX2XMLReader::getGrammar
virtual Grammar * getGrammar(const XMLCh *const nameSpaceKey)=0
Retrieve the grammar that is associated with the specified namespace key.
SAX2XMLReader::getContentHandler
virtual ContentHandler * getContentHandler() const =0
This method returns the installed content handler.
SAX2XMLReader::setExitOnFirstFatalError
virtual void setExitOnFirstFatalError(const bool newState)=0
This method allows users to set the parser's behaviour when it encounters the first fatal error.
SAX2XMLReader::ValSchemes
ValSchemes
ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors.
Definition SAX2XMLReader.hpp:71
SAX2XMLReader::parseFirst
virtual bool parseFirst(const XMLCh *const systemId, XMLPScanToken &toFill)=0
Begin a progressive parse operation.
SAX2XMLReader::getValidationConstraintFatal
virtual bool getValidationConstraintFatal() const =0
This method returns the state of the parser's validation-constraint-fatal flag.
SAX2XMLReader::parseNext
virtual bool parseNext(XMLPScanToken &token)=0
Continue a progressive parse operation.
SAX2XMLReader::getErrorHandler
virtual ErrorHandler * getErrorHandler() const =0
This method returns the installed error handler.
SAX2XMLReader::getEntityResolver
virtual EntityResolver * getEntityResolver() const =0
This method returns the installed entity resolver.
SAX2XMLReader::parse
virtual void parse(const XMLCh *const systemId)=0
Parse an XML document from a system identifier (URI).
SAX2XMLReader::SAX2XMLReader
SAX2XMLReader()
The default constructor.
Definition SAX2XMLReader.hpp:85
XMLDocumentHandler
This abstract class provides the interface for the scanner to return XML document information up to t...
Definition XMLDocumentHandler.hpp:43
XMLValidator
This abstract class provides the interface for all validators.
Definition XMLValidator.hpp:53