Xerces-C++: SAXParser.hpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22#if !defined(XERCESC_INCLUDE_GUARD_SAXPARSER_HPP)

23#define XERCESC_INCLUDE_GUARD_SAXPARSER_HPP

24

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

42class XMLPScanToken;

43class XMLScanner;

45class GrammarResolver;

50

70

76 , public DocTypeHandler

77{

78public :

79

80

81

91 {

92 Val_Never

93 , Val_Always

94 , Val_Auto

96

97

98

99

100

112 (

116 );

117

123

124

125

126

127

137

145

153

161

169

177

185

193

201

208 const PSVIHandler* getPSVIHandler() const;

209

217

226

238

250

262

274

285

296

308

329

350

367

382

396

410

423

435

447

460

472

480

487

495

503

516

525

534

543

552

561

571

572

573

574

575

576

590

599

614

632

649

667

680

697

718

740

750

766

776

793

808

825

844

861

880

900

914

926

935

947

963

974

990

1004

1018

1019

1020

1021

1022

1023

1042

1056

1057

1058

1059

1060

1061

1064

1093 (

1094 const XMLCh* const systemId

1095 , XMLPScanToken& toFill

1096 );

1097

1126 (

1127 const char* const systemId

1128 , XMLPScanToken& toFill

1129 );

1130

1159 (

1161 , XMLPScanToken& toFill

1162 );

1163

1189

1212

1214

1215

1216

1217

1218

1248 const Grammar::GrammarType grammarType,

1249 const bool toCache = false);

1250

1276 const Grammar::GrammarType grammarType,

1277 const bool toCache = false);

1278

1303 const Grammar::GrammarType grammarType,

1304 const bool toCache = false);

1305

1310

1312

1313

1314

1315

1316

1317

1330

1341

1349 virtual void parse(const char* const systemId);

1350

1362

1373

1385

1397

1414

1431

1433

1434

1435

1436

1437

1438

1457 (

1458 const XMLCh* const chars

1460 , const bool cdataSection

1461 );

1462

1473 (

1474 const XMLCh* const comment

1475 );

1476

1497 (

1498 const XMLCh* const target

1499 , const XMLCh* const data

1500 );

1501

1514

1535 (

1537 , const unsigned int urlId

1538 , const bool isRoot

1539 , const XMLCh* const elemPrefix

1540 );

1541

1553 (

1555 );

1556

1577 (

1578 const XMLCh* const chars

1580 , const bool cdataSection

1581 );

1582

1588

1600

1628 (

1630 , const unsigned int urlId

1631 , const XMLCh* const elemPrefix

1632 , const RefVectorOf& attrList

1634 , const bool isEmpty

1635 , const bool isRoot

1636 );

1637

1648 (

1650 );

1651

1670 (

1671 const XMLCh* const versionStr

1672 , const XMLCh* const encodingStr

1673 , const XMLCh* const standaloneStr

1674 , const XMLCh* const actualEncodingStr

1675 );

1677

1678

1679

1680

1681

1682

1709 (

1710 const unsigned int errCode

1711 , const XMLCh* const msgDomain

1713 , const XMLCh* const errorText

1714 , const XMLCh* const systemId

1715 , const XMLCh* const publicId

1718 );

1719

1730

1731

1732

1733

1734

1735

1750

1766 (

1767 const XMLCh* const systemId

1768 , XMLBuffer& toFill

1769 );

1770

1779

1797 (

1799 );

1800

1814

1815

1816

1817

1818

1836 (

1837 const DTDElementDecl& elemDecl

1838 , const DTDAttDef& attDef

1839 , const bool ignore

1840 );

1841

1852 (

1853 const XMLCh* const comment

1854 );

1855

1875 (

1876 const DTDElementDecl& elemDecl

1877 , const XMLCh* const publicId

1878 , const XMLCh* const systemId

1879 , const bool hasIntSubset

1880 , const bool hasExtSubset = false

1881 );

1882

1897 (

1898 const XMLCh* const target

1899 , const XMLCh* const data

1900 );

1901

1914 (

1915 const XMLCh* const chars

1917 );

1918

1932 (

1933 const DTDElementDecl& decl

1934 , const bool isIgnored

1935 );

