SAXParser Class Reference

This class implements the SAX 'Parser' interface and should be used by applications wishing to parse the XML files using SAX. More...

`#include <xercesc/parsers/SAXParser.hpp>`

Inheritance diagram for SAXParser:

## Public Types

enum | ValSchemes { Val_Never , Val_Always , Val_Auto }
| ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors. More...
Public Types inherited from XMLErrorReporter
enum | ErrTypes { ErrType_Warning , ErrType_Error , ErrType_Fatal , ErrTypes_Unknown }

## Public Member Functions

Constructors and Destructor
| 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. More...
| ~SAXParser ()
| Destructor. More...
Getter methods
DocumentHandler * | getDocumentHandler ()
| This method returns the installed document handler. More...
const DocumentHandler * | getDocumentHandler () const
| This method returns the installed document handler. More...
EntityResolver * | getEntityResolver ()
| This method returns the installed entity resolver. More...
const EntityResolver * | getEntityResolver () const
| This method returns the installed entity resolver. More...
XMLEntityResolver * | getXMLEntityResolver ()
| This method returns the installed entity resolver. More...
const XMLEntityResolver * | getXMLEntityResolver () const
| This method returns the installed entity resolver. More...
ErrorHandler * | getErrorHandler ()
| This method returns the installed error handler. More...
const ErrorHandler * | getErrorHandler () const
| This method returns the installed error handler. More...
PSVIHandler * | getPSVIHandler ()
| This method returns the installed PSVI handler. More...
const PSVIHandler * | getPSVIHandler () const
| This method returns the installed PSVI handler. More...
const XMLValidator & | getValidator () const
| This method returns a reference to the parser's installed validator. More...
ValSchemes | getValidationScheme () const
| This method returns an enumerated value that indicates the current validation scheme set on this parser. More...
bool | getDoSchema () const
| Get the 'do schema' flag. More...
bool | getValidationSchemaFullChecking () const
| Get the 'full schema constraint checking' flag. More...
bool | getIdentityConstraintChecking () const
| Get the 'identity constraint checking' flag. More...
int | getErrorCount () const
| Get error count from the last parse operation. More...
bool | getDoNamespaces () const
| This method returns the state of the parser's namespace handling capability. More...
bool | getExitOnFirstFatalError () const
| This method returns the state of the parser's exit-on-First-Fatal-Error flag. More...
bool | getValidationConstraintFatal () const
| This method returns the state of the parser's validation-constraint-fatal flag. More...
XMLCh * | getExternalSchemaLocation () const
| Get the set of Namespace/SchemaLocation that is specified externally. More...
XMLCh * | getExternalNoNamespaceSchemaLocation () const
| Get the noNamespace SchemaLocation that is specified externally. More...
SecurityManager * | getSecurityManager () const
| Get the SecurityManager instance attached to this parser. More...
XMLSize_t | getLowWaterMark () const
| Get the raw buffer low water mark for this parser. More...
bool | getLoadExternalDTD () const
| Get the 'Loading External DTD' flag. More...
bool | getLoadSchema () const
| Get the 'Loading Schema' flag. More...
bool | isCachingGrammarFromParse () const
| Get the 'Grammar caching' flag. More...
bool | isUsingCachedGrammarInParse () const
| Get the 'Use cached grammar' flag. More...
bool | getCalculateSrcOfs () const
| Get the 'calculate src offset flag'. More...
bool | getStandardUriConformant () const
| Get the 'force standard uri flag'. More...
Grammar * | getGrammar (const XMLCh *const nameSpaceKey)
| Retrieve the grammar that is associated with the specified namespace key. More...
Grammar * | getRootGrammar ()
| Retrieve the grammar where the root element is declared. More...
const XMLCh * | getURIText (unsigned int uriId) const
| Returns the string corresponding to a URI id from the URI string pool. More...
XMLFilePos | getSrcOffset () const
| Returns the current src offset within the input source. More...
bool | getGenerateSyntheticAnnotations () const
| Get the 'generate synthetic annotations' flag. More...
bool | getValidateAnnotations () const
| Get the 'validate annotations' flag. More...
bool | getIgnoreCachedDTD () const
| Get the 'ignore cached DTD grammar' flag. More...
bool | getIgnoreAnnotations () const
| Get the 'ignore annotations' flag. More...
bool | getDisableDefaultEntityResolution () const
| Get the 'disable default entity resolution' flag. More...
bool | getSkipDTDValidation () const
| Get the 'skip DTD validation' flag. More...
bool | getHandleMultipleImports () const
| Get the 'handle multiple schema imports' flag. More...
Setter methods
void | setGenerateSyntheticAnnotations (const bool newValue)
| set the 'generate synthetic annotations' flag More...
void | setValidateAnnotations (const bool newValue)
| set the 'validate annotations' flag More...
void | setDoNamespaces (const bool newState)
| This method allows users to enable or disable the parser's namespace processing. More...
void | setValidationScheme (const ValSchemes newScheme)
| This method allows users to set the validation scheme to be used by this parser. More...
void | setDoSchema (const bool newState)
| Set the 'schema support' flag. More...
void | setValidationSchemaFullChecking (const bool schemaFullChecking)
| This method allows the user to turn full Schema constraint checking on/off. More...
void | setIdentityConstraintChecking (const bool identityConstraintChecking)
| This method allows the user to turn identity constraint checking on/off. More...
void | setExitOnFirstFatalError (const bool newState)
| This method allows users to set the parser's behaviour when it encounters the first fatal error. More...
void | setValidationConstraintFatal (const bool newState)
| This method allows users to set the parser's behaviour when it encounters a validation constraint error. More...
void | setExternalSchemaLocation (const XMLCh *const schemaLocation)
| This method allows the user to specify a list of schemas to use. More...
void | setExternalSchemaLocation (const char *const schemaLocation)
| This method is same as setExternalSchemaLocation(const XMLCh* const). More...
void | setExternalNoNamespaceSchemaLocation (const XMLCh *const noNamespaceSchemaLocation)
| This method allows the user to specify the no target namespace XML Schema Location externally. More...
void | setExternalNoNamespaceSchemaLocation (const char *const noNamespaceSchemaLocation)
| This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const). More...
void | setSecurityManager (SecurityManager *const securityManager)
| This allows an application to set a SecurityManager on the parser; this object stores information that various components use to limit their consumption of system resources while processing documents. More...
void | setLowWaterMark (XMLSize_t lwm)
| Set the raw buffer low water mark for this parser. More...
void | setLoadExternalDTD (const bool newState)
| Set the 'Loading External DTD' flag. More...
void | setLoadSchema (const bool newState)
| Set the 'Loading Schema' flag. More...
void | cacheGrammarFromParse (const bool newState)
| Set the 'Grammar caching' flag. More...
void | useCachedGrammarInParse (const bool newState)
| Set the 'Use cached grammar' flag. More...
void | setCalculateSrcOfs (const bool newState)
| Enable/disable src offset calculation. More...
void | setStandardUriConformant (const bool newState)
| Force standard uri. More...
void | useScanner (const XMLCh *const scannerName)
| Set the scanner to use when scanning the XML document. More...
void | setInputBufferSize (const XMLSize_t bufferSize)
| Set maximum input buffer size. More...
void | setIgnoreCachedDTD (const bool newValue)
| Set the 'ignore cached DTD grammar' flag. More...
void | setIgnoreAnnotations (const bool newValue)
| Set the 'ignore annotation' flag. More...
void | setDisableDefaultEntityResolution (const bool newValue)
| Set the 'disable default entity resolution' flag. More...
void | setSkipDTDValidation (const bool newValue)
| Set the 'skip DTD validation' flag. More...
void | setHandleMultipleImports (const bool newValue)
| Set the 'handle multiple schema imports' flag. More...
Advanced document handler list maintenance methods
void | installAdvDocHandler (XMLDocumentHandler *const toInstall)
| This method installs the specified 'advanced' document callback handler, thereby allowing the user to customize the processing, if they choose to do so. More...
bool | removeAdvDocHandler (XMLDocumentHandler *const toRemove)
| This method removes the 'advanced' document handler callback from the underlying parser scanner. More...
Progressive scan methods
bool | parseFirst (const XMLCh *const systemId, XMLPScanToken &toFill)
| Begin a progressive parse operation. More...
bool | parseFirst (const char *const systemId, XMLPScanToken &toFill)
| Begin a progressive parse operation. More...
bool | parseFirst (const InputSource &source, XMLPScanToken &toFill)
| Begin a progressive parse operation. More...
bool | parseNext (XMLPScanToken &token)
| Continue a progressive parse operation. More...
void | parseReset (XMLPScanToken &token)
| Reset the parser after a progressive parse. More...
Implementation of Grammar preparsing interface's.
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. More...
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. More...
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. More...
void | resetCachedGrammarPool ()
| This method allows the user to reset the pool of cached grammars. More...
Implementation of SAX 1.0 Parser interface's.
virtual void | parse (const InputSource &source)
| This method invokes the parsing process on the XML file specified by the InputSource parameter. More...
virtual void | parse (const XMLCh *const systemId)
| This method invokes the parsing process on the XML file specified by the Unicode string parameter 'systemId'. More...
virtual void | parse (const char *const systemId)
| This method invokes the parsing process on the XML file specified by the native char* string parameter 'systemId'. More...
virtual void | setDocumentHandler (DocumentHandler *const handler)
| This method installs the user specified SAX Document Handler callback function on parser. More...
virtual void | setDTDHandler (DTDHandler *const handler)
| This method installs the user specified DTD handler on the parser. More...
virtual void | setErrorHandler (ErrorHandler *const handler)
| This method installs the user specified error handler on the parser. More...
virtual void | setPSVIHandler (PSVIHandler *const handler)
| This method installs the user specified PSVI handler on the parser. More...
virtual void | setEntityResolver (EntityResolver *const resolver)
| This method installs the user specified entity resolver on the parser. More...
virtual void | setXMLEntityResolver (XMLEntityResolver *const resolver)
| This method installs the user specified entity resolver on the parser. More...
Implementation of the XMLDocumentHandler Interface.
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. More...
virtual void | docComment (const XMLCh *const comment)
| This method is used to report any comments scanned by the parser. More...
virtual void | docPI (const XMLCh *const target, const XMLCh *const data)
| This method is used to report any PI scanned by the parser. More...
virtual void | endDocument ()
| This method is used to indicate the end of root element was just scanned by the parser. More...
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. More...
virtual void | endEntityReference (const XMLEntityDecl &entDecl)
| This method is used to indicate that an end of an entity reference was just scanned. More...
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'. More...
virtual void | resetDocument ()
| This method allows the user installed Document Handler and any advanced callback handlers to 'reset' themselves. More...
virtual void | startDocument ()
| This method is used to report the start of the parsing process. More...
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. More...
virtual void | startEntityReference (const XMLEntityDecl &entDecl)
| This method is used to indicate the start of an entity reference. More...
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. More...
Implementation of the XMLErrorReporter Interface.
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. More...
virtual void | resetErrors ()
| This method allows the user installed Error Handler callback to 'reset' itself. More...
Implementation of the XMLEntityHandler Interface.
virtual void | endInputSource (const InputSource &inputSource)
| This method is used to indicate the end of parsing of an external entity file. More...
virtual bool | expandSystemId (const XMLCh *const systemId, XMLBuffer &toFill)
| This method allows an installed XMLEntityHandler to further process any system id's of external entities encountered in the XML file being parsed, such as redirection etc. More...
virtual void | resetEntities ()
| This method allows the installed XMLEntityHandler to reset itself. More...
virtual InputSource * | resolveEntity (XMLResourceIdentifier *resourceIdentifier)
| Resolve a public/system id. More...
virtual void | startInputSource (const InputSource &inputSource)
| This method is used to indicate the start of parsing an external entity file. More...
Public Member Functions inherited from XMemory
void * | operator new (size_t size)
| This method overrides operator new. More...
void * | operator new (size_t size, MemoryManager *memMgr)
| This method defines a custom operator new, that will use the provided memory manager to perform the allocation. More...
void * | operator new (size_t size, void *ptr)
| This method overrides placement operator new. More...
void | operator delete (void *p)
| This method overrides operator delete. More...
void | operator delete (void *p, MemoryManager *memMgr)
| This method provides a matching delete for the custom operator new. More...
void | operator delete (void *p, void *ptr)
| This method provides a matching delete for the placement new. More...
Public Member Functions inherited from Parser
| Parser ()
| The default constructor. More...
virtual | ~Parser ()
| The destructor. More...
Public Member Functions inherited from XMLDocumentHandler
virtual | ~XMLDocumentHandler ()
Public Member Functions inherited from XMLErrorReporter
virtual | ~XMLErrorReporter ()
| Default destructor. More...
Public Member Functions inherited from XMLEntityHandler
virtual | ~XMLEntityHandler ()
| Default destructor. More...

