Xerces-C++ 3.3.0

List of all members
XercesDOMParser Class Reference

This class implements the Document Object Model (DOM) interface. More...

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

Inheritance diagram for XercesDOMParser:

## Public Member Functions
Constructors and Destructor
| XercesDOMParser (XMLValidator *const valToAdopt=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager, XMLGrammarPool *const gramPool=0)
| Construct a XercesDOMParser, with an optional validator.
virtual | ~XercesDOMParser ()
| Destructor.
Getter methods
ErrorHandler * | getErrorHandler ()
| Get a pointer to the error handler.
const ErrorHandler * | getErrorHandler () const
| Get a const pointer to the error handler.
EntityResolver * | getEntityResolver ()
| Get a pointer to the entity resolver.
const EntityResolver * | getEntityResolver () const
| Get a const pointer to the entity resolver.
XMLEntityResolver * | getXMLEntityResolver ()
| Get a pointer to the entity resolver.
const XMLEntityResolver * | getXMLEntityResolver () const
| Get a const pointer to the entity resolver.
bool | isCachingGrammarFromParse () const
| Get the 'Grammar caching' flag.
bool | isUsingCachedGrammarInParse () const
| Get the 'Use cached grammar' flag.
Grammar * | getGrammar (const XMLCh *const nameSpaceKey)
| Retrieve the grammar that is associated with the specified namespace key.
Grammar * | getRootGrammar ()
| Retrieve the grammar where the root element is declared.
const XMLCh * | getURIText (unsigned int uriId) const
| Returns the string corresponding to a URI id from the URI string pool.
XMLFilePos | getSrcOffset () const
| Returns the current src offset within the input source.
bool | getIgnoreCachedDTD () const
| Get the 'ignore cached DTD grammar' flag.
Setter methods
void | setErrorHandler (ErrorHandler *const handler)
| Set the error handler.
void | setEntityResolver (EntityResolver *const handler)
| Set the entity resolver.
void | setXMLEntityResolver (XMLEntityResolver *const handler)
| Set the entity resolver.
void | cacheGrammarFromParse (const bool newState)
| Set the 'Grammar caching' flag.
void | useCachedGrammarInParse (const bool newState)
| Set the 'Use cached grammar' flag.
void | setIgnoreCachedDTD (const bool newValue)
| Set the 'ignore cached DTD grammar' flag.
Utility methods
void | resetDocumentPool ()
| Reset the documents vector pool and release all the associated memory back to the system.
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)
| Handle errors reported from the parser.
virtual void | resetErrors ()
| Reset any error data before a new parse.
Implementation of the XMLEntityHandler interface.
virtual void | endInputSource (const InputSource &inputSource)
| Handle an end of input source event.
virtual bool | expandSystemId (const XMLCh *const systemId, XMLBuffer &toFill)
| Expand a system id.
virtual void | resetEntities ()
| Reset any entity handler information.
virtual InputSource * | resolveEntity (XMLResourceIdentifier *resourceIdentifier)
| Resolve a public/system id.
virtual void | startInputSource (const InputSource &inputSource)
| Handle a 'start input source' event.
Public Member Functions inherited from AbstractDOMParser
virtual | ~AbstractDOMParser ()
| Destructor.
void | reset ()
| Reset the parser.
DOMDocument * | adoptDocument ()
| Adopt the DOM document.
DOMDocument * | getDocument ()
| Get the DOM document.
const XMLValidator & | getValidator () const
| Get a const reference to the validator.
ValSchemes | getValidationScheme () const
| This method returns an enumerated value that indicates the current validation scheme set on this parser.
bool | getDoSchema () const
| Get the 'do schema' flag.
bool | getValidationSchemaFullChecking () const
| Get the 'full schema constraint checking' flag.
bool | getIdentityConstraintChecking () const
| Get the identity constraint checking' flag.
XMLSize_t | getErrorCount () const
| Get error count from the last parse operation.
bool | getDoNamespaces () const
| Get the 'do namespaces' flag.
bool | getExitOnFirstFatalError () const
| Get the 'exit on first error' flag.
bool | getValidationConstraintFatal () const
| This method returns the state of the parser's validation-constraint-fatal flag.
bool | getCreateEntityReferenceNodes () const
| Get the 'include entity references' flag.
bool | getIncludeIgnorableWhitespace () const
| Get the 'include ignorable whitespace' flag.
XMLCh * | getExternalSchemaLocation () const
| Get the set of Namespace/SchemaLocation that is specified externally.
XMLCh * | getExternalNoNamespaceSchemaLocation () const
| Get the noNamespace SchemaLocation that is specified externally.
SecurityManager * | getSecurityManager () const
| Get the SecurityManager instance attached to this parser.
const XMLSize_t & | getLowWaterMark () const
| Get the raw buffer low water mark for this parser.
bool | getDisallowDoctype () const
| Get the 'Disallow DOCTYPE (DTD)' flag.
bool | getLoadExternalDTD () const
| Get the 'Loading External DTD' flag.
bool | getLoadSchema () const
| Get the 'Loading Schema' flag.
bool | getCreateCommentNodes () const
| Get the 'create comment node' flag.
bool | getCalculateSrcOfs () const
| Get the 'calculate src offset flag'.
bool | getStandardUriConformant () const
| Get the 'force standard uri flag'.
PSVIHandler * | getPSVIHandler ()
| This method returns the installed PSVI handler.
const PSVIHandler * | getPSVIHandler () const
| This method returns the installed PSVI handler.
bool | getCreateSchemaInfo () const
| Get the 'associate schema info' flag.
bool | getDoXInclude () const
| Get the 'do XInclude' flag.
bool | getGenerateSyntheticAnnotations () const
| Get the 'generate synthetic annotations' flag.
bool | getValidateAnnotations () const
| Get the 'validate annotations' flag.
bool | getIgnoreAnnotations () const
| Get the 'ignore annotations' flag.
bool | getDisableDefaultEntityResolution () const
| Get the 'disable default entity resolution' flag.
bool | getSkipDTDValidation () const
| Get the 'skip DTD validation' flag.
bool | getHandleMultipleImports () const
| Get the 'handle multiple schema imports' flag.
void | setGenerateSyntheticAnnotations (const bool newValue)
| set the 'generate synthetic annotations' flag
void | setValidateAnnotations (const bool newValue)
| set the 'validlate annotations' flag
void | setDoNamespaces (const bool newState)
| Set the 'do namespaces' flag.
void | setExitOnFirstFatalError (const bool newState)
| Set the 'exit on first error' flag.
void | setValidationConstraintFatal (const bool newState)
| This method allows users to set the parser's behaviour when it encounters a validation constraint error.
void | setCreateEntityReferenceNodes (const bool create)
| Set the 'include entity references' flag.
void | setIncludeIgnorableWhitespace (const bool include)
| Set the 'include ignorable whitespace' flag.
void | setValidationScheme (const ValSchemes newScheme)
| This method allows users to set the validation scheme to be used by this parser.
void | setDoSchema (const bool newState)
| Set the 'do schema' flag.
void | setValidationSchemaFullChecking (const bool schemaFullChecking)
| This method allows the user to turn full Schema constraint checking on/off.
void | setIdentityConstraintChecking (const bool newState)
| This method allows users to enable or disable the parser's identity constraint checks.
void | setExternalSchemaLocation (const XMLCh *const schemaLocation)
| This method allows the user to specify a list of schemas to use.
void | setExternalSchemaLocation (const char *const schemaLocation)
| This method is same as setExternalSchemaLocation(const XMLCh* const).
void | setExternalNoNamespaceSchemaLocation (const XMLCh *const noNamespaceSchemaLocation)
| This method allows the user to specify the no target namespace XML Schema Location externally.
void | setExternalNoNamespaceSchemaLocation (const char *const noNamespaceSchemaLocation)
| This method is same as setExternalNoNamespaceSchemaLocation(const XMLCh* const).
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.
void | setLowWaterMark (XMLSize_t lwm)
| Set the raw buffer low water mark for this parser.
void | setDisallowDoctype (const bool newState)
| Set the 'Disallow DOCTYPE (DTD)' flag.
void | setLoadExternalDTD (const bool newState)
| Set the 'Loading External DTD' flag.
void | setLoadSchema (const bool newState)
| Set the 'Loading Schema' flag.
void | setCreateCommentNodes (const bool create)
| Set the 'create comment nodes' flag.
void | setCalculateSrcOfs (const bool newState)
| Enable/disable src offset calculation.
void | setStandardUriConformant (const bool newState)
| Force standard uri.
void | useScanner (const XMLCh *const scannerName)
| Set the scanner to use when scanning the XML document.
void | useImplementation (const XMLCh *const implementationFeatures)
| Set the implementation to use when creating the document.
virtual void | setPSVIHandler (PSVIHandler *const handler)
| This method installs the user specified PSVI handler on the parser.
void | setCreateSchemaInfo (const bool newState)
| Set the 'associate schema info' flag.
void | setDoXInclude (const bool newState)
| Set the 'do XInclude' flag.
void | setIgnoreAnnotations (const bool newValue)
| Set the 'ignore annotation' flag.
void | setDisableDefaultEntityResolution (const bool newValue)
| Set the 'disable default entity resolution' flag.
void | setSkipDTDValidation (const bool newValue)
| Set the 'skip DTD validation' flag.
void | setHandleMultipleImports (const bool newValue)
| Set the 'handle multiple schema imports' flag.
void | parse (const InputSource &source)
| Parse via an input source object.
void | parse (const XMLCh *const systemId)
| Parse via a file path or URL.
void | parse (const char *const systemId)
| Parse via a file path or URL (in the local code page)
bool | parseFirst (const XMLCh *const systemId, XMLPScanToken &toFill)
| Begin a progressive parse operation.
bool | parseFirst (const char *const systemId, XMLPScanToken &toFill)
| Begin a progressive parse operation.
bool | parseFirst (const InputSource &source, XMLPScanToken &toFill)
| Begin a progressive parse operation.
bool | parseNext (XMLPScanToken &token)
| Continue a progressive parse operation.
void | parseReset (XMLPScanToken &token)
| Reset the parser after a progressive parse.
virtual void | handleElementPSVI (const XMLCh *const localName, const XMLCh *const uri, PSVIElement *elementInfo)
| Receive notification of the PSVI properties of an element.
virtual void | handlePartialElementPSVI (const XMLCh *const localName, const XMLCh *const uri, PSVIElement *elementInfo)
| Receive notification of partial PSVI properties of an element.
virtual void | handleAttributesPSVI (const XMLCh *const localName, const XMLCh *const uri, PSVIAttributeList *psviAttributes)
| Enables PSVI information about attributes to be passed back to the application.
virtual void | docCharacters (const XMLCh *const chars, const XMLSize_t length, const bool cdataSection)
| Handle document character events.
virtual void | docComment (const XMLCh *const comment)
| Handle a document comment event.
virtual void | docPI (const XMLCh *const target, const XMLCh *const data)
| Handle a document PI event.
virtual void | endDocument ()
| Handle the end of document event.
virtual void | endElement (const XMLElementDecl &elemDecl, const unsigned int urlId, const bool isRoot, const XMLCh *const elemPrefix)
| Handle and end of element event.
virtual void | endEntityReference (const XMLEntityDecl &entDecl)
| Handle and end of entity reference event.
virtual void | ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length, const bool cdataSection)
| Handle an ignorable whitespace vent.
virtual void | resetDocument ()
| Handle a document reset event.
virtual void | startDocument ()
| Handle a start document event.
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)
| Handle a start element event.
virtual void | startEntityReference (const XMLEntityDecl &entDecl)
| Handle a start entity reference event.
virtual void | XMLDecl (const XMLCh *const versionStr, const XMLCh *const encodingStr, const XMLCh *const standaloneStr, const XMLCh *const actualEncStr)
| Handle an XMLDecl event.
virtual void | attDef (const DTDElementDecl &elemDecl, const DTDAttDef &attDef, const bool ignoring)
virtual void | doctypeComment (const XMLCh *const comment)
virtual void | doctypeDecl (const DTDElementDecl &elemDecl, const XMLCh *const publicId, const XMLCh *const systemId, const bool hasIntSubset, const bool hasExtSubset=false)
virtual void | doctypePI (const XMLCh *const target, const XMLCh *const data)
virtual void | doctypeWhitespace (const XMLCh *const chars, const XMLSize_t length)
virtual void | elementDecl (const DTDElementDecl &decl, const bool isIgnored)
virtual void | endAttList (const DTDElementDecl &elemDecl)
virtual void | endIntSubset ()
virtual void | endExtSubset ()
virtual void | entityDecl (const DTDEntityDecl &entityDecl, const bool isPEDecl, const bool isIgnored)
virtual void | resetDocType ()
virtual void | notationDecl (const XMLNotationDecl &notDecl, const bool isIgnored)
virtual void | startAttList (const DTDElementDecl &elemDecl)
virtual void | startIntSubset ()
virtual void | startExtSubset ()
virtual void | TextDecl (const XMLCh *const versionStr, const XMLCh *const encodingStr)
Public Member Functions inherited from XMemory
void * | operator new (size_t size)
| This method overrides operator new.
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.
void * | operator new (size_t size, void *ptr)
| This method overrides placement operator new.
void | operator delete (void *p)
| This method overrides operator delete.
void | operator delete (void *p, MemoryManager *memMgr)
| This method provides a matching delete for the custom operator new.
void | operator delete (void *p, void *ptr)
| This method provides a matching delete for the placement new.
Public Member Functions inherited from XMLDocumentHandler
virtual | ~XMLDocumentHandler ()
Public Member Functions inherited from XMLErrorReporter
virtual | ~XMLErrorReporter ()
| Default destructor.
Public Member Functions inherited from XMLEntityHandler
virtual | ~XMLEntityHandler ()
| Default destructor.
Public Member Functions inherited from PSVIHandler
virtual | ~PSVIHandler ()

