Xerces-C++  3.2.3
SAXParser.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$
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_SAXPARSER_HPP)
23 #define XERCESC_INCLUDE_GUARD_SAXPARSER_HPP
24 
25 #include <xercesc/sax/Parser.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>
35 
36 
38 
39 
40 class DocumentHandler;
41 class EntityResolver;
42 class XMLPScanToken;
43 class XMLScanner;
44 class XMLValidator;
45 class GrammarResolver;
46 class XMLGrammarPool;
47 class XMLEntityResolver;
49 class PSVIHandler;
50 
70 
71  public XMemory
72  , public Parser
73  , public XMLDocumentHandler
74  , public XMLErrorReporter
75  , public XMLEntityHandler
76  , public DocTypeHandler
77 {
78 public :
79  // -----------------------------------------------------------------------
80  // Class types
81  // -----------------------------------------------------------------------
91  {
92  Val_Never
93  , Val_Always
94  , Val_Auto
95  };
96 
97 
98  // -----------------------------------------------------------------------
99  // Constructors and Destructor
100  // -----------------------------------------------------------------------
112  (
113  XMLValidator* const valToAdopt = 0
115  , XMLGrammarPool* const gramPool = 0
116  );
117 
123 
124 
125  // -----------------------------------------------------------------------
126  // Getter Methods
127  // -----------------------------------------------------------------------
136  DocumentHandler* getDocumentHandler();
137 
144  const DocumentHandler* getDocumentHandler() const;
145 
152  EntityResolver* getEntityResolver();
153 
160  const EntityResolver* getEntityResolver() const;
161 
168  XMLEntityResolver* getXMLEntityResolver();
169 
176  const XMLEntityResolver* getXMLEntityResolver() const;
177 
184  ErrorHandler* getErrorHandler();
185 
192  const ErrorHandler* getErrorHandler() const;
193 
200  PSVIHandler* getPSVIHandler();
201 
208  const PSVIHandler* getPSVIHandler() const;
209 
216  const XMLValidator& getValidator() const;
217 
226 
237  bool getDoSchema() const;
238 
250 
262 
273  int getErrorCount() const;
274 
284  bool getDoNamespaces() const;
285 
296 
308 
329 
350 
367 
382 
394  bool getLoadExternalDTD() const;
395 
407  bool getLoadSchema() const;
408 
420 
432 
444  bool getCalculateSrcOfs() const;
445 
457 
464  Grammar* getGrammar(const XMLCh* const nameSpaceKey);
465 
471  Grammar* getRootGrammar();
472 
479  const XMLCh* getURIText(unsigned int uriId) const;
480 
488 
501 
510 
518  bool getIgnoreCachedDTD() const;
519 
527  bool getIgnoreAnnotations() const;
528 
537 
545  bool getSkipDTDValidation() const;
546 
556 
557 
558  // -----------------------------------------------------------------------
559  // Setter methods
560  // -----------------------------------------------------------------------
561 
574  void setGenerateSyntheticAnnotations(const bool newValue);
575 
583  void setValidateAnnotations(const bool newValue);
584 
598  void setDoNamespaces(const bool newState);
599 
616  void setValidationScheme(const ValSchemes newScheme);
617 
633  void setDoSchema(const bool newState);
634 
651  void setValidationSchemaFullChecking(const bool schemaFullChecking);
652 
664  void setIdentityConstraintChecking(const bool identityConstraintChecking);
665 
681  void setExitOnFirstFatalError(const bool newState);
682 
702  void setValidationConstraintFatal(const bool newState);
703 
724  void setExternalSchemaLocation(const XMLCh* const schemaLocation);
725 
734  void setExternalSchemaLocation(const char* const schemaLocation);
735 
750  void setExternalNoNamespaceSchemaLocation(const XMLCh* const noNamespaceSchemaLocation);
751 
760  void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
761 
777  void setSecurityManager(SecurityManager* const securityManager);
778 
793 
810  void setLoadExternalDTD(const bool newState);
811 
827  void setLoadSchema(const bool newState);
828 
846  void cacheGrammarFromParse(const bool newState);
847 
866  void useCachedGrammarInParse(const bool newState);
867 
880  void setCalculateSrcOfs(const bool newState);
881 
892  void setStandardUriConformant(const bool newState);
893 
901  void useScanner(const XMLCh* const scannerName);
902 
913  void setInputBufferSize(const XMLSize_t bufferSize);
914 
929  void setIgnoreCachedDTD(const bool newValue);
930 
940  void setIgnoreAnnotations(const bool newValue);
941 
956  void setDisableDefaultEntityResolution(const bool newValue);
957 
970  void setSkipDTDValidation(const bool newValue);
971 
983  void setHandleMultipleImports(const bool newValue);
985 
986 
987  // -----------------------------------------------------------------------
988  // Advanced document handler list maintenance methods
989  // -----------------------------------------------------------------------
990 
1009 
1023 
1024 
1025  // -----------------------------------------------------------------------
1026  // Progressive scan methods
1027  // -----------------------------------------------------------------------
1028 
1031 
1060  (
1061  const XMLCh* const systemId
1062  , XMLPScanToken& toFill
1063  );
1064 
1093  (
1094  const char* const systemId
1095  , XMLPScanToken& toFill
1096  );
1097 
1126  (
1127  const InputSource& source
1128  , XMLPScanToken& toFill
1129  );
1130 
1155  bool parseNext(XMLPScanToken& token);
1156 
1178  void parseReset(XMLPScanToken& token);
1179 
1181 
1182  // -----------------------------------------------------------------------
1183  // Grammar preparsing interface
1184  // -----------------------------------------------------------------------
1185 
1214  Grammar* loadGrammar(const InputSource& source,
1215  const Grammar::GrammarType grammarType,
1216  const bool toCache = false);
1217 
1242  Grammar* loadGrammar(const XMLCh* const systemId,
1243  const Grammar::GrammarType grammarType,
1244  const bool toCache = false);
1245 
1269  Grammar* loadGrammar(const char* const systemId,
1270  const Grammar::GrammarType grammarType,
1271  const bool toCache = false);
1272 
1277 
1279 
1280 
1281  // -----------------------------------------------------------------------
1282  // Implementation of the SAX Parser interface
1283  // -----------------------------------------------------------------------
1284 
1296  virtual void parse(const InputSource& source);
1297 
1307  virtual void parse(const XMLCh* const systemId);
1308 
1316  virtual void parse(const char* const systemId);
1317 
1328  virtual void setDocumentHandler(DocumentHandler* const handler);
1329 
1339  virtual void setDTDHandler(DTDHandler* const handler);
1340 
1351  virtual void setErrorHandler(ErrorHandler* const handler);
1352 
1363  virtual void setPSVIHandler(PSVIHandler* const handler);
1364 
1380  virtual void setEntityResolver(EntityResolver* const resolver);
1381 
1397  virtual void setXMLEntityResolver(XMLEntityResolver* const resolver);
1398 
1400 
1401 
1402  // -----------------------------------------------------------------------
1403  // Implementation of the XMLDocumentHandler interface
1404  // -----------------------------------------------------------------------
1405 
1423  virtual void docCharacters
1424  (
1425  const XMLCh* const chars
1426  , const XMLSize_t length
1427  , const bool cdataSection
1428  );
1429 
1439  virtual void docComment
1440  (
1441  const XMLCh* const comment
1442  );
1443 
1463  virtual void docPI
1464  (
1465  const XMLCh* const target
1466  , const XMLCh* const data
1467  );
1468 
1480  virtual void endDocument();
1481 
1501  virtual void endElement
1502  (
1503  const XMLElementDecl& elemDecl
1504  , const unsigned int urlId
1505  , const bool isRoot
1506  , const XMLCh* const elemPrefix
1507  );
1508 
1519  virtual void endEntityReference
1520  (
1521  const XMLEntityDecl& entDecl
1522  );
1523 
1543  virtual void ignorableWhitespace
1544  (
1545  const XMLCh* const chars
1546  , const XMLSize_t length
1547  , const bool cdataSection
1548  );
1549 
1554  virtual void resetDocument();
1555 
1566  virtual void startDocument();
1567 
1594  virtual void startElement
1595  (
1596  const XMLElementDecl& elemDecl
1597  , const unsigned int urlId
1598  , const XMLCh* const elemPrefix
1599  , const RefVectorOf<XMLAttr>& attrList
1600  , const XMLSize_t attrCount
1601  , const bool isEmpty
1602  , const bool isRoot
1603  );
1604 
1615  (
1616  const XMLEntityDecl& entDecl
1617  );
1618 
1636  virtual void XMLDecl
1637  (
1638  const XMLCh* const versionStr
1639  , const XMLCh* const encodingStr
1640  , const XMLCh* const standaloneStr
1641  , const XMLCh* const actualEncodingStr
1642  );
1644 
1645 
1646  // -----------------------------------------------------------------------
1647  // Implementation of the XMLErrorReporter interface
1648  // -----------------------------------------------------------------------
1649 
1675  virtual void error
1676  (
1677  const unsigned int errCode
1678  , const XMLCh* const msgDomain
1679  , const XMLErrorReporter::ErrTypes errType
1680  , const XMLCh* const errorText
1681  , const XMLCh* const systemId
1682  , const XMLCh* const publicId
1683  , const XMLFileLoc lineNum
1684  , const XMLFileLoc colNum
1685  );
1686 
1695  virtual void resetErrors();
1697 
1698 
1699  // -----------------------------------------------------------------------
1700  // Implementation of the XMLEntityHandler interface
1701  // -----------------------------------------------------------------------
1702 
1716  virtual void endInputSource(const InputSource& inputSource);
1717 
1732  virtual bool expandSystemId
1733  (
1734  const XMLCh* const systemId
1735  , XMLBuffer& toFill
1736  );
1737 
1745  virtual void resetEntities();
1746 
1764  (
1765  XMLResourceIdentifier* resourceIdentifier
1766  );
1767 
1779  virtual void startInputSource(const InputSource& inputSource);
1781 
1782 
1783  // -----------------------------------------------------------------------
1784  // Implementation of the Deprecated DocTypeHandler Interface
1785  // -----------------------------------------------------------------------
1802  virtual void attDef
1803  (
1804  const DTDElementDecl& elemDecl
1805  , const DTDAttDef& attDef
1806  , const bool ignore
1807  );
1808 
1818  virtual void doctypeComment
1819  (
1820  const XMLCh* const comment
1821  );
1822 
1841  virtual void doctypeDecl
1842  (
1843  const DTDElementDecl& elemDecl
1844  , const XMLCh* const publicId
1845  , const XMLCh* const systemId
1846  , const bool hasIntSubset
1847  , const bool hasExtSubset = false
1848  );
1849 
1863  virtual void doctypePI
1864  (
1865  const XMLCh* const target
1866  , const XMLCh* const data
1867  );
1868 
1880  virtual void doctypeWhitespace
1881  (
1882  const XMLCh* const chars
1883  , const XMLSize_t length
1884  );
1885 
1898  virtual void elementDecl
1899  (
1900  const DTDElementDecl& decl
1901  , const bool isIgnored
1902  );
1903 
1914  virtual void endAttList
1915  (
1916  const DTDElementDecl& elemDecl
1917  );
1918 
1925  virtual void endIntSubset();
1926 
1933  virtual void endExtSubset();
1934 
1949  virtual void entityDecl
1950  (
1951  const DTDEntityDecl& entityDecl
1952  , const bool isPEDecl
1953  , const bool isIgnored
1954  );
1955 
1960  virtual void resetDocType();
1961 
1974  virtual void notationDecl
1975  (
1976  const XMLNotationDecl& notDecl
1977  , const bool isIgnored
1978  );
1979 
1990  virtual void startAttList
1991  (
1992  const DTDElementDecl& elemDecl
1993  );
1994 
2001  virtual void startIntSubset();
2002 
2009  virtual void startExtSubset();
2010 
2023  virtual void TextDecl
2024  (
2025  const XMLCh* const versionStr
2026  , const XMLCh* const encodingStr
2027  );
2029 
2030 protected :
2031  // -----------------------------------------------------------------------
2032  // Protected Methods
2033  // -----------------------------------------------------------------------
2040  const XMLScanner& getScanner() const;
2041 
2046  GrammarResolver* getGrammarResolver() const;
2047 
2048 
2049 private:
2050  // -----------------------------------------------------------------------
2051  // Unimplemented constructors and operators
2052  // -----------------------------------------------------------------------
2053  SAXParser(const SAXParser&);
2054  SAXParser& operator=(const SAXParser&);
2055 
2056  // -----------------------------------------------------------------------
2057  // Initialize/Cleanup methods
2058  // -----------------------------------------------------------------------
2059  void initialize();
2060  void cleanUp();
2061  void resetInProgress();
2062 
2063  // -----------------------------------------------------------------------
2064  // Private data members
2065  //
2066  // fAttrList
2067  // A temporary implementation of the basic SAX attribute list
2068  // interface. We use this one over and over on each startElement
2069  // event to allow SAX-like access to the element attributes.
2070  //
2071  // fDocHandler
2072  // The installed SAX doc handler, if any. Null if none.
2073  //
2074  // fDTDHandler
2075  // The installed SAX DTD handler, if any. Null if none.
2076  //
2077  // fElemDepth
2078  // This is used to track the element nesting depth, so that we can
2079  // know when we are inside content. This is so we can ignore char
2080  // data outside of content.
2081  //
2082  // fEntityResolver
2083  // The installed SAX entity handler, if any. Null if none.
2084  //
2085  // fErrorHandler
2086  // The installed SAX error handler, if any. Null if none.
2087  //
2088  // fPSVIHandler
2089  // The installed PSVI handler, if any. Null if none.
2090  //
2091  // fAdvDHCount
2092  // fAdvDHList
2093  // fAdvDHListSize
2094  // This is an array of pointers to XMLDocumentHandlers, which is
2095  // how we see installed advanced document handlers. There will
2096  // usually not be very many at all, so a simple array is used
2097  // instead of a collection, for performance. It will grow if needed,
2098  // but that is unlikely.
2099  //
2100  // The count is how many handlers are currently installed. The size
2101  // is how big the array itself is (for expansion purposes.) When
2102  // count == size, is time to expand.
2103  //
2104  // fParseInProgress
2105  // This flag is set once a parse starts. It is used to prevent
2106  // multiple entrance or reentrance of the parser.
2107  //
2108  // fScanner
2109  // The scanner being used by this parser. It is created internally
2110  // during construction.
2111  //
2112  // fGrammarPool
2113  // The grammar pool passed from external application (through derivatives).
2114  // which could be 0, not owned.
2115  //
2116  // -----------------------------------------------------------------------
2117  bool fParseInProgress;
2118  XMLSize_t fElemDepth;
2119  XMLSize_t fAdvDHCount;
2120  XMLSize_t fAdvDHListSize;
2121  VecAttrListImpl fAttrList;
2122  DocumentHandler* fDocHandler;
2123  DTDHandler* fDTDHandler;
2124  EntityResolver* fEntityResolver;
2125  XMLEntityResolver* fXMLEntityResolver;
2126  ErrorHandler* fErrorHandler;
2127  PSVIHandler* fPSVIHandler;
2128  XMLDocumentHandler** fAdvDHList;
2129  XMLScanner* fScanner;
2130  GrammarResolver* fGrammarResolver;
2131  XMLStringPool* fURIStringPool;
2132  XMLValidator* fValidator;
2133  MemoryManager* fMemoryManager;
2134  XMLGrammarPool* fGrammarPool;
2135  XMLBuffer fElemQNameBuf;
2136 };
2137 
2138 
2139 // ---------------------------------------------------------------------------
2140 // SAXParser: Getter methods
2141 // ---------------------------------------------------------------------------
2143 {
2144  return fDocHandler;
2145 }
2146 
2148 {
2149  return fDocHandler;
2150 }
2151 
2153 {
2154  return fEntityResolver;
2155 }
2156 
2158 {
2159  return fXMLEntityResolver;
2160 }
2161 
2163 {
2164  return fXMLEntityResolver;
2165 }
2166 
2168 {
2169  return fEntityResolver;
2170 }
2171 
2173 {
2174  return fErrorHandler;
2175 }
2176 
2178 {
2179  return fErrorHandler;
2180 }
2181 
2183 {
2184  return fPSVIHandler;
2185 }
2186 
2188 {
2189  return fPSVIHandler;
2190 }
2191 
2192 inline const XMLScanner& SAXParser::getScanner() const
2193 {
2194  return *fScanner;
2195 }
2196 
2197 inline GrammarResolver* SAXParser::getGrammarResolver() const
2198 {
2199  return fGrammarResolver;
2200 }
2201 
2203 
2204 #endif
#define PARSERS_EXPORT
Definition: XercesDefs.hpp:168
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
char16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
XMLUInt64 XMLFilePos
Definition: Xerces_autoconf_config.hpp:139
XMLUInt64 XMLFileLoc
Definition: Xerces_autoconf_config.hpp:144
Receive notification of basic DTD-related events.
Definition: DTDHandler.hpp:60
Receive notification of general document events.
Definition: DocumentHandler.hpp:61
Basic interface for resolving entities.
Definition: EntityResolver.hpp:87
Basic interface for SAX error handlers.
Definition: ErrorHandler.hpp:61
A single input source for an XML entity.
Definition: InputSource.hpp:63
Configurable memory manager.
Definition: MemoryManager.hpp:40
This abstract class provides the interface for the scanner to return PSVI information to the applicat...
Definition: PSVIHandler.hpp:39
Basic interface for SAX (Simple API for XML) parsers.
Definition: Parser.hpp:61
This class implements the SAX 'Parser' interface and should be used by applications wishing to parse ...
Definition: SAXParser.hpp:77
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.
virtual void docPI(const XMLCh *const target, const XMLCh *const data)
This method is used to report any PI scanned by the parser.
void setSecurityManager(SecurityManager *const securityManager)
This allows an application to set a SecurityManager on the parser; this object stores information tha...
virtual void elementDecl(const DTDElementDecl &decl, const bool isIgnored)
This method is used to report an element declarations successfully scanned by the parser.
const XMLCh * getURIText(unsigned int uriId) const
Returns the string corresponding to a URI id from the URI string pool.
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.
void parseReset(XMLPScanToken &token)
Reset the parser after a progressive parse.
bool getIgnoreAnnotations() const
Get the 'ignore annotations' 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.
void setSkipDTDValidation(const bool newValue)
Set the 'skip DTD validation' flag.
bool isUsingCachedGrammarInParse() const
Get the 'Use cached grammar' flag.
XMLEntityResolver * getXMLEntityResolver()
This method returns the installed entity resolver.
Definition: SAXParser.hpp:2157
virtual void setPSVIHandler(PSVIHandler *const handler)
This method installs the user specified PSVI handler on the parser.
void setExternalSchemaLocation(const XMLCh *const schemaLocation)
This method allows the user to specify a list of schemas to use.
void useScanner(const XMLCh *const scannerName)
Set the scanner to use when scanning the XML document.
virtual void endEntityReference(const XMLEntityDecl &entDecl)
This method is used to indicate that an end of an entity reference was just scanned.
bool getValidationConstraintFatal() const
This method returns the state of the parser's validation-constraint-fatal flag.
void setIgnoreCachedDTD(const bool newValue)
Set the 'ignore cached DTD grammar' flag.
void setIdentityConstraintChecking(const bool identityConstraintChecking)
This method allows the user to turn identity constraint checking on/off.
void setExternalSchemaLocation(const char *const schemaLocation)
This method is same as setExternalSchemaLocation(const XMLCh* const).
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.
virtual void attDef(const DTDElementDecl &elemDecl, const DTDAttDef &attDef, const bool ignore)
This method is used to report an attribute definition.
const XMLValidator & getValidator() const
This method returns a reference to the parser's installed validator.
Grammar * getGrammar(const XMLCh *const nameSpaceKey)
Retrieve the grammar that is associated with the specified namespace key.
virtual void startInputSource(const InputSource &inputSource)
This method is used to indicate the start of parsing an external entity file.
XMLCh * getExternalSchemaLocation() const
Get the set of Namespace/SchemaLocation that is specified externally.
void setExternalNoNamespaceSchemaLocation(const char *const noNamespaceSchemaLocation)
This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).
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.
void setLowWaterMark(XMLSize_t lwm)
Set the raw buffer low water mark for this parser.
bool getLoadSchema() const
Get the 'Loading Schema' flag.
virtual void doctypeComment(const XMLCh *const comment)
This method is used to report a comment occurring within the DTD.
XMLFilePos getSrcOffset() const
Returns the current src offset within the input source.
virtual void startExtSubset()
This method is used indicate the start of the external subset.
bool getGenerateSyntheticAnnotations() const
Get the 'generate synthetic annotations' flag.
bool parseFirst(const InputSource &source, XMLPScanToken &toFill)
Begin a progressive parse operation.
bool getStandardUriConformant() const
Get the 'force standard uri flag'.
bool getLoadExternalDTD() const
Get the 'Loading External DTD' flag.
virtual void resetDocType()
This method allows the user installed DTD handler to reset itself.
SecurityManager * getSecurityManager() const
Get the SecurityManager instance attached to this parser.
void setCalculateSrcOfs(const bool newState)
Enable/disable src offset calculation.
void setHandleMultipleImports(const bool newValue)
Set the 'handle multiple schema imports' flag.
bool isCachingGrammarFromParse() const
Get the 'Grammar caching' 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...
XMLCh * getExternalNoNamespaceSchemaLocation() const
Get the noNamespace SchemaLocation that is specified externally.
virtual void setErrorHandler(ErrorHandler *const handler)
This method installs the user specified error handler on the parser.
bool getDisableDefaultEntityResolution() const
Get the 'disable default entity resolution' flag.
virtual void startAttList(const DTDElementDecl &elemDecl)
This method is used to indicate the start of an element's attribute list declaration.
void setDisableDefaultEntityResolution(const bool newValue)
Set the 'disable default entity resolution' flag.
virtual void setEntityResolver(EntityResolver *const resolver)
This method installs the user specified entity resolver on the parser.
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.
~SAXParser()
Destructor.
DocumentHandler * getDocumentHandler()
This method returns the installed document handler.
Definition: SAXParser.hpp:2142
virtual void resetErrors()
This method allows the user installed Error Handler callback to 'reset' itself.
bool getDoSchema() const
Get the 'do schema' flag.
virtual void endExtSubset()
This method is used to report the end of the external subset.
void cacheGrammarFromParse(const bool newState)
Set the 'Grammar caching' flag.
virtual void notationDecl(const XMLNotationDecl &notDecl, const bool isIgnored)
This method is used to report any notation declarations.
ValSchemes
ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors.
Definition: SAXParser.hpp:91
bool getIgnoreCachedDTD() const
Get the 'ignore cached DTD grammar' flag.
void setValidationSchemaFullChecking(const bool schemaFullChecking)
This method allows the user to turn full Schema constraint checking on/off.
int getErrorCount() const
Get error count from the last parse operation.
virtual void parse(const char *const systemId)
This method invokes the parsing process on the XML file specified by the native char* string paramete...
const XMLScanner & getScanner() const
This method returns a reference to the underlying scanner object.
Definition: SAXParser.hpp:2192
virtual void setDTDHandler(DTDHandler *const handler)
This method installs the user specified DTD handler on the parser.
virtual void resetDocument()
This method allows the user installed Document Handler and any advanced callback handlers to 'reset' ...
void setDoNamespaces(const bool newState)
This method allows users to enable or disable the parser's namespace processing.
bool getIdentityConstraintChecking() const
Get the 'identity constraint checking' flag.
void setValidationScheme(const ValSchemes newScheme)
This method allows users to set the validation scheme to be used by this parser.
void setExitOnFirstFatalError(const bool newState)
This method allows users to set the parser's behaviour when it encounters the first fatal error.
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.
bool getHandleMultipleImports() const
Get the 'handle multiple schema imports' flag.
bool parseFirst(const char *const systemId, XMLPScanToken &toFill)
Begin a progressive parse operation.
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.
virtual void endAttList(const DTDElementDecl &elemDecl)
This method is used to report the end of an attribute list declaration for an element.
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.
void setLoadSchema(const bool newState)
Set the 'Loading Schema' flag.
virtual void endIntSubset()
This method is used to report the end of the internal subset.
bool getCalculateSrcOfs() const
Get the 'calculate src offset flag'.
void setGenerateSyntheticAnnotations(const bool newValue)
set the 'generate synthetic annotations' flag
virtual void startEntityReference(const XMLEntityDecl &entDecl)
This method is used to indicate the start of an entity reference.
bool getValidationSchemaFullChecking() const
Get the 'full schema constraint checking' flag.
virtual InputSource * resolveEntity(XMLResourceIdentifier *resourceIdentifier)
Resolve a public/system id.
EntityResolver * getEntityResolver()
This method returns the installed entity resolver.
Definition: SAXParser.hpp:2152
virtual void resetEntities()
This method allows the installed XMLEntityHandler to reset itself.
void installAdvDocHandler(XMLDocumentHandler *const toInstall)
This method installs the specified 'advanced' document callback handler, thereby allowing the user to...
void setStandardUriConformant(const bool newState)
Force standard uri.
bool getValidateAnnotations() const
Get the 'validate annotations' flag.
void setValidationConstraintFatal(const bool newState)
This method allows users to set the parser's behaviour when it encounters a validation constraint err...
bool getDoNamespaces() const
This method returns the state of the parser's namespace handling capability.
void resetCachedGrammarPool()
This method allows the user to reset the pool of cached grammars.
bool parseFirst(const XMLCh *const systemId, XMLPScanToken &toFill)
Begin a progressive parse operation.
void useCachedGrammarInParse(const bool newState)
Set the 'Use cached grammar' flag.
ErrorHandler * getErrorHandler()
This method returns the installed error handler.
Definition: SAXParser.hpp:2172
GrammarResolver * getGrammarResolver() const
Get the Grammar resolver.
Definition: SAXParser.hpp:2197
void setExternalNoNamespaceSchemaLocation(const XMLCh *const noNamespaceSchemaLocation)
This method allows the user to specify the no target namespace XML Schema Location externally.
ValSchemes getValidationScheme() const
This method returns an enumerated value that indicates the current validation scheme set on this pars...
void setInputBufferSize(const XMLSize_t bufferSize)
Set maximum input buffer size.
virtual void endDocument()
This method is used to indicate the end of root element was just scanned by the parser.
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...
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.
virtual void endInputSource(const InputSource &inputSource)
This method is used to indicate the end of parsing of an external entity file.
bool removeAdvDocHandler(XMLDocumentHandler *const toRemove)
This method removes the 'advanced' document handler callback from the underlying parser scanner.
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 parse(const InputSource &source)
This method invokes the parsing process on the XML file specified by the InputSource parameter.
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.
PSVIHandler * getPSVIHandler()
This method returns the installed PSVI handler.
Definition: SAXParser.hpp:2182
virtual void startIntSubset()
This method is used indicate the start of the internal subset.
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.
void setValidateAnnotations(const bool newValue)
set the 'validate annotations' flag
virtual void TextDecl(const XMLCh *const versionStr, const XMLCh *const encodingStr)
This method is used to report the TextDecl.
XMLSize_t getLowWaterMark() const
Get the raw buffer low water mark for this parser.
virtual void docComment(const XMLCh *const comment)
This method is used to report any comments scanned by the parser.
virtual void setXMLEntityResolver(XMLEntityResolver *const resolver)
This method installs the user specified entity resolver on the parser.
void setIgnoreAnnotations(const bool newValue)
Set the 'ignore annotation' flag.
bool getSkipDTDValidation() const
Get the 'skip DTD validation' flag.
void setLoadExternalDTD(const bool newState)
Set the 'Loading External DTD' flag.
virtual void entityDecl(const DTDEntityDecl &entityDecl, const bool isPEDecl, const bool isIgnored)
This method is used to report any entity declarations.
virtual void setDocumentHandler(DocumentHandler *const handler)
This method installs the user specified SAX Document Handler callback function on parser.
Grammar * getRootGrammar()
Retrieve the grammar where the root element is declared.
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'.
void setDoSchema(const bool newState)
Set the 'schema support' flag.
bool parseNext(XMLPScanToken &token)
Continue a progressive parse operation.
Allow application to force the parser to behave in a security-conscious way.
Definition: SecurityManager.hpp:52
This abstract class provides the interface for the scanner to return XML document information up to t...
Definition: XMLDocumentHandler.hpp:43
This class defines the core information of an element declaration.
Definition: XMLElementDecl.hpp:52
This class defines that core information that defines an XML entity, no matter what validator is used...
Definition: XMLEntityDecl.hpp:51
This abstract class is a callback mechanism for the scanner.
Definition: XMLEntityHandler.hpp:44
Revised interface for resolving entities.
Definition: XMLEntityResolver.hpp:100
This abstract class defines a callback mechanism for the scanner.
Definition: XMLErrorReporter.hpp:43
ErrTypes
Definition: XMLErrorReporter.hpp:49
Definition: XMLGrammarPool.hpp:44
This class represents the core information about a notation declaration that all validators must at l...
Definition: XMLNotationDecl.hpp:42
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
Definition: XMLResourceIdentifier.hpp:96
This abstract class provides the interface for all validators.
Definition: XMLValidator.hpp:53
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41