## Implementation of the deprecated DocTypeHandler Interface

virtual void | attDef (const DTDElementDecl &elemDecl, const DTDAttDef &attDef, const bool ignore)
| This method is used to report an attribute definition. More...
virtual void | doctypeComment (const XMLCh *const comment)
| This method is used to report a comment occurring within the DTD. More...
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. More...
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. More...
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. More...
virtual void | elementDecl (const DTDElementDecl &decl, const bool isIgnored)
| This method is used to report an element declarations successfully scanned by the parser. More...
virtual void | endAttList (const DTDElementDecl &elemDecl)
| This method is used to report the end of an attribute list declaration for an element. More...
virtual void | endIntSubset ()
| This method is used to report the end of the internal subset. More...
virtual void | endExtSubset ()
| This method is used to report the end of the external subset. More...
virtual void | entityDecl (const DTDEntityDecl &entityDecl, const bool isPEDecl, const bool isIgnored)
| This method is used to report any entity declarations. More...
virtual void | resetDocType ()
| This method allows the user installed DTD handler to reset itself. More...
virtual void | notationDecl (const XMLNotationDecl &notDecl, const bool isIgnored)
| This method is used to report any notation declarations. More...
virtual void | startAttList (const DTDElementDecl &elemDecl)
| This method is used to indicate the start of an element's attribute list declaration. More...
virtual void | startIntSubset ()
| This method is used indicate the start of the internal subset. More...
virtual void | startExtSubset ()
| This method is used indicate the start of the external subset. More...
virtual void | TextDecl (const XMLCh *const versionStr, const XMLCh *const encodingStr)
| This method is used to report the TextDecl. More...
const XMLScanner & | getScanner () const
| This method returns a reference to the underlying scanner object. More...
GrammarResolver * | getGrammarResolver () const
| Get the Grammar resolver. More...

## Additional Inherited Members

Protected Member Functions inherited from XMemory
| XMemory ()
| Protected default constructor. More...
Protected Member Functions inherited from XMLDocumentHandler
| XMLDocumentHandler ()
Protected Member Functions inherited from XMLErrorReporter
| XMLErrorReporter ()
| Default constructor. More...
Protected Member Functions inherited from XMLEntityHandler
| XMLEntityHandler ()
| Protected default constructor. More...

## Detailed Description

This class implements the SAX 'Parser' interface and should be used by applications wishing to parse the XML files using SAX.

It allows the client program to install SAX handlers for event callbacks.

It can be used to instantiate a validating or non-validating parser, by setting a member flag.

Deprecated:
  This interface has been replaced by the SAX2 interface, which includes Namespace support. See SAX2XMLReader for more information.

Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.

## Member Enumeration Documentation

## ValSchemes

enum SAXParser::ValSchemes

ValScheme enum used in setValidationScheme Val_Never: Do not report validation errors.

Val_Always: The parser will always report validation errors. Val_Auto: The parser will report validation errors only if a grammar is specified.

See also
  setValidationScheme

Enumerator
Val_Never |
Val_Always |
Val_Auto |

## Constructor & Destructor Documentation

## SAXParser()

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

Parameters

  valToAdopt | Pointer to the validator instance to use. The parser is responsible for freeing the memory.
  manager | Pointer to the memory manager to be used to allocate objects.
  gramPool | The collection of cached grammars.

## ~SAXParser()

SAXParser::~SAXParser | ( |  | ) |

Destructor.

## Member Function Documentation

## attDef()

virtual void SAXParser::attDef | ( | const DTDElementDecl & | elemDecl,
|  | const DTDAttDef & | attDef,
|  | const bool | ignore
| ) |  |

virtual

This method is used to report an attribute definition.

This method is a no-op for this SAX driver implementation.

Parameters

  elemDecl | A const reference to the object containing information about the element whose attribute definition was just parsed.
  attDef | A const reference to the object containing information attribute definition.
  ignore | The flag indicating whether this attribute definition was ignored by the parser or not.

## cacheGrammarFromParse()

void SAXParser::cacheGrammarFromParse | ( | const bool | newState | ) |

Set the 'Grammar caching' flag.

This method allows users to enable or disable caching of grammar when parsing XML documents. When set to true, the parser will cache the resulting grammar for use in subsequent parses.

If the flag is set to true, the 'Use cached grammar' flag will also be set to true.

The parser's default state is: false.

Parameters

  newState | The value specifying whether we should cache grammars or not.

See also
  isCachingGrammarFromParse
  useCachedGrammarInParse

## docCharacters()

