Go to the documentation of this file.
22 #if !defined(XERCESC_INCLUDE_GUARD_SAXPARSER_HPP)
23 #define XERCESC_INCLUDE_GUARD_SAXPARSER_HPP
26 #include <xercesc/internal/VecAttrListImpl.hpp>
31 #include <xercesc/framework/XMLBuffer.hpp>
33 #include <xercesc/validators/common/Grammar.hpp>
34 #include <xercesc/validators/DTD/DocTypeHandler.hpp>
45 class GrammarResolver;
76 ,
public DocTypeHandler
1061 const XMLCh*
const systemId
1062 , XMLPScanToken& toFill
1094 const char*
const systemId
1095 , XMLPScanToken& toFill
1128 , XMLPScanToken& toFill
1215 const Grammar::GrammarType grammarType,
1216 const bool toCache =
false);
1243 const Grammar::GrammarType grammarType,
1244 const bool toCache =
false);
1270 const Grammar::GrammarType grammarType,
1271 const bool toCache =
false);
1316 virtual void parse(
const char*
const systemId);
1425 const XMLCh*
const chars
1427 ,
const bool cdataSection
1441 const XMLCh*
const comment
1465 const XMLCh*
const target
1466 ,
const XMLCh*
const data
1504 ,
const unsigned int urlId
1506 ,
const XMLCh*
const elemPrefix
1545 const XMLCh*
const chars
1547 ,
const bool cdataSection
1597 ,
const unsigned int urlId
1598 ,
const XMLCh*
const elemPrefix
1599 ,
const RefVectorOf<XMLAttr>& attrList
1601 ,
const bool isEmpty
1638 const XMLCh*
const versionStr
1639 ,
const XMLCh*
const encodingStr
1640 ,
const XMLCh*
const standaloneStr
1641 ,
const XMLCh*
const actualEncodingStr
1677 const unsigned int errCode
1678 ,
const XMLCh*
const msgDomain
1680 ,
const XMLCh*
const errorText
1681 ,
const XMLCh*
const systemId
1682 ,
const XMLCh*
const publicId
1734 const XMLCh*
const systemId
1804 const DTDElementDecl& elemDecl
1805 ,
const DTDAttDef& attDef
1820 const XMLCh*
const comment
1843 const DTDElementDecl& elemDecl
1844 ,
const XMLCh*
const publicId
1845 ,
const XMLCh*
const systemId
1846 ,
const bool hasIntSubset
1847 ,
const bool hasExtSubset =
false
1865 const XMLCh*
const target
1866 ,
const XMLCh*
const data
1882 const XMLCh*
const chars
1900 const DTDElementDecl& decl
1901 ,
const bool isIgnored
1916 const DTDElementDecl& elemDecl
1951 const DTDEntityDecl& entityDecl
1952 ,
const bool isPEDecl
1953 ,
const bool isIgnored
1977 ,
const bool isIgnored
1992 const DTDElementDecl& elemDecl
2025 const XMLCh*
const versionStr
2026 ,
const XMLCh*
const encodingStr
2040 const XMLScanner& getScanner()
const;
2046 GrammarResolver* getGrammarResolver()
const;
2061 void resetInProgress();
2117 bool fParseInProgress;
2121 VecAttrListImpl fAttrList;
2129 XMLScanner* fScanner;
2130 GrammarResolver* fGrammarResolver;
2131 XMLStringPool* fURIStringPool;
2135 XMLBuffer fElemQNameBuf;
2154 return fEntityResolver;
2159 return fXMLEntityResolver;
2164 return fXMLEntityResolver;
2169 return fEntityResolver;
2174 return fErrorHandler;
2179 return fErrorHandler;
2184 return fPSVIHandler;
2189 return fPSVIHandler;
2199 return fGrammarResolver;
void setSkipDTDValidation(const bool newValue)
Set the 'skip DTD validation' flag.
virtual void attDef(const DTDElementDecl &elemDecl, const DTDAttDef &attDef, const bool ignore)
This method is used to report an attribute definition.
bool getValidationConstraintFatal() const
This method returns the state of the parser's validation-constraint-fatal flag.
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41
bool getSkipDTDValidation() const
Get the 'skip DTD validation' flag.
virtual void parse(const XMLCh *const systemId)
This method invokes the parsing process on the XML file specified by the Unicode string parameter 'sy...
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
bool parseFirst(const InputSource &source, XMLPScanToken &toFill)
Begin a progressive parse operation.
EntityResolver * getEntityResolver()
This method returns the installed entity resolver.
Definition: SAXParser.hpp:2152
void setValidationScheme(const ValSchemes newScheme)
This method allows users to set the validation scheme to be used by this parser.
char16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
ErrTypes
Definition: XMLErrorReporter.hpp:49
bool getIgnoreCachedDTD() const
Get the 'ignore cached DTD grammar' flag.
virtual void setXMLEntityResolver(XMLEntityResolver *const resolver)
This method installs the user specified entity resolver on the parser.
virtual void startDocument()
This method is used to report the start of the parsing process.
bool getExitOnFirstFatalError() const
This method returns the state of the parser's exit-on-First-Fatal-Error flag.
virtual void error(const unsigned int errCode, const XMLCh *const msgDomain, const XMLErrorReporter::ErrTypes errType, const XMLCh *const errorText, const XMLCh *const systemId, const XMLCh *const publicId, const XMLFileLoc lineNum, const XMLFileLoc colNum)
This method is used to report back errors found while parsing the XML file.
This abstract class provides the interface for the scanner to return PSVI information to the applicat...
Definition: PSVIHandler.hpp:39
void setLoadSchema(const bool newState)
Set the 'Loading Schema' flag.
void setValidateAnnotations(const bool newValue)
set the 'validate annotations' flag
void useScanner(const XMLCh *const scannerName)
Set the scanner to use when scanning the XML document.
void cacheGrammarFromParse(const bool newState)
Set the 'Grammar caching' flag.
virtual void endAttList(const DTDElementDecl &elemDecl)
This method is used to report the end of an attribute list declaration for an element.
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
virtual void doctypeWhitespace(const XMLCh *const chars, const XMLSize_t length)
This method is used to report any whitespaces occurring inside the DTD definition block.
bool removeAdvDocHandler(XMLDocumentHandler *const toRemove)
This method removes the 'advanced' document handler callback from the underlying parser scanner.
ValSchemes getValidationScheme() const
This method returns an enumerated value that indicates the current validation scheme set on this pars...
Receive notification of general document events.
Definition: DocumentHandler.hpp:61
XMLCh * getExternalNoNamespaceSchemaLocation() const
Get the noNamespace SchemaLocation that is specified externally.
virtual void notationDecl(const XMLNotationDecl ¬Decl, const bool isIgnored)
This method is used to report any notation declarations.
virtual void elementDecl(const DTDElementDecl &decl, const bool isIgnored)
This method is used to report an element declarations successfully scanned by the parser.
This class defines the core information of an element declaration.
Definition: XMLElementDecl.hpp:52
virtual void endElement(const XMLElementDecl &elemDecl, const unsigned int urlId, const bool isRoot, const XMLCh *const elemPrefix)
This method is used to indicate the end tag of an element.
virtual void parse(const char *const systemId)
This method invokes the parsing process on the XML file specified by the native char* string paramete...
XMLFilePos getSrcOffset() const
Returns the current src offset within the input source.
XMLUInt64 XMLFileLoc
Definition: Xerces_autoconf_config.hpp:144
void setIdentityConstraintChecking(const bool identityConstraintChecking)
This method allows the user to turn identity constraint checking on/off.
virtual void setPSVIHandler(PSVIHandler *const handler)
This method installs the user specified PSVI handler on the parser.
This abstract class is a callback mechanism for the scanner.
Definition: XMLEntityHandler.hpp:44
void setCalculateSrcOfs(const bool newState)
Enable/disable src offset calculation.
virtual void startElement(const XMLElementDecl &elemDecl, const unsigned int urlId, const XMLCh *const elemPrefix, const RefVectorOf< XMLAttr > &attrList, const XMLSize_t attrCount, const bool isEmpty, const bool isRoot)
This method is used to report the start of an element.
Grammar * loadGrammar(const XMLCh *const systemId, const Grammar::GrammarType grammarType, const bool toCache=false)
Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL.
bool parseFirst(const char *const systemId, XMLPScanToken &toFill)
Begin a progressive parse operation.
This class defines that core information that defines an XML entity, no matter what validator is used...
Definition: XMLEntityDecl.hpp:51
virtual void startExtSubset()
This method is used indicate the start of the external subset.
Definition: XMLResourceIdentifier.hpp:96
Grammar * getRootGrammar()
Retrieve the grammar where the root element is declared.
This class represents the core information about a notation declaration that all validators must at l...
Definition: XMLNotationDecl.hpp:42
virtual void startEntityReference(const XMLEntityDecl &entDecl)
This method is used to indicate the start of an entity reference.
void setValidationSchemaFullChecking(const bool schemaFullChecking)
This method allows the user to turn full Schema constraint checking on/off.
bool getDoNamespaces() const
This method returns the state of the parser's namespace handling capability.
SAXParser(XMLValidator *const valToAdopt=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager, XMLGrammarPool *const gramPool=0)
Constructor with an instance of validator class to use for validation.
ErrorHandler * getErrorHandler()
This method returns the installed error handler.
Definition: SAXParser.hpp:2172
virtual void startAttList(const DTDElementDecl &elemDecl)
This method is used to indicate the start of an element's attribute list declaration.
void setIgnoreCachedDTD(const bool newValue)
Set the 'ignore cached DTD grammar' flag.
virtual void setDTDHandler(DTDHandler *const handler)
This method installs the user specified DTD handler on the parser.
void setInputBufferSize(const XMLSize_t bufferSize)
Set maximum input buffer size.
Receive notification of basic DTD-related events.
Definition: DTDHandler.hpp:60
bool isUsingCachedGrammarInParse() const
Get the 'Use cached grammar' flag.
SecurityManager * getSecurityManager() const
Get the SecurityManager instance attached to this parser.
void setDoNamespaces(const bool newState)
This method allows users to enable or disable the parser's namespace processing.
bool getDisableDefaultEntityResolution() const
Get the 'disable default entity resolution' flag.
void setSecurityManager(SecurityManager *const securityManager)
This allows an application to set a SecurityManager on the parser; this object stores information tha...
virtual void setEntityResolver(EntityResolver *const resolver)
This method installs the user specified entity resolver on the parser.
void setExternalNoNamespaceSchemaLocation(const char *const noNamespaceSchemaLocation)
This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).
const XMLValidator & getValidator() const
This method returns a reference to the parser's installed validator.
DocumentHandler * getDocumentHandler()
This method returns the installed document handler.
Definition: SAXParser.hpp:2142
virtual void doctypeDecl(const DTDElementDecl &elemDecl, const XMLCh *const publicId, const XMLCh *const systemId, const bool hasIntSubset, const bool hasExtSubset=false)
This method is used to report the DOCTYPE declaration.
virtual void resetEntities()
This method allows the installed XMLEntityHandler to reset itself.
virtual void resetDocument()
This method allows the user installed Document Handler and any advanced callback handlers to 'reset' ...
Definition: XMLGrammarPool.hpp:44
virtual void endExtSubset()
This method is used to report the end of the external subset.
void setGenerateSyntheticAnnotations(const bool newValue)
set the 'generate synthetic annotations' flag
This abstract class defines a callback mechanism for the scanner.
Definition: XMLErrorReporter.hpp:43
XMLCh * getExternalSchemaLocation() const
Get the set of Namespace/SchemaLocation that is specified externally.
void resetCachedGrammarPool()
This method allows the user to reset the pool of cached grammars.
virtual void setDocumentHandler(DocumentHandler *const handler)
This method installs the user specified SAX Document Handler callback function on parser.
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
virtual void ignorableWhitespace(const XMLCh *const chars, const XMLSize_t length, const bool cdataSection)
This method is used to report all the whitespace characters, which are determined to be 'ignorable'.
virtual void startIntSubset()
This method is used indicate the start of the internal subset.
XMLUInt64 XMLFilePos
Definition: Xerces_autoconf_config.hpp:139
void setExternalSchemaLocation(const char *const schemaLocation)
This method is same as setExternalSchemaLocation(const XMLCh* const).
void setHandleMultipleImports(const bool newValue)
Set the 'handle multiple schema imports' flag.
bool getValidateAnnotations() const
Get the 'validate annotations' flag.
bool getIdentityConstraintChecking() const
Get the 'identity constraint checking' flag.
virtual void resetDocType()
This method allows the user installed DTD handler to reset itself.
virtual void resetErrors()
This method allows the user installed Error Handler callback to 'reset' itself.
void setExternalSchemaLocation(const XMLCh *const schemaLocation)
This method allows the user to specify a list of schemas to use.
const XMLCh * getURIText(unsigned int uriId) const
Returns the string corresponding to a URI id from the URI string pool.
virtual bool expandSystemId(const XMLCh *const systemId, XMLBuffer &toFill)
This method allows an installed XMLEntityHandler to further process any system id's of external entit...
ValSchemes
ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors.
Definition: SAXParser.hpp:91
int getErrorCount() const
Get error count from the last parse operation.
bool getDoSchema() const
Get the 'do schema' flag.
void setExternalNoNamespaceSchemaLocation(const XMLCh *const noNamespaceSchemaLocation)
This method allows the user to specify the no target namespace XML Schema Location externally.
void setDisableDefaultEntityResolution(const bool newValue)
Set the 'disable default entity resolution' flag.
virtual void docCharacters(const XMLCh *const chars, const XMLSize_t length, const bool cdataSection)
This method is used to report all the characters scanned by the parser.
void setLowWaterMark(XMLSize_t lwm)
Set the raw buffer low water mark for this parser.
virtual void docPI(const XMLCh *const target, const XMLCh *const data)
This method is used to report any PI scanned by the parser.
void setDoSchema(const bool newState)
Set the 'schema support' flag.
void setLoadExternalDTD(const bool newState)
Set the 'Loading External DTD' flag.
bool isCachingGrammarFromParse() const
Get the 'Grammar caching' flag.
void setValidationConstraintFatal(const bool newState)
This method allows users to set the parser's behaviour when it encounters a validation constraint err...
void setIgnoreAnnotations(const bool newValue)
Set the 'ignore annotation' flag.
void setStandardUriConformant(const bool newState)
Force standard uri.
bool parseFirst(const XMLCh *const systemId, XMLPScanToken &toFill)
Begin a progressive parse operation.
void useCachedGrammarInParse(const bool newState)
Set the 'Use cached grammar' flag.
virtual void TextDecl(const XMLCh *const versionStr, const XMLCh *const encodingStr)
This method is used to report the TextDecl.
Allow application to force the parser to behave in a security-conscious way.
Definition: SecurityManager.hpp:52
Basic interface for resolving entities.
Definition: EntityResolver.hpp:87
Basic interface for SAX (Simple API for XML) parsers.
Definition: Parser.hpp:61
bool getValidationSchemaFullChecking() const
Get the 'full schema constraint checking' flag.
virtual void setErrorHandler(ErrorHandler *const handler)
This method installs the user specified error handler on the parser.
#define PARSERS_EXPORT
Definition: XercesDefs.hpp:168
virtual void XMLDecl(const XMLCh *const versionStr, const XMLCh *const encodingStr, const XMLCh *const standaloneStr, const XMLCh *const actualEncodingStr)
This method is used to report the XML decl scanned by the parser.
Grammar * getGrammar(const XMLCh *const nameSpaceKey)
Retrieve the grammar that is associated with the specified namespace key.
Revised interface for resolving entities.
Definition: XMLEntityResolver.hpp:100
virtual InputSource * resolveEntity(XMLResourceIdentifier *resourceIdentifier)
Resolve a public/system id.
XMLEntityResolver * getXMLEntityResolver()
This method returns the installed entity resolver.
Definition: SAXParser.hpp:2157
virtual void docComment(const XMLCh *const comment)
This method is used to report any comments scanned by the parser.
virtual void endIntSubset()
This method is used to report the end of the internal subset.
Grammar * loadGrammar(const InputSource &source, const Grammar::GrammarType grammarType, const bool toCache=false)
Preparse schema grammar (XML Schema, DTD, etc.) via an input source object.
const XMLScanner & getScanner() const
This method returns a reference to the underlying scanner object.
Definition: SAXParser.hpp:2192
bool getLoadSchema() const
Get the 'Loading Schema' flag.
This class implements the SAX 'Parser' interface and should be used by applications wishing to parse ...
Definition: SAXParser.hpp:77
bool getLoadExternalDTD() const
Get the 'Loading External DTD' flag.
PSVIHandler * getPSVIHandler()
This method returns the installed PSVI handler.
Definition: SAXParser.hpp:2182
virtual void endInputSource(const InputSource &inputSource)
This method is used to indicate the end of parsing of an external entity file.
Configurable memory manager.
Definition: MemoryManager.hpp:40
bool getIgnoreAnnotations() const
Get the 'ignore annotations' flag.
XMLSize_t getLowWaterMark() const
Get the raw buffer low water mark for this parser.
bool getCalculateSrcOfs() const
Get the 'calculate src offset flag'.
void installAdvDocHandler(XMLDocumentHandler *const toInstall)
This method installs the specified 'advanced' document callback handler, thereby allowing the user to...
virtual void parse(const InputSource &source)
This method invokes the parsing process on the XML file specified by the InputSource parameter.
This abstract class provides the interface for all validators.
Definition: XMLValidator.hpp:53
bool getHandleMultipleImports() const
Get the 'handle multiple schema imports' flag.
virtual void endEntityReference(const XMLEntityDecl &entDecl)
This method is used to indicate that an end of an entity reference was just scanned.
virtual void startInputSource(const InputSource &inputSource)
This method is used to indicate the start of parsing an external entity file.
virtual void doctypePI(const XMLCh *const target, const XMLCh *const data)
This method is used to report any PI declarations occurring inside the DTD definition block.
bool getGenerateSyntheticAnnotations() const
Get the 'generate synthetic annotations' flag.
This abstract class provides the interface for the scanner to return XML document information up to t...
Definition: XMLDocumentHandler.hpp:43
void setExitOnFirstFatalError(const bool newState)
This method allows users to set the parser's behaviour when it encounters the first fatal error.
virtual void entityDecl(const DTDEntityDecl &entityDecl, const bool isPEDecl, const bool isIgnored)
This method is used to report any entity declarations.
bool parseNext(XMLPScanToken &token)
Continue a progressive parse operation.
Grammar * loadGrammar(const char *const systemId, const Grammar::GrammarType grammarType, const bool toCache=false)
Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL.
GrammarResolver * getGrammarResolver() const
Get the Grammar resolver.
Definition: SAXParser.hpp:2197
virtual void endDocument()
This method is used to indicate the end of root element was just scanned by the parser.
virtual void doctypeComment(const XMLCh *const comment)
This method is used to report a comment occurring within the DTD.
void parseReset(XMLPScanToken &token)
Reset the parser after a progressive parse.
Basic interface for SAX error handlers.
Definition: ErrorHandler.hpp:61
bool getStandardUriConformant() const
Get the 'force standard uri flag'.