## 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.
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.
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.
void | resetCachedGrammarPool ()
| This method allows the user to reset the pool of cached grammars.

## Additional Inherited Members
Public Types inherited from AbstractDOMParser
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 }
Protected Member Functions inherited from AbstractDOMParser
| AbstractDOMParser (XMLValidator *const valToAdopt=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager, XMLGrammarPool *const gramPool=0)
| Construct a AbstractDOMParser, with an optional validator.
DOMNode * | getCurrentNode ()
| Get the current DOM node.
XMLScanner * | getScanner () const
| Get the XML scanner.
GrammarResolver * | getGrammarResolver () const
| Get the Grammar resolver.
bool | getParseInProgress () const
| Get the parse in progress flag.
MemoryManager * | getMemoryManager () const
void | setCurrentNode (DOMNode *toSet)
| Set the current DOM node.
void | setDocument (DOMDocument *toSet)
| Set the document node.
void | setParseInProgress (const bool toSet)
| Set the parse in progress flag.
void | resetPool ()
bool | isDocumentAdopted () const
| Returns true if the user has adopted the document.
virtual DOMCDATASection * | createCDATASection (const XMLCh *, XMLSize_t)
virtual DOMText * | createText (const XMLCh *, XMLSize_t)
virtual DOMElement * | createElement (const XMLCh *name)
virtual DOMElement * | createElementNS (const XMLCh *namespaceURI, const XMLCh *elemPrefix, const XMLCh *localName, const XMLCh *qName)
virtual DOMAttr * | createAttr (const XMLCh *name)
virtual DOMAttr * | createAttrNS (const XMLCh *namespaceURI, const XMLCh *elemPrefix, const XMLCh *localName, const XMLCh *qName)
Protected Member Functions inherited from XMemory
| XMemory ()
| Protected default constructor.
Protected Member Functions inherited from XMLDocumentHandler
| XMLDocumentHandler ()
Protected Member Functions inherited from XMLErrorReporter
| XMLErrorReporter ()
| Default constructor.
Protected Member Functions inherited from XMLEntityHandler
| XMLEntityHandler ()
| Protected default constructor.
Protected Member Functions inherited from PSVIHandler
| PSVIHandler ()
Protected Attributes inherited from AbstractDOMParser
bool | fCreateEntityReferenceNodes
bool | fIncludeIgnorableWhitespace
bool | fWithinElement
bool | fParseInProgress
bool | fCreateCommentNodes
bool | fDocumentAdoptedByUser
bool | fCreateSchemaInfo
bool | fDoXInclude
XMLScanner * | fScanner
XMLCh * | fImplementationFeatures
DOMNode * | fCurrentParent
DOMNode * | fCurrentNode
DOMEntityImpl * | fCurrentEntity
DOMDocumentImpl * | fDocument
DOMDocumentTypeImpl * | fDocumentType
RefVectorOf< DOMDocumentImpl > * | fDocumentVector
GrammarResolver * | fGrammarResolver
XMLStringPool * | fURIStringPool
XMLValidator * | fValidator
MemoryManager * | fMemoryManager
XMLGrammarPool * | fGrammarPool
XMLBufferMgr | fBufMgr
XMLBuffer & | fInternalSubset
PSVIHandler * | fPSVIHandler