virtual void SAXParser::docCharacters | ( | const XMLCh *const | chars,
|  | const XMLSize_t | length,
|  | const bool | cdataSection
| ) |  |

virtual

This method is used to report all the characters scanned by the parser.

The driver will invoke the 'characters' method of the user installed SAX Document Handler.

If any advanced callback handlers are installed, the corresponding 'docCharacters' method will also be invoked.

Parameters

  chars | A const pointer to a Unicode string representing the character data.
  length | The length of the Unicode string returned in 'chars'.
  cdataSection | A flag indicating if the characters represent content from the CDATA section.

See also
  DocumentHandler::characters

Implements XMLDocumentHandler.

## docComment()

virtual void SAXParser::docComment | ( | const XMLCh *const | comment | ) |

virtual

This method is used to report any comments scanned by the parser.

This method is a no-op unless, unless an advanced callback handler is installed, in which case the corresponding 'docComment' method is invoked.

Parameters

  comment | A const pointer to a null terminated Unicode string representing the comment text.

Implements XMLDocumentHandler.

## docPI()

virtual void SAXParser::docPI | ( | const XMLCh *const | target,
|  | const XMLCh *const | data
| ) |  |

virtual

This method is used to report any PI scanned by the parser.

Any PI's occurring before any 'content' are not reported to any SAX handler as per the specification. However, all PI's within content are reported via the SAX Document Handler's 'processingInstruction' method.

If any advanced callback handlers are installed, the corresponding 'docPI' method will be invoked.

Parameters

  target | A const pointer to a Unicode string representing the target of the PI declaration.
  data | A const pointer to a Unicode string representing the data of the PI declaration. See the PI production rule in the XML specification for details.

See also
  DocumentHandler::processingInstruction

Implements XMLDocumentHandler.

## doctypeComment()

virtual void SAXParser::doctypeComment | ( | const XMLCh *const | comment | ) |

virtual

This method is used to report a comment occurring within the DTD.

This method is a no-op for this SAX driver implementation.

Parameters

  comment | A const pointer to a Unicode string representing the text of the comment just parsed.

## doctypeDecl()

virtual void SAXParser::doctypeDecl | ( | const DTDElementDecl & | elemDecl,
|  | const XMLCh *const | publicId,
|  | const XMLCh *const | systemId,
|  | const bool | hasIntSubset,
|  | const bool | hasExtSubset = `false`
| ) |  |

virtual

This method is used to report the DOCTYPE declaration.

This method is a no-op for this SAX driver implementation.

Parameters

  elemDecl | A const reference to the object containing information about the root element definition declaration of the XML document being parsed.
  publicId | A const pointer to a Unicode string representing the public id of the DTD file.
  systemId | A const pointer to a Unicode string representing the system id of the DTD file.
  hasIntSubset | A flag indicating if this XML file contains any internal subset.
  hasExtSubset | A flag indicating if this XML file contains any external subset. Default is false.

## doctypePI()

virtual void SAXParser::doctypePI | ( | const XMLCh *const | target,
|  | const XMLCh *const | data
| ) |  |

virtual

This method is used to report any PI declarations occurring inside the DTD definition block.

This method is a no-op for this SAX driver implementation.

Parameters

  target | A const pointer to a Unicode string representing the target of the PI declaration.
  data | A const pointer to a Unicode string representing the data of the PI declaration. See the PI production rule in the XML specification for details.

## doctypeWhitespace()

virtual void SAXParser::doctypeWhitespace | ( | const XMLCh *const | chars,
|  | const XMLSize_t | length
| ) |  |

virtual

This method is used to report any whitespaces occurring inside the DTD definition block.

This method is a no-op for this SAX driver implementation.

Parameters

  chars | A const pointer to a Unicode string representing the whitespace characters.
  length | The length of the whitespace Unicode string.

## elementDecl()

virtual void SAXParser::elementDecl | ( | const DTDElementDecl & | decl,
|  | const bool | isIgnored
| ) |  |

virtual

This method is used to report an element declarations successfully scanned by the parser.

This method is a no-op for this SAX driver implementation.

Parameters

  decl | A const reference to the object containing element declaration information.
  isIgnored | The flag indicating whether this definition was ignored by the parser or not.

## endAttList()

virtual void SAXParser::endAttList | ( | const DTDElementDecl & | elemDecl | ) |

virtual

This method is used to report the end of an attribute list declaration for an element.

This method is a no-op for this SAX driver implementation.

Parameters

  elemDecl | A const reference to the object containing element declaration information.

## endDocument()

virtual void SAXParser::endDocument | ( |  | ) |

virtual

This method is used to indicate the end of root element was just scanned by the parser.

Corresponding 'endDocument' method of the user installed SAX Document Handler will also be invoked.

In addition, if any advanced callback handlers are installed, the corresponding 'endDocument' method is invoked.

See also
  DocumentHandler::endDocument

Implements XMLDocumentHandler.

## endElement()

virtual void SAXParser::endElement | ( | const XMLElementDecl & | elemDecl,
|  | const unsigned int | urlId,
|  | const bool | isRoot,
|  | const XMLCh *const | elemPrefix
| ) |  |

virtual

This method is used to indicate the end tag of an element.

The driver will invoke the corresponding 'endElement' method of the SAX Document Handler interface.

If any advanced callback handlers are installed, the corresponding 'endElement' method is also invoked.

Parameters

  elemDecl | A const reference to the object containing element declaration information.
  urlId | An id referring to the namespace prefix, if namespaces setting is switched on.
  isRoot | A flag indicating whether this element was the root element.
  elemPrefix | A const pointer to a Unicode string containing the namespace prefix for this element. Applicable only when namespace processing is enabled.

See also
  DocumentHandler::endElement

Implements XMLDocumentHandler.

## endEntityReference()

virtual void SAXParser::endEntityReference | ( | const XMLEntityDecl & | entDecl | ) |

virtual

This method is used to indicate that an end of an entity reference was just scanned.

If any advanced callback handlers are installed, the corresponding 'endEntityReference' method is invoked.

Parameters

  entDecl | A const reference to the object containing the entity declaration information.

Implements XMLDocumentHandler.

## endExtSubset()

virtual void SAXParser::endExtSubset | ( |  | ) |

virtual

This method is used to report the end of the external subset.

This method is a no-op for this SAX driver implementation.

## endInputSource()

virtual void SAXParser::endInputSource | ( | const InputSource & | inputSource | ) |

virtual

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

This method is a no-op for this SAX driver implementation.

Parameters

  inputSource | A const reference to the InputSource object which points to the XML file being parsed.

See also
  InputSource

Implements XMLEntityHandler.

## endIntSubset()

virtual void SAXParser::endIntSubset | ( |  | ) |

virtual

This method is used to report the end of the internal subset.

This method is a no-op for this SAX driver implementation.

## entityDecl()

virtual void SAXParser::entityDecl | ( | const DTDEntityDecl & | entityDecl,
|  | const bool | isPEDecl,
|  | const bool | isIgnored
| ) |  |

virtual

This method is used to report any entity declarations.

For unparsed entities, this driver will invoke the SAX DTDHandler::unparsedEntityDecl callback.

Parameters

  entityDecl | A const reference to the object containing the entity declaration information.
  isPEDecl | The flag indicating whether this was a parameter entity declaration or not.
  isIgnored | The flag indicating whether this definition was ignored by the parser or not.

See also
  DTDHandler::unparsedEntityDecl

## error()

virtual void SAXParser::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
| ) |  |

virtual

This method is used to report back errors found while parsing the XML file.

The driver will call the corresponding user installed SAX Error Handler methods: 'fatal', 'error', 'warning' depending on the severity of the error. This classification is defined by the XML specification.

Parameters

  errCode | An integer code for the error.
  msgDomain | A const pointer to an Unicode string representing the message domain to use.
  errType | An enumeration classifying the severity of the error.
  errorText | A const pointer to an Unicode string representing the text of the error message.
  systemId | A const pointer to an Unicode string representing the system id of the XML file where this error was discovered.
  publicId | A const pointer to an Unicode string representing the public id of the XML file where this error was discovered.
  lineNum | The line number where the error occurred.
  colNum | The column number where the error occurred.

See also
  ErrorHandler

Implements XMLErrorReporter.

## expandSystemId()

virtual bool SAXParser::expandSystemId | ( | const XMLCh *const | systemId,
|  | XMLBuffer & | toFill
| ) |  |

virtual

This method allows an installed XMLEntityHandler to further process any system id's of external entities encountered in the XML file being parsed, such as redirection etc.

This method always returns 'false' for this SAX driver implementation.

Parameters

  systemId | A const pointer to an Unicode string representing the system id scanned by the parser.
  toFill | A pointer to a buffer in which the application processed system id is stored.

