nidas v1.2.3
|
Derived class of XMLParser that keeps its DOMDocuments when parsing an XML disk file, and returns the cached DOMDocument if the file hasn't changed. More...
#include <XMLParser.h>
Public Member Functions | |
xercesc::DOMDocument * | parse (const std::string &xmlFile) |
Parse from a file. | |
void | setDOMValidation (bool val) |
DOMBuilder::setFilter is not yet implemented in xerces c++ 2.6.0 void setFilter(xercesc::DOMBuilderFilter* filter) | |
void | setDOMValidateIfSchema (bool val) |
Enable/disable schema validation. | |
void | setDOMNamespaces (bool val) |
Enable/disable namespace processing. | |
void | setXercesSchema (bool val) |
Enable/disable schema support. | |
void | setXercesSchemaFullChecking (bool val) |
Enable/disable full schema constraint checking, including checking which may be time-consuming or memory intensive. | |
void | setDOMDatatypeNormalization (bool val) |
Enable/disable datatype normalization. | |
void | setXercesUserAdoptsDOMDocument (bool val) |
Control who owns DOMDocument pointer. | |
void | setXercesHandleMultipleImports (bool val) |
void | setXercesDoXInclude (bool val) |
xercesc::DOMDocument * | parse (const std::string &xmlFile, bool verbose=true) |
xercesc::DOMDocument * | parse (xercesc::InputSource &source) |
xercesc::DOMDocument * | parseString (const std::string &xml) |
Parse XML string into a document. | |
Static Public Member Functions | |
static XMLCachingParser * | getInstance () |
static void | destroyInstance () |
static time_t | getFileModTime (const std::string &name) |
Parse from an InputSource. | |
static xercesc::DOMDocument * | ParseString (const std::string &xml) |
Call parseString() on a default XMLParser instance. | |
Protected Member Functions | |
XMLCachingParser () | |
~XMLCachingParser () | |
Protected Attributes | |
std::map< std::string, time_t > | _modTimeCache |
std::map< std::string, xercesc::DOMDocument * > | _docCache |
nidas::util::Mutex | _cacheLock |
xercesc::DOMImplementation * | _impl |
xercesc::DOMLSParser * | _parser |
XMLErrorHandler | _errorHandler |
Static Protected Attributes | |
static XMLCachingParser * | _instance = 0 |
static nidas::util::Mutex | _instanceLock |
Private Member Functions | |
XMLCachingParser (const XMLCachingParser &) | |
No copying. | |
XMLCachingParser & | operator= (const XMLCachingParser &) |
No assignment. | |
Derived class of XMLParser that keeps its DOMDocuments when parsing an XML disk file, and returns the cached DOMDocument if the file hasn't changed.
|
protected |
nidas::core::XMLException |
Referenced by getInstance().
|
protected |
References _cacheLock, _docCache, and nidas::core::getSample().
|
private |
No copying.
|
static |
References _instance, _instanceLock, and nidas::core::getSample().
Referenced by nidas::core::DSMServerApp::main().
Parse from an InputSource.
This is not cached.
nidas::util::IOException |
Referenced by parse().
|
static |
nidas::core::XMLException |
References _instance, _instanceLock, nidas::core::getSample(), and XMLCachingParser().
Referenced by nidas::core::DSMServerApp::parseXMLConfigFile(), and nidas::dynld::XMLConfigService::Worker::run().
|
private |
No assignment.
xercesc::DOMDocument * XMLCachingParser::parse | ( | const std::string & | xmlFile | ) |
Parse from a file.
This will return the DOMDocument pointer of the a previous parse result if the file has not been modified since the last time it was parsed. The pointer to the DOMDocuemnt is owned by XMLCachingParser and the user should not call doc->release();
References _cacheLock, _docCache, _modTimeCache, getFileModTime(), nidas::core::getSample(), and nidas::core::XMLParser::parse().
|
inherited |
nidas::core::XMLException |
References nidas::core::XMLParser::_errorHandler, nidas::core::XMLParser::_parser, nidas::core::getSample(), nidas::core::XMLErrorHandler::getXMLException(), NLOG, nidas::core::XMLErrorHandler::resetErrors(), and verbose.
Referenced by parse(), and nidas::core::XMLParser::parseString().
|
inherited |
|
inherited |
Parse XML string into a document.
The returned DOMDocument pointer needs to be deleted, and before the XMLImplementation is terminated.
xml |
References nidas::core::getSample(), and nidas::core::XMLParser::parse().
|
staticinherited |
Call parseString() on a default XMLParser instance.
xml |
References nidas::core::getSample().
Referenced by DataPrep::run().
Enable/disable datatype normalization.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true let the validation process do its datatype normalization that is defined in the used schema language. If false disable datatype normalization. The XML 1.0 attribute value normalization always occurs though. Default: false. |
References nidas::core::XMLParser::_parser.
Enable/disable namespace processing.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true perform namespace processing. Default: false. |
References nidas::core::XMLParser::_parser.
Enable/disable schema validation.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true the parser will validate the document only if a grammar is specified. If false validation is determined by the state of the validation feature, see setDOMValidation(). Default: false. |
References nidas::core::XMLParser::_parser.
DOMBuilder::setFilter is not yet implemented in xerces c++ 2.6.0 void setFilter(xercesc::DOMBuilderFilter* filter)
Enable/disable validation. See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | Boolean value specifying whether to report all validation errors. Default: false. |
References nidas::core::XMLParser::_parser.
References nidas::core::XMLParser::_parser.
References nidas::core::XMLParser::_parser.
Enable/disable schema support.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true enable the parser's schema support. Default: false. |
References nidas::core::XMLParser::_parser.
Enable/disable full schema constraint checking, including checking which may be time-consuming or memory intensive.
Currently, particle unique attribution constraint checking and particle derivation restriction checking are controlled by this option.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true enable schema constraint checking. Default: false. |
References nidas::core::XMLParser::_parser.
Control who owns DOMDocument pointer.
See /link http://xml.apache.org/xerces-c/program-dom.html#DOMBuilderFeatures
val | If true the caller will adopt the DOMDocument that is returned from the parse method and thus is responsible to call DOMDocument::release() to release the associated memory. The parser will not release it. The ownership is transferred from the parser to the caller. If false the returned DOMDocument from the parse method is owned by the parser and thus will be deleted when the parser is released. |
References nidas::core::XMLParser::_parser.
Referenced by nidas::core::XMLParser::XMLParser().
|
protected |
Referenced by parse(), and ~XMLCachingParser().
|
protected |
Referenced by parse(), and ~XMLCachingParser().
|
protectedinherited |
|
protectedinherited |
Referenced by nidas::core::XMLParser::XMLParser().
|
staticprotected |
Referenced by destroyInstance(), and getInstance().
|
staticprotected |
Referenced by destroyInstance(), and getInstance().
|
protected |
Referenced by parse().
|
protectedinherited |
Referenced by nidas::core::XMLParser::parse(), nidas::core::XMLParser::parse(), nidas::core::XMLParser::setDOMDatatypeNormalization(), nidas::core::XMLParser::setDOMNamespaces(), nidas::core::XMLParser::setDOMValidateIfSchema(), nidas::core::XMLParser::setDOMValidation(), nidas::core::XMLParser::setXercesDoXInclude(), nidas::core::XMLParser::setXercesHandleMultipleImports(), nidas::core::XMLParser::setXercesSchema(), nidas::core::XMLParser::setXercesSchemaFullChecking(), nidas::core::XMLParser::setXercesUserAdoptsDOMDocument(), nidas::core::XMLParser::XMLParser(), and nidas::core::XMLParser::~XMLParser().