## Detailed Description

This class implements the Document Object Model (DOM) interface.

It should be used by applications which choose to parse and process the XML document using the DOM api's. This implementation also allows the applications to install an error and an entity handler (useful extensions to the DOM specification).

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

## Constructor & Destructor Documentation

## ◆ XercesDOMParser()

XercesDOMParser::XercesDOMParser | ( | XMLValidator *const | valToAdopt = 0,
|  | MemoryManager *const | manager = XMLPlatformUtils::fgMemoryManager,
|  | XMLGrammarPool *const | gramPool = 0 )

Construct a XercesDOMParser, with an optional validator.

Constructor with an instance of validator class to use for validation. If you don't provide a validator, a default one will be created for you in the scanner.

Parameters

  gramPool | Pointer to the grammar pool instance from external application. The parser does NOT own it.
  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.

## ◆ ~XercesDOMParser()

virtual XercesDOMParser::~XercesDOMParser | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ cacheGrammarFromParse()

void XercesDOMParser::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

## ◆ endInputSource()

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

Handle an end of input source event.

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

This method is a no-op for this DOM implementation.

Parameters

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

See also
  InputSource

Implements XMLEntityHandler.

## ◆ error()

virtual void XercesDOMParser::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

Handle errors reported from the parser.

This method is used to report back errors found while parsing the XML file. This method is also borrowed from the SAX specification. It calls the corresponding user installed Error Handler method: '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()

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