Returns
  'true', if any processing is done, 'false' otherwise.

Implements XMLEntityHandler.

## getCalculateSrcOfs()

bool SAXParser::getCalculateSrcOfs | ( |  | ) | const

Get the 'calculate src offset flag'.

This method returns the state of the parser's src offset calculation when parsing an XML document.

Returns
  true, if the parser is currently configured to calculate src offsets, false otherwise.

See also
  setCalculateSrcOfs

## getDisableDefaultEntityResolution()

bool SAXParser::getDisableDefaultEntityResolution | ( |  | ) | const

Get the 'disable default entity resolution' flag.

Returns
  true, if the parser is currently configured to not perform default entity resolution, false otherwise.

See also
  setDisableDefaultEntityResolution

## getDocumentHandler() [1/2]

DocumentHandler * SAXParser::getDocumentHandler | ( |  | ) |

This method returns the installed document handler.

Suitable for 'lvalue' usages.

Returns
  The pointer to the installed document handler object.

## getDocumentHandler() [2/2]

const DocumentHandler * SAXParser::getDocumentHandler | ( |  | ) | const

This method returns the installed document handler.

Suitable only for 'rvalue' usages.

Returns
  A const pointer to the installed document handler object.

## getDoNamespaces()

bool SAXParser::getDoNamespaces | ( |  | ) | const

This method returns the state of the parser's namespace handling capability.

Returns
  true, if the parser is currently configured to understand namespaces, false otherwise.

See also
  setDoNamespaces

## getDoSchema()

bool SAXParser::getDoSchema | ( |  | ) | const

Get the 'do schema' flag.

This method returns the state of the parser's schema processing flag.

Returns
  true, if the parser is currently configured to understand schema, false otherwise.

See also
  setDoSchema

## getEntityResolver() [1/2]

EntityResolver * SAXParser::getEntityResolver | ( |  | ) |

This method returns the installed entity resolver.

Suitable for 'lvalue' usages.

Returns
  The pointer to the installed entity resolver object.

## getEntityResolver() [2/2]

const EntityResolver * SAXParser::getEntityResolver | ( |  | ) | const

This method returns the installed entity resolver.

Suitable for 'rvalue' usages.

Returns
  A const pointer to the installed entity resolver object.

## getErrorCount()

int SAXParser::getErrorCount | ( |  | ) | const

Get error count from the last parse operation.

This method returns the error count from the last parse operation. Note that this count is actually stored in the scanner, so this method simply returns what the scanner reports.

Returns
  number of errors encountered during the latest parse operation.

## getErrorHandler() [1/2]

ErrorHandler * SAXParser::getErrorHandler | ( |  | ) |

This method returns the installed error handler.

Suitable for 'lvalue' usages.

Returns
  The pointer to the installed error handler object.

## getErrorHandler() [2/2]

const ErrorHandler * SAXParser::getErrorHandler | ( |  | ) | const

This method returns the installed error handler.

Suitable for 'rvalue' usages.

Returns
  A const pointer to the installed error handler object.

## getExitOnFirstFatalError()

bool SAXParser::getExitOnFirstFatalError | ( |  | ) | const

This method returns the state of the parser's exit-on-First-Fatal-Error flag.

Returns
  true, if the parser is currently configured to exit on the first fatal error, false otherwise.

See also
  setExitOnFirstFatalError

## getExternalNoNamespaceSchemaLocation()

XMLCh * SAXParser::getExternalNoNamespaceSchemaLocation | ( |  | ) | const

Get the noNamespace SchemaLocation that is specified externally.

This method returns the no target namespace XML Schema Location that was specified using setExternalNoNamespaceSchemaLocation.

The parser owns the returned string, and the memory allocated for the returned string will be destroyed when the parser is deleted.

To ensure accessibility of the returned information after the parser is deleted, callers need to copy and store the returned information somewhere else.

Returns
  a pointer to the no target namespace Schema Location that was specified externally. The pointer spans the same life-time as the parser. A null pointer is returned if nothing was specified externally.

See also
  setExternalNoNamespaceSchemaLocation(const XMLCh* const)

## getExternalSchemaLocation()

XMLCh * SAXParser::getExternalSchemaLocation | ( |  | ) | const

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

This method returns the list of Namespace/SchemaLocation that was specified using setExternalSchemaLocation.

The parser owns the returned string, and the memory allocated for the returned string will be destroyed when the parser is deleted.

To ensure accessibility of the returned information after the parser is deleted, callers need to copy and store the returned information somewhere else.

Returns
  a pointer to the list of Namespace/SchemaLocation that was specified externally. The pointer spans the same life-time as the parser. A null pointer is returned if nothing was specified externally.

See also
  setExternalSchemaLocation(const XMLCh* const)

## getGenerateSyntheticAnnotations()

bool SAXParser::getGenerateSyntheticAnnotations | ( |  | ) | const

Get the 'generate synthetic annotations' flag.

Returns
  true, if the parser is currently configured to generate synthetic annotations, false otherwise. A synthetic XSAnnotation is created when a schema component has non-schema attributes but has no child annotations so that the non-schema attributes can be recovered under PSVI.

See also
  setGenerateSyntheticAnnotations

## getGrammar()

Grammar * SAXParser::getGrammar | ( | const XMLCh *const | nameSpaceKey | ) |

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

Parameters

  nameSpaceKey | Namespace key

Returns
  Grammar associated with the Namespace key.

## getGrammarResolver()

GrammarResolver * SAXParser::getGrammarResolver | ( |  | ) | const

protected

Get the Grammar resolver.

This provides derived classes with access to the grammar resolver.

## getHandleMultipleImports()

bool SAXParser::getHandleMultipleImports | ( |  | ) | const

Get the 'handle multiple schema imports' flag.

Returns
  true, if the parser is currently configured to import multiple schemas with the same namespace, false otherwise.

See also
  setHandleMultipleImports

## getIdentityConstraintChecking()

bool SAXParser::getIdentityConstraintChecking | ( |  | ) | const

Get the 'identity constraint checking' flag.

This method returns the state of the parser's identity constraint checking flag.

Returns
  true, if the parser is currently configured to have identity constraint checking, false otherwise.

See also
  setIdentityConstraintChecking

## getIgnoreAnnotations()

bool SAXParser::getIgnoreAnnotations | ( |  | ) | const

Get the 'ignore annotations' flag.

Returns
  true, if the parser is currently configured to ignore annotations, false otherwise.

See also
  setIgnoreAnnotations

## getIgnoreCachedDTD()

bool SAXParser::getIgnoreCachedDTD | ( |  | ) | const

Get the 'ignore cached DTD grammar' flag.

Returns
  true, if the parser is currently configured to ignore cached DTD, false otherwise.

See also
  setIgnoreCachedDTD

## getLoadExternalDTD()

bool SAXParser::getLoadExternalDTD | ( |  | ) | const

Get the 'Loading External DTD' flag.

This method returns the state of the parser's loading external DTD flag.

Returns
  false, if the parser is currently configured to ignore external DTD completely, true otherwise.

See also
  setLoadExternalDTD
  getValidationScheme

## getLoadSchema()

bool SAXParser::getLoadSchema | ( |  | ) | const

Get the 'Loading Schema' flag.

This method returns the state of the parser's loading schema flag.

Returns
  true, if the parser is currently configured to automatically load schemas that are not in the grammar pool, false otherwise.

See also
  setLoadSchema

## getLowWaterMark()

XMLSize_t SAXParser::getLowWaterMark | ( |  | ) | const

Get the raw buffer low water mark for this parser.

If the number of available bytes in the raw buffer is less than the low water mark the parser will attempt to read more data before continuing parsing. By default the value for this parameter is 100 bytes. You may want to set this parameter to 0 if you would like the parser to parse the available data immediately without potentially blocking while waiting for more date.

Returns
  current low water mark

See also
  setSecurityManager

## getPSVIHandler() [1/2]

PSVIHandler * SAXParser::getPSVIHandler | ( |  | ) |

This method returns the installed PSVI handler.

Suitable for 'lvalue' usages.

Returns
  The pointer to the installed PSVI handler object.

## getPSVIHandler() [2/2]

const PSVIHandler * SAXParser::getPSVIHandler | ( |  | ) | const

This method returns the installed PSVI handler.

Suitable for 'rvalue' usages.

Returns
  A const pointer to the installed PSVI handler object.

## getRootGrammar()

Grammar * SAXParser::getRootGrammar | ( |  | ) |

Retrieve the grammar where the root element is declared.

Returns
  Grammar where root element declared

## getScanner()

const XMLScanner & SAXParser::getScanner | ( |  | ) | const

protected

This method returns a reference to the underlying scanner object.