1936

1948 (

1949 const DTDElementDecl& elemDecl

1950 );

1951

1959

1967

1983 (

1984 const DTDEntityDecl& entityDecl

1985 , const bool isPEDecl

1986 , const bool isIgnored

1987 );

1988

1994

2008 (

2010 , const bool isIgnored

2011 );

2012

2024 (

2025 const DTDElementDecl& elemDecl

2026 );

2027

2035

2043

2057 (

2058 const XMLCh* const versionStr

2059 , const XMLCh* const encodingStr

2060 );

2062

2063protected :

2064

2065

2066

2073 const XMLScanner& getScanner() const;

2074

2079 GrammarResolver* getGrammarResolver() const;

2080

2081

2082private:

2083

2084

2085

2088

2089

2090

2091

2092 void initialize();

2093 void cleanUp();

2094 void resetInProgress();

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2126

2127

2128

2129

2130

2131

2132

2133

2134

2135

2136

2137

2138

2139

2140

2141

2142

2143

2144

2145

2146

2147

2148

2149

2150 bool fParseInProgress;

2154 VecAttrListImpl fAttrList;

2162 XMLScanner* fScanner;

2163 GrammarResolver* fGrammarResolver;

2164 XMLStringPool* fURIStringPool;

2168 XMLBuffer fElemQNameBuf;

2169};

2170

2171

2172

2173

2174

2176{

2177 return fDocHandler;

2178}

2179

2181{

2182 return fDocHandler;

2183}

2184

2186{

2187 return fEntityResolver;

2188}

2189

2191{

2192 return fXMLEntityResolver;

2193}

2194

2196{

2197 return fXMLEntityResolver;

2198}

2199

2201{

2202 return fEntityResolver;

2203}

2204

2206{

2207 return fErrorHandler;

2208}

2209

2211{

2212 return fErrorHandler;

2213}

2214

2216{

2217 return fPSVIHandler;

2218}

2219

2221{

2222 return fPSVIHandler;

2223}

2224

2226{

2227 return *fScanner;

2228}

2229

2231{

2232 return fGrammarResolver;

2233}

2234

2236

2237#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

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.

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:2190

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.

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.

bool getDisallowDoctype() const

Get the 'Disallow DOCTYPE (DTD)' flag.

virtual void startInputSource(const InputSource &inputSource)

This method is used to indicate the start of parsing an external entity file.

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.

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 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.

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...

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.

const XMLValidator & getValidator() const

This method returns a reference to the parser's installed validator.

virtual void setEntityResolver(EntityResolver *const resolver)

This method installs the user specified entity resolver on the parser.

XMLCh * getExternalSchemaLocation() const

Get the set of Namespace/SchemaLocation that is specified externally.

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.

DocumentHandler * getDocumentHandler()

This method returns the installed document handler.

Definition SAXParser.hpp:2175

void setDisallowDoctype(const bool newState)

Set the 'Disallow DOCTYPE (DTD)' flag.

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:2225

XMLCh * getExternalNoNamespaceSchemaLocation() const

Get the noNamespace SchemaLocation that is specified externally.

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.

EntityResolver * getEntityResolver()

This method returns the installed entity resolver.

Definition SAXParser.hpp:2185

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.

SecurityManager * getSecurityManager() const

Get the SecurityManager instance attached to this parser.

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:2205

GrammarResolver * getGrammarResolver() const

Get the Grammar resolver.

Definition SAXParser.hpp:2230

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...

virtual void endInputSource(const InputSource &inputSource)

This method is used to indicate the end of parsing of an external entity file.

virtual InputSource * resolveEntity(XMLResourceIdentifier *resourceIdentifier)

Resolve a public/system id.

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.

PSVIHandler * getPSVIHandler()

This method returns the installed PSVI handler.

Definition SAXParser.hpp:2215

virtual void startIntSubset()

This method is used indicate the start of the internal subset.

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.

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.

Grammar * getGrammar(const XMLCh *const nameSpaceKey)

Retrieve the grammar that is associated with the specified namespace key.

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.

const XMLCh * getURIText(unsigned int uriId) const

Returns the string corresponding to a URI id from the URI string pool.

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