Expand a system id.

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

## ◆ getEntityResolver() [1/2]

EntityResolver * XercesDOMParser::getEntityResolver | ( |  | ) |

Get a pointer to the entity resolver.

This method returns the installed entity resolver. If no resolver has been installed, then it will be a zero pointer.

Returns
  The pointer to the installed entity resolver object.

## ◆ getEntityResolver() [2/2]

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

Get a const pointer to the entity resolver.

This method returns the installed entity resolver. If no resolver has been installed, then it will be a zero pointer.

Returns
  A const pointer to the installed entity resolver object.

## ◆ getErrorHandler() [1/2]

ErrorHandler * XercesDOMParser::getErrorHandler | ( |  | ) |

Get a pointer to the error handler.

This method returns the installed error handler. If no handler has been installed, then it will be a zero pointer.

Returns
  The pointer to the installed error handler object.

## ◆ getErrorHandler() [2/2]

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

Get a const pointer to the error handler.

This method returns the installed error handler. If no handler has been installed, then it will be a zero pointer.

Returns
  A const pointer to the installed error handler object.

## ◆ getGrammar()

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

## ◆ getIgnoreCachedDTD()

bool XercesDOMParser::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

## ◆ getRootGrammar()

Grammar * XercesDOMParser::getRootGrammar | ( |  | ) |

Retrieve the grammar where the root element is declared.

Returns
  Grammar where root element declared

## ◆ getSrcOffset()

XMLFilePos XercesDOMParser::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

## ◆ getURIText()

const XMLCh * XercesDOMParser::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.

## ◆ getXMLEntityResolver() [1/2]

XMLEntityResolver * XercesDOMParser::getXMLEntityResolver | ( |  | ) |

Get a pointer to the entity resolver.

This method returns the installed entity resolver. If no resolver has been installed, then it will be a zero pointer.

Returns
  The pointer to the installed entity resolver object.

## ◆ getXMLEntityResolver() [2/2]

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

Get a const pointer to the entity resolver.

This method returns the installed entity resolver. If no resolver has been installed, then it will be a zero pointer.

Returns
  A const pointer to the installed entity resolver object.

## ◆ isCachingGrammarFromParse()

bool XercesDOMParser::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 XercesDOMParser::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 * XercesDOMParser::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 * XercesDOMParser::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 * XercesDOMParser::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.

## ◆ resetCachedGrammarPool()

void XercesDOMParser::resetCachedGrammarPool | ( |  | ) |

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

## ◆ resetDocumentPool()

void XercesDOMParser::resetDocumentPool | ( |  | ) |

Reset the documents vector pool and release all the associated memory back to the system.

When parsing a document using a DOM parser, all memory allocated for a DOM tree is associated to the DOM document.

If you do multiple parse using the same DOM parser instance, then multiple DOM documents will be generated and saved in a vector pool. All these documents (and thus all the allocated memory) won't be deleted until the parser instance is destroyed.

If you don't need these DOM documents anymore and don't want to destroy the DOM parser instance at this moment, then you can call this method to reset the document vector pool and release all the allocated memory back to the system.

It is an error to call this method if you are in the middle of a parse (e.g. in the mid of a progressive parse).

Exceptions

  IOException | An exception from the parser if this function is called when a parse is in progress.

## ◆ resetEntities()

void XercesDOMParser::resetEntities | ( |  | ) |
| virtual

Reset any entity handler information.

This method allows the installed XMLEntityHandler to reset itself.

This method is a no-op for this DOM implementation.

Implements XMLEntityHandler.

## ◆ resetErrors()

virtual void XercesDOMParser::resetErrors | ( |  | ) |
| virtual

Reset any error data before a new parse.

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

This method is a no-op for this DOM implementation.

Implements XMLErrorReporter.

## ◆ resolveEntity()

virtual InputSource * XercesDOMParser::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.

## ◆ setEntityResolver()

void XercesDOMParser::setEntityResolver | ( | EntityResolver *const | handler | ) |

Set the entity resolver.

This method allows applications to install their own entity resolver. By installing an entity resolver, the applications can trap and potentially redirect references 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

  handler | A const pointer to the user supplied entity resolver.

See also
  getEntityResolver

## ◆ setErrorHandler()

void XercesDOMParser::setErrorHandler | ( | ErrorHandler *const | handler | ) |

Set the error handler.

This method allows applications to install their own error handler to trap error and warning messages.

Any previously set handler is merely dropped, since the parser does not own them.

Parameters

  handler | A const pointer to the user supplied error handler.

See also
  getErrorHandler

## ◆ setIgnoreCachedDTD()

void XercesDOMParser::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

## ◆ setXMLEntityResolver()

void XercesDOMParser::setXMLEntityResolver | ( | XMLEntityResolver *const | handler | ) |

Set the entity resolver.

This method allows applications to install their own entity resolver. By installing an entity resolver, the applications can trap and potentially redirect references 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 set is used.

Parameters

  handler | A const pointer to the user supplied entity resolver.

See also
  getXMLEntityResolver

## ◆ startInputSource()

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

Handle a 'start input source' event.

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

This method is a no-op for this DOM parse implementation.

Parameters

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

Implements XMLEntityHandler.

## ◆ useCachedGrammarInParse()

void XercesDOMParser::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 ignore 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

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

- XercesDOMParser.hpp