It allows read only access to data maintained in the scanner.

Returns
  A const reference to the underlying scanner object.

## getSecurityManager()

SecurityManager * SAXParser::getSecurityManager | ( |  | ) | const

Get the SecurityManager instance attached to this parser.

This method returns the security manager that was specified using setSecurityManager.

The SecurityManager instance must have been specified by the application; this should not be deleted until after the parser has been deleted (or a new SecurityManager instance has been supplied to the parser).

Returns
  a pointer to the SecurityManager instance specified externally. A null pointer is returned if nothing was specified externally.

See also
  setSecurityManager(SecurityManager* const)

## getSkipDTDValidation()

bool SAXParser::getSkipDTDValidation | ( |  | ) | const

Get the 'skip DTD validation' flag.

Returns
  true, if the parser is currently configured to skip DTD validation, false otherwise.

See also
  setSkipDTDValidation

## getSrcOffset()

XMLFilePos SAXParser::getSrcOffset | ( |  | ) | const

Returns the current src offset within the input source.

To be used only while parsing is in progress.

Returns
  offset within the input source

## getStandardUriConformant()

bool SAXParser::getStandardUriConformant | ( |  | ) | const

Get the 'force standard uri flag'.

This method returns the state if the parser forces standard uri

Returns
  true, if the parser is currently configured to force standard uri, i.e. malformed uri will be rejected.

See also
  setStandardUriConformant

## getURIText()

const XMLCh * SAXParser::getURIText | ( | unsigned int | uriId | ) | const

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

Parameters

  uriId | id of the string in the URI string pool.

Returns
  URI string corresponding to the URI id.

## getValidateAnnotations()

bool SAXParser::getValidateAnnotations | ( |  | ) | const

Get the 'validate annotations' flag.

Returns
  true, if the parser is currently configured to validate annotations, false otherwise.

See also
  setValidateAnnotations

## getValidationConstraintFatal()

bool SAXParser::getValidationConstraintFatal | ( |  | ) | const

This method returns the state of the parser's validation-constraint-fatal flag.

Returns
  true, if the parser is currently configured to set validation constraint errors as fatal, false otherwise.

See also
  setValidationConstraintFatal

## getValidationSchemaFullChecking()

bool SAXParser::getValidationSchemaFullChecking | ( |  | ) | const

Get the 'full schema constraint checking' flag.

This method returns the state of the parser's full schema constraint checking flag.

Returns
  true, if the parser is currently configured to have full schema constraint checking, false otherwise.

See also
  setValidationSchemaFullChecking

## getValidationScheme()

ValSchemes SAXParser::getValidationScheme | ( |  | ) | const

This method returns an enumerated value that indicates the current validation scheme set on this parser.

Returns
  The ValSchemes value current set on this parser.

See also
  setValidationScheme

## getValidator()

const XMLValidator & SAXParser::getValidator | ( |  | ) | const

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

Returns
  A const reference to the installed validator object.

## getXMLEntityResolver() [1/2]

XMLEntityResolver * SAXParser::getXMLEntityResolver | ( |  | ) |

This method returns the installed entity resolver.

Suitable for 'lvalue' usages.

Returns
  The pointer to the installed entity resolver object.

## getXMLEntityResolver() [2/2]

const XMLEntityResolver * SAXParser::getXMLEntityResolver | ( |  | ) | const

This method returns the installed entity resolver.

Suitable for 'rvalue' usages.

Returns
  A const pointer to the installed entity resolver object.

## ignorableWhitespace()

virtual void SAXParser::ignorableWhitespace | ( | const XMLCh *const | chars,
|  | const XMLSize_t | length,
|  | const bool | cdataSection
| ) |  |

virtual

This method is used to report all the whitespace characters, which are determined to be 'ignorable'.

This distinction between characters is only made, if validation is enabled. Corresponding 'ignorableWhitespace' method of the user installed SAX Document Handler interface is called.

Any whitespace before content is not reported to the SAX Document Handler method, as per the SAX specification. However, if any advanced callback handlers are installed, the corresponding 'ignorableWhitespace' method is invoked.

Parameters

  chars | A const pointer to a Unicode string representing the ignorable whitespace character data.
  length | The length of the Unicode string 'chars'.
  cdataSection | A flag indicating if the characters represent content from the CDATA section.

See also
  DocumentHandler::ignorableWhitespace

Implements XMLDocumentHandler.

## installAdvDocHandler()

void SAXParser::installAdvDocHandler | ( | XMLDocumentHandler *const | toInstall | ) |

This method installs the specified 'advanced' document callback handler, thereby allowing the user to customize the processing, if they choose to do so.

Any number of advanced callback handlers maybe installed.

The methods in the advanced callback interface represent Xerces-C extensions. There is no specification for this interface.

Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.

Parameters

  toInstall | A pointer to the users advanced callback handler.

See also
  removeAdvDocHandler

## isCachingGrammarFromParse()

bool SAXParser::isCachingGrammarFromParse | ( |  | ) | const

Get the 'Grammar caching' flag.

This method returns the state of the parser's grammar caching when parsing an XML document.

Returns
  true, if the parser is currently configured to cache grammars, false otherwise.

See also
  cacheGrammarFromParse

## isUsingCachedGrammarInParse()

bool SAXParser::isUsingCachedGrammarInParse | ( |  | ) | const

Get the 'Use cached grammar' flag.

This method returns the state of the parser's use of cached grammar when parsing an XML document.

Returns
  true, if the parser is currently configured to use cached grammars, false otherwise.

See also
  useCachedGrammarInParse

## loadGrammar() [1/3]

Grammar * SAXParser::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.

This method invokes the preparsing process on a schema grammar XML file specified by the file path parameter. If the 'toCache' flag is enabled, the parser will cache the grammars for re-use. If a grammar key is found in the pool, no caching of any grammar will take place.

Parameters

  systemId | A const char pointer to a native string which contains the path to the XML grammar file to be preparsed.
  grammarType | The grammar type (Schema or DTD).
  toCache | If `true`, we cache the preparsed grammar, otherwise, no caching. Default is `false`.

Returns
  The preparsed schema grammar object (SchemaGrammar or DTDGrammar). That grammar object is owned by the parser.

Exceptions

  SAXException | Any SAX exception, possibly wrapping another exception.
  XMLException | An exception from the parser or client handler code.
  DOMException | A DOM exception as per DOM spec.

## loadGrammar() [2/3]

Grammar * SAXParser::loadGrammar | ( | const InputSource & | source,
|  | const Grammar::GrammarType | grammarType,
|  | const bool | toCache = `false`
| ) |  |

Preparse schema grammar (XML Schema, DTD, etc.) via an input source object.

This method invokes the preparsing process on a schema grammar XML file specified by the SAX InputSource parameter. If the 'toCache' flag is enabled, the parser will cache the grammars for re-use. If a grammar key is found in the pool, no caching of any grammar will take place.

Parameters

  source | A const reference to the SAX InputSource object which points to the schema grammar file to be preparsed.
  grammarType | The grammar type (Schema or DTD).
  toCache | If `true`, we cache the preparsed grammar, otherwise, no caching. Default is `false`.

Returns
  The preparsed schema grammar object (SchemaGrammar or DTDGrammar). That grammar object is owned by the parser.

Exceptions

  SAXException | Any SAX exception, possibly wrapping another exception.
  XMLException | An exception from the parser or client handler code.
  DOMException | A DOM exception as per DOM spec.

See also
  InputSource::InputSource

## loadGrammar() [3/3]

Grammar * SAXParser::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.

This method invokes the preparsing process on a schema grammar XML file specified by the file path parameter. If the 'toCache' flag is enabled, the parser will cache the grammars for re-use. If a grammar key is found in the pool, no caching of any grammar will take place.

Parameters

  systemId | A const XMLCh pointer to the Unicode string which contains the path to the XML grammar file to be preparsed.
  grammarType | The grammar type (Schema or DTD).
  toCache | If `true`, we cache the preparsed grammar, otherwise, no caching. Default is `false`.

Returns
  The preparsed schema grammar object (SchemaGrammar or DTDGrammar). That grammar object is owned by the parser.

Exceptions

  SAXException | Any SAX exception, possibly wrapping another exception.
  XMLException | An exception from the parser or client handler code.
  DOMException | A DOM exception as per DOM spec.

## notationDecl()

virtual void SAXParser::notationDecl | ( | const XMLNotationDecl & | notDecl,
|  | const bool | isIgnored
| ) |  |

virtual

This method is used to report any notation declarations.

If there is a user installed DTDHandler, then the driver will invoke the SAX DTDHandler::notationDecl callback.

Parameters

  notDecl | A const reference to the object containing the notation declaration information.
  isIgnored | The flag indicating whether this definition was ignored by the parser or not.

See also
  DTDHandler::notationDecl

## parse() [1/3]

virtual void SAXParser::parse | ( | const char *const | systemId | ) |

virtual

This method invokes the parsing process on the XML file specified by the native char* string parameter 'systemId'.

Parameters

  systemId | A const char pointer to a native string which contains the path to the XML file to be parsed.

Implements Parser.

## parse() [2/3]

virtual void SAXParser::parse | ( | const InputSource & | source | ) |

virtual

This method invokes the parsing process on the XML file specified by the InputSource parameter.

Parameters

  source | A const reference to the InputSource object which points to the XML file to be parsed.

See also
  Parser::parse(InputSource)

Implements Parser.

## parse() [3/3]

virtual void SAXParser::parse | ( | const XMLCh *const | systemId | ) |

virtual

This method invokes the parsing process on the XML file specified by the Unicode string parameter 'systemId'.

Parameters

  systemId | A const XMLCh pointer to the Unicode string which contains the path to the XML file to be parsed.

See also
  Parser::parse(XMLCh*)

Implements Parser.

## parseFirst() [1/3]

bool SAXParser::parseFirst | ( | const char *const | systemId,
|  | XMLPScanToken & | toFill
| ) |  |

Begin a progressive parse operation.

This method is used to start a progressive parse on a XML file. To continue parsing, subsequent calls must be to the parseNext method.

It scans through the prolog and returns a token to be used on subsequent scanNext() calls. If the return value is true, then the token is legal and ready for further use. If it returns false, then the scan of the prolog failed and the token is not going to work on subsequent scanNext() calls.

Parameters

  systemId | A pointer to a regular native string representing the path to the XML file to be parsed.
  toFill | A token maintaing state information to maintain internal consistency between invocation of 'parseNext' calls.

Returns
  'true', if successful in parsing the prolog. It indicates the user can go ahead with parsing the rest of the file. It returns 'false' to indicate that the parser could not parse the prolog.

See also
  parseNext
  #parseFirst(XMLCh*,...)
  #parseFirst(InputSource&,...)

## parseFirst() [2/3]

bool SAXParser::parseFirst | ( | const InputSource & | source,
|  | XMLPScanToken & | toFill
| ) |  |

Begin a progressive parse operation.

This method is used to start a progressive parse on a XML file. To continue parsing, subsequent calls must be to the parseNext method.

It scans through the prolog and returns a token to be used on subsequent scanNext() calls. If the return value is true, then the token is legal and ready for further use. If it returns false, then the scan of the prolog failed and the token is not going to work on subsequent scanNext() calls.

Parameters

  source | A const reference to the InputSource object which points to the XML file to be parsed.
  toFill | A token maintaing state information to maintain internal consistency between invocation of 'parseNext' calls.

Returns
  'true', if successful in parsing the prolog. It indicates the user can go ahead with parsing the rest of the file. It returns 'false' to indicate that the parser could not parse the prolog.

See also
  parseNext
  #parseFirst(XMLCh*,...)
  #parseFirst(char*,...)

## parseFirst() [3/3]

bool SAXParser::parseFirst | ( | const XMLCh *const | systemId,
|  | XMLPScanToken & | toFill
| ) |  |

Begin a progressive parse operation.

This method is used to start a progressive parse on a XML file. To continue parsing, subsequent calls must be to the parseNext method.

It scans through the prolog and returns a token to be used on subsequent scanNext() calls. If the return value is true, then the token is legal and ready for further use. If it returns false, then the scan of the prolog failed and the token is not going to work on subsequent scanNext() calls.

Parameters

  systemId | A pointer to a Unicode string representing the path to the XML file to be parsed.
  toFill | A token maintaing state information to maintain internal consistency between invocation of 'parseNext' calls.

Returns
  'true', if successful in parsing the prolog. It indicates the user can go ahead with parsing the rest of the file. It returns 'false' to indicate that the parser could parse the prolog (which means the token will not be valid.)

See also
  parseNext
  #parseFirst(char*,...)
  #parseFirst(InputSource&,...)

## parseNext()

bool SAXParser::parseNext | ( | XMLPScanToken & | token | ) |

Continue a progressive parse operation.

This method is used to continue with progressive parsing of XML files started by a call to 'parseFirst' method.

It parses the XML file and stops as soon as it comes across a XML token (as defined in the XML specification). Relevant callback handlers are invoked as required by the SAX specification.

Parameters

  token | A token maintaing state information to maintain internal consistency between invocation of 'parseNext' calls.

Returns
  'true', if successful in parsing the next XML token. It indicates the user can go ahead with parsing the rest of the file. It returns 'false' to indicate that the parser could not find next token as per the XML specification production rule.

See also
  #parseFirst(XMLCh*,...)
  #parseFirst(char*,...)
  #parseFirst(InputSource&,...)

## parseReset()

void SAXParser::parseReset | ( | XMLPScanToken & | token | ) |

Reset the parser after a progressive parse.

If a progressive parse loop exits before the end of the document is reached, the parser has no way of knowing this. So it will leave open any files or sockets or memory buffers that were in use at the time that the parse loop exited.

The next parse operation will cause these open files and such to be closed, but the next parse operation might occur at some unknown future point. To avoid this problem, you should reset the parser if you exit the loop early.

If you exited because of an error, then this cleanup will be done for you. Its only when you exit the file prematurely of your own accord, because you've found what you wanted in the file most likely.

Parameters

  token | A token maintaing state information to maintain internal consistency between invocation of 'parseNext' calls.

## removeAdvDocHandler()

bool SAXParser::removeAdvDocHandler | ( | XMLDocumentHandler *const | toRemove | ) |

This method removes the 'advanced' document handler callback from the underlying parser scanner.

If no handler is installed, advanced callbacks are not invoked by the scanner.

Parameters

  toRemove | A pointer to the advanced callback handler which should be removed.

Note - XMLDocumentHandler calls, when used with SAXParser, will not provide correct namespace information. This is becaue the SAX parser does not support namespace aware processing.

See also
  installAdvDocHandler

## resetCachedGrammarPool()

void SAXParser::resetCachedGrammarPool | ( |  | ) |

This method allows the user to reset the pool of cached grammars.

## resetDocType()

virtual void SAXParser::resetDocType | ( |  | ) |

virtual

This method allows the user installed DTD handler to reset itself.

## resetDocument()

virtual void SAXParser::resetDocument | ( |  | ) |

virtual

This method allows the user installed Document Handler and any advanced callback handlers to 'reset' themselves.

Implements XMLDocumentHandler.

## resetEntities()

virtual void SAXParser::resetEntities | ( |  | ) |

virtual

This method allows the installed XMLEntityHandler to reset itself.

This method is a no-op for this SAX driver implementation.

Implements XMLEntityHandler.

## resetErrors()

virtual void SAXParser::resetErrors | ( |  | ) |

virtual

This method allows the user installed Error Handler callback to 'reset' itself.

This method is a no-op for this SAX driver implementation.

Implements XMLErrorReporter.

## resolveEntity()

virtual InputSource * SAXParser::resolveEntity | ( | XMLResourceIdentifier * | resourceIdentifier | ) |

virtual

Resolve a public/system id.

This method allows a user installed entity handler to further process any pointers to external entities. The applications can implement 'redirection' via this callback.

Parameters

  resourceIdentifier | An object containing the type of resource to be resolved and the associated data members corresponding to this type.

Returns
  The value returned by the user installed resolveEntity method or NULL otherwise to indicate no processing was done. The returned InputSource is owned by the parser which is responsible to clean up the memory.

See also
  XMLEntityHandler
  XMLEntityResolver

Implements XMLEntityHandler.

## setCalculateSrcOfs()

void SAXParser::setCalculateSrcOfs | ( | const bool | newState | ) |

Enable/disable src offset calculation.

This method allows users to enable/disable src offset calculation. Disabling the calculation will improve performance.

The parser's default state is: false.

Parameters

  newState | The value specifying whether we should enable or disable src offset calculation

See also
  getCalculateSrcOfs

## setDisableDefaultEntityResolution()

void SAXParser::setDisableDefaultEntityResolution | ( | const bool | newValue | ) |

Set the 'disable default entity resolution' flag.

This method gives users the option to not perform default entity resolution. If the user's resolveEntity method returns NULL the parser will try to resolve the entity on its own. When this option is set to true, the parser will not attempt to resolve the entity when the resolveEntity method returns NULL.

The parser's default state is false

Parameters

  newValue | The state to set

See also
  EntityResolver

## setDocumentHandler()

virtual void SAXParser::setDocumentHandler | ( | DocumentHandler *const | handler | ) |

virtual

This method installs the user specified SAX Document Handler callback function on parser.

Parameters

  handler | A pointer to the document handler to be called when the parser comes across 'document' events as per the SAX specification.

See also
  Parser::parse(char*)

Implements Parser.

## setDoNamespaces()

void SAXParser::setDoNamespaces | ( | const bool | newState | ) |

This method allows users to enable or disable the parser's namespace processing.

When set to true, parser starts enforcing all the constraints / rules specified by the NameSpace specification.

The parser's default state is: false.

Parameters

  newState | The value specifying whether NameSpace rules should be enforced or not.

See also
  getDoNamespaces

## setDoSchema()

void SAXParser::setDoSchema | ( | const bool | newState | ) |

Set the 'schema support' flag.

This method allows users to enable or disable the parser's schema processing. When set to false, parser will not process any schema found.

The parser's default state is: false.

Note: If set to true, namespace processing must also be turned on.

Parameters

  newState | The value specifying whether schema support should be enforced or not.

See also
  getDoSchema

## setDTDHandler()

virtual void SAXParser::setDTDHandler | ( | DTDHandler *const | handler | ) |

virtual

This method installs the user specified DTD handler on the parser.

Parameters

  handler | A pointer to the DTD handler to be called when the parser comes across 'DTD' events as per the SAX specification.

See also
  Parser::setDTDHandler

Implements Parser.

## setEntityResolver()

virtual void SAXParser::setEntityResolver | ( | EntityResolver *const | resolver | ) |

virtual

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

It allows applications to trap and redirect calls to external entities.

Any previously set entity resolver is merely dropped, since the parser does not own them. If both setEntityResolver and setXMLEntityResolver are called, then the last one is used.

Parameters

  resolver | A pointer to the entity resolver to be called when the parser comes across references to entities in the XML file.

See also
  Parser::setEntityResolver

Implements Parser.

## setErrorHandler()

virtual void SAXParser::setErrorHandler | ( | ErrorHandler *const | handler | ) |

virtual

This method installs the user specified error handler on the parser.

Parameters

  handler | A pointer to the error handler to be called when the parser comes across 'error' events as per the SAX specification.

See also
  Parser::setErrorHandler

Implements Parser.

## setExitOnFirstFatalError()

void SAXParser::setExitOnFirstFatalError | ( | const bool | newState | ) |

This method allows users to set the parser's behaviour when it encounters the first fatal error.

If set to true, the parser will exit at the first fatal error. If false, then it will report the error and continue processing.

The default value is 'true' and the parser exits on the first fatal error.

Parameters

  newState | The value specifying whether the parser should continue or exit when it encounters the first fatal error.

See also
  getExitOnFirstFatalError

## setExternalNoNamespaceSchemaLocation() [1/2]

void SAXParser::setExternalNoNamespaceSchemaLocation | ( | const char *const | noNamespaceSchemaLocation | ) |

This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).

It takes native char string as parameter

Parameters

  noNamespaceSchemaLocation | the XML Schema Location with no target namespace

See also
  setExternalNoNamespaceSchemaLocation(const XMLCh* const)

## setExternalNoNamespaceSchemaLocation() [2/2]

void SAXParser::setExternalNoNamespaceSchemaLocation | ( | const XMLCh *const | noNamespaceSchemaLocation | ) |

This method allows the user to specify the no target namespace XML Schema Location externally.

If specified, the instance document's noNamespaceSchemaLocation attribute will be effectively ignored.

If this method is called more than once, only the last one takes effect.

The syntax is the same as for the noNamespaceSchemaLocation attribute that may occur in an instance document: e.g."file_name.xsd".

Parameters

  noNamespaceSchemaLocation | the XML Schema Location with no target namespace

See also
  getExternalNoNamespaceSchemaLocation

## setExternalSchemaLocation() [1/2]

void SAXParser::setExternalSchemaLocation | ( | const char *const | schemaLocation | ) |

This method is same as setExternalSchemaLocation(const XMLCh* const).

It takes native char string as parameter

Parameters

  schemaLocation | the list of schemas to use

See also
  setExternalSchemaLocation(const XMLCh* const)

## setExternalSchemaLocation() [2/2]

void SAXParser::setExternalSchemaLocation | ( | const XMLCh *const | schemaLocation | ) |

This method allows the user to specify a list of schemas to use.

If the targetNamespace of a schema specified using this method matches the targetNamespace of a schema occurring in the instance document in the schemaLocation attribute, or if the targetNamespace matches the namespace attribute of the "import" element, the schema specified by the user using this method will be used (i.e., the schemaLocation attribute in the instance document or on the "import" element will be effectively ignored).

If this method is called more than once, only the last one takes effect.

The syntax is the same as for schemaLocation attributes in instance documents: e.g, "http://www.example.com file_name.xsd". The user can specify more than one XML Schema in the list.

Parameters

  schemaLocation | the list of schemas to use

See also
  getExternalSchemaLocation

## setGenerateSyntheticAnnotations()

void SAXParser::setGenerateSyntheticAnnotations | ( | const bool | newValue | ) |

set the 'generate synthetic annotations' flag

Parameters

  newValue | The value for specifying whether Synthetic Annotations should be generated or not. A synthetic XSAnnotation is created when a schema component has non-schema attributes but has no child annotations.

See also
  getGenerateSyntheticAnnotations

## setHandleMultipleImports()

void SAXParser::setHandleMultipleImports | ( | const bool | newValue | ) |

Set the 'handle multiple schema imports' flag.

This method gives users the ability to import multiple schemas that have the same namespace.

NOTE: This option is ignored if schema validation is disabled.

The parser's default state is false

Parameters

  newValue | The state to set

## setIdentityConstraintChecking()

void SAXParser::setIdentityConstraintChecking | ( | const bool | identityConstraintChecking | ) |

This method allows the user to turn identity constraint checking on/off.

Only takes effect if Schema validation is enabled. If turned off, identity constraint checking is not done.

The parser's default state is: true.

Parameters

  identityConstraintChecking | True to turn on identity constraint checking.

See also
  getIdentityConstraintChecking

## setIgnoreAnnotations()

void SAXParser::setIgnoreAnnotations | ( | const bool | newValue | ) |

Set the 'ignore annotation' flag.

This method gives users the option to not generate XSAnnotations when "traversing" a schema.

The parser's default state is false

Parameters

  newValue | The state to set

## setIgnoreCachedDTD()

void SAXParser::setIgnoreCachedDTD | ( | const bool | newValue | ) |

Set the 'ignore cached DTD grammar' flag.

This method gives users the option to ignore a cached DTD grammar, when an XML document contains both an internal and external DTD, and the use cached grammar from parse option is enabled. Currently, we do not allow using cached DTD grammar when an internal subset is present in the document. This option will only affect the behavior of the parser when an internal and external DTD both exist in a document (i.e. no effect if document has no internal subset).

The parser's default state is false

Parameters

  newValue | The state to set

## setInputBufferSize()

void SAXParser::setInputBufferSize | ( | const XMLSize_t | bufferSize | ) |

Set maximum input buffer size.

This method allows users to limit the size of buffers used in parsing XML character data. The effect of setting this size is to limit the size of a ContentHandler::characters() call.

The parser's default input buffer size is 1 megabyte.

Parameters

  bufferSize | The maximum input buffer size

## setLoadExternalDTD()

void SAXParser::setLoadExternalDTD | ( | const bool | newState | ) |

Set the 'Loading External DTD' flag.

This method allows users to enable or disable the loading of external DTD. When set to false, the parser will ignore any external DTD completely if the validationScheme is set to Val_Never.

The parser's default state is: true.

This flag is ignored if the validationScheme is set to Val_Always or Val_Auto.

Parameters

  newState | The value specifying whether external DTD should be loaded or not.

See also
  getLoadExternalDTD
  setValidationScheme

## setLoadSchema()

void SAXParser::setLoadSchema | ( | const bool | newState | ) |

Set the 'Loading Schema' flag.

This method allows users to enable or disable the loading of schemas. When set to false, the parser not attempt to load schemas beyond querying the grammar pool for them.

The parser's default state is: true.

Parameters

  newState | The value specifying whether schemas should be loaded if they're not found in the grammar pool.

See also
  getLoadSchema
  setDoSchema

## setLowWaterMark()

void SAXParser::setLowWaterMark | ( | XMLSize_t | lwm | ) |

Set the raw buffer low water mark for this parser.

If the number of available bytes in the raw buffer is less than the low water mark the parser will attempt to read more data before continuing parsing. By default the value for this parameter is 100 bytes. You may want to set this parameter to 0 if you would like the parser to parse the available data immediately without potentially blocking while waiting for more date.

Parameters

  lwm | new low water mark

See also
  getSecurityManager

## setPSVIHandler()

virtual void SAXParser::setPSVIHandler | ( | PSVIHandler *const | handler | ) |

virtual

This method installs the user specified PSVI handler on the parser.

Parameters

  handler | A pointer to the PSVI handler to be called when the parser comes across 'PSVI' events as per the schema specification.

See also
  Parser::setPSVIHandler

## setSecurityManager()

void SAXParser::setSecurityManager | ( | SecurityManager *const | securityManager | ) |

This allows an application to set a SecurityManager on the parser; this object stores information that various components use to limit their consumption of system resources while processing documents.

If this method is called more than once, only the last one takes effect. It may not be reset during a parse.

Parameters

  securityManager | the SecurityManager instance to be used by this parser

See also
  getSecurityManager

## setSkipDTDValidation()

void SAXParser::setSkipDTDValidation | ( | const bool | newValue | ) |

Set the 'skip DTD validation' flag.

This method gives users the option to skip DTD validation only when schema validation is on (i.e. when performing validation, we will ignore the DTD, except for entities, when schema validation is enabled).

NOTE: This option is ignored if schema validation is disabled.

The parser's default state is false

Parameters

  newValue | The state to set

## setStandardUriConformant()

void SAXParser::setStandardUriConformant | ( | const bool | newState | ) |

Force standard uri.

This method allows users to tell the parser to force standard uri conformance.

The parser's default state is: false.

Parameters

  newState | The value specifying whether the parser should reject malformed URI.

See also
  getStandardUriConformant

## setValidateAnnotations()

void SAXParser::setValidateAnnotations | ( | const bool | newValue | ) |

set the 'validate annotations' flag

Parameters

  newValue | The value for specifying whether annotations should be validate or not.

See also
  getValidateAnnotations

## setValidationConstraintFatal()

void SAXParser::setValidationConstraintFatal | ( | const bool | newState | ) |

This method allows users to set the parser's behaviour when it encounters a validation constraint error.

If set to true, and the the parser will treat validation error as fatal and will exit depends on the state of "getExitOnFirstFatalError". If false, then it will report the error and continue processing.

Note: setting this true does not mean the validation error will be printed with the word "Fatal Error". It is still printed as "Error", but the parser will exit if "setExitOnFirstFatalError" is set to true.

The default value is 'false'.

Parameters

  newState | If true, the parser will exit if "setExitOnFirstFatalError" is set to true.

See also
  getValidationConstraintFatal
  setExitOnFirstFatalError

## setValidationSchemaFullChecking()

void SAXParser::setValidationSchemaFullChecking | ( | const bool | schemaFullChecking | ) |

This method allows the user to turn full Schema constraint checking on/off.

Only takes effect if Schema validation is enabled. If turned off, partial constraint checking is done.

Full schema constraint checking includes those checking that may be time-consuming or memory intensive. Currently, particle unique attribution constraint checking and particle derivation restriction checking are controlled by this option.

The parser's default state is: false.

Parameters

  schemaFullChecking | True to turn on full schema constraint checking.

See also
  getValidationSchemaFullChecking

## setValidationScheme()

void SAXParser::setValidationScheme | ( | const ValSchemes | newScheme | ) |

This method allows users to set the validation scheme to be used by this parser.

The value is one of the ValSchemes enumerated values defined by this class:

Val_Never - turn off validation
Val_Always - turn on validation
Val_Auto - turn on validation if any internal/external DTD subset have been seen

The parser's default state is: Val_Never.

Parameters

  newScheme | The new validation scheme to use.

See also
  getValidationScheme

## setXMLEntityResolver()

virtual void SAXParser::setXMLEntityResolver | ( | XMLEntityResolver *const | resolver | ) |

virtual

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

It allows applications to trap and redirect calls to external entities.

Any previously set entity resolver is merely dropped, since the parser does not own them. If both setEntityResolver and setXMLEntityResolver are called, then the last one is used.

Parameters

  resolver | A pointer to the entity resolver to be called when the parser comes across references to entities in the XML file.

See also
  Parser::setXMLEntityResolver

## startAttList()

virtual void SAXParser::startAttList | ( | const DTDElementDecl & | elemDecl | ) |

virtual

This method is used to indicate the start of an element's attribute list declaration.

This method is a no-op for this SAX driver implementation.

Parameters

  elemDecl | A const reference to the object containing element declaration information.

## startDocument()

virtual void SAXParser::startDocument | ( |  | ) |

virtual

This method is used to report the start of the parsing process.

The corresponding user installed SAX Document Handler's method 'startDocument' is invoked.

If any advanced callback handlers are installed, then the corresponding 'startDocument' method is also called.

See also
  DocumentHandler::startDocument

Implements XMLDocumentHandler.

## startElement()

virtual void SAXParser::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
| ) |  |

virtual

This method is used to report the start of an element.

It is called at the end of the element, by which time all attributes specified are also parsed. The corresponding user installed SAX Document Handler's method 'startElement' is invoked.

If any advanced callback handlers are installed, then the corresponding 'startElement' method is also called.

Parameters

  elemDecl | A const reference to the object containing element declaration information.
  urlId | An id referring to the namespace prefix, if namespaces setting is switched on.
  elemPrefix | A const pointer to a Unicode string containing the namespace prefix for this element. Applicable only when namespace processing is enabled.
  attrList | A const reference to the object containing the list of attributes just scanned for this element.
  attrCount | A count of number of attributes in the list specified by the parameter 'attrList'.
  isEmpty | A flag indicating whether this is an empty element or not.
  isRoot | A flag indicating whether this element was the root element.

See also
  DocumentHandler::startElement

Implements XMLDocumentHandler.

## startEntityReference()

virtual void SAXParser::startEntityReference | ( | const XMLEntityDecl & | entDecl | ) |

virtual

This method is used to indicate the start of an entity reference.

If any advanced callback handlers are installed, the corresponding 'endEntityReference' method is invoked.

Parameters

  entDecl | A const reference to the object containing the entity declaration information.

Implements XMLDocumentHandler.

## startExtSubset()

virtual void SAXParser::startExtSubset | ( |  | ) |

virtual

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

This method is a no-op for this SAX driver implementation.

## startInputSource()

virtual void SAXParser::startInputSource | ( | const InputSource & | inputSource | ) |

virtual

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

This method is a no-op for this SAX driver implementation.

Parameters

  inputSource | A const reference to the InputSource object which points to the external entity being parsed.

Implements XMLEntityHandler.

## startIntSubset()

virtual void SAXParser::startIntSubset | ( |  | ) |

virtual

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

This method is a no-op for this SAX driver implementation.

## TextDecl()

virtual void SAXParser::TextDecl | ( | const XMLCh *const | versionStr,
|  | const XMLCh *const | encodingStr
| ) |  |

virtual

This method is used to report the TextDecl.

Refer to the XML specification for the syntax of a TextDecl.

This method is a no-op for this SAX driver implementation.

Parameters

  versionStr | A const pointer to a Unicode string representing the version number of the 'version' clause.
  encodingStr | A const pointer to a Unicode string representing the encoding name of the 'encoding' clause.

## useCachedGrammarInParse()

void SAXParser::useCachedGrammarInParse | ( | const bool | newState | ) |

Set the 'Use cached grammar' flag.

This method allows users to enable or disable the use of cached grammars. When set to true, the parser will use the cached grammar, instead of building the grammar from scratch, to validate XML documents.

If the 'Grammar caching' flag is set to true, this method ignores the value passed in.

The parser's default state is: false.

Parameters

  newState | The value specifying whether we should use the cached grammar or not.

See also
  isUsingCachedGrammarInParse
  cacheGrammarFromParse

## useScanner()

void SAXParser::useScanner | ( | const XMLCh *const | scannerName | ) |

Set the scanner to use when scanning the XML document.

This method allows users to set the scanner to use when scanning a given XML document.

Parameters

  scannerName | The name of the desired scanner

## XMLDecl()

virtual void SAXParser::XMLDecl | ( | const XMLCh *const | versionStr,
|  | const XMLCh *const | encodingStr,
|  | const XMLCh *const | standaloneStr,
|  | const XMLCh *const | actualEncodingStr
| ) |  |

virtual

This method is used to report the XML decl scanned by the parser.

Refer to the XML specification to see the meaning of parameters.

This method is a no-op for this SAX driver implementation.

Parameters

  versionStr | A const pointer to a Unicode string representing version string value.
  encodingStr | A const pointer to a Unicode string representing the encoding string value.
  standaloneStr | A const pointer to a Unicode string representing the standalone string value.
  actualEncodingStr | A const pointer to a Unicode string representing the actual encoding string value.

Implements XMLDocumentHandler.

The documentation for this class was generated from the following file:

- SAXParser.hpp