bioformats
5.1.8
|
Xerces entity resolver. More...
#include <ome/common/xml/EntityResolver.h>
Public Member Functions | |
EntityResolver () | |
Constructor. | |
~EntityResolver () | |
Destructor. | |
xercesc::InputSource * | resolveEntity (xercesc::XMLResourceIdentifier *resource) |
Resolve an entity. More... | |
void | registerEntity (const std::string &id, const boost::filesystem::path &file) |
Register a file with the entity resolver. More... | |
void | registerCatalog (const boost::filesystem::path &file) |
Register a catalog with the entity resolver. More... | |
Private Types | |
typedef std::map< std::string, boost::filesystem::path > | entity_path_map_type |
Mapping from system ID to filesystem path. | |
typedef std::map< std::string, std::string > | entity_data_map_type |
Mapping from system ID to XML data. | |
Private Member Functions | |
xercesc::InputSource * | getSource (const std::string &resource) |
Get input source from file. More... | |
Private Attributes | |
ome::common::Logger | logger |
Message logger. | |
entity_path_map_type | entity_path_map |
Map of registered system IDs to filesystem paths. | |
entity_data_map_type | entity_data_map |
Map of system IDs to cached XML data. | |
Xerces entity resolver.
This resolver allows replacement of URLs with local files or in-memory copies of XML schemas. This permits efficient validation without network access for commonly-used schemas.
|
private |
Get input source from file.
Open and read the contents of the file, then return this as an InputSource. Use cached content if possible.
resource | the resource to resolve. |
References entity_data_map, entity_path_map, and logger.
Referenced by resolveEntity().
void ome::common::xml::EntityResolver::registerCatalog | ( | const boost::filesystem::path & | file | ) |
Register a catalog with the entity resolver.
file | the filename of the catalog. |
References ome::common::canonical(), ome::common::xml::dom::createDocument(), ome::common::xml::dom::Document::getDocumentElement(), logger, and registerEntity().
Referenced by ome::xml::OMEEntityResolver::OMEEntityResolver().
void ome::common::xml::EntityResolver::registerEntity | ( | const std::string & | id, |
const boost::filesystem::path & | file | ||
) |
Register a file with the entity resolver.
id | the XML system ID of the entity. |
file | the filename of the entity. |
References ome::common::canonical(), and entity_path_map.
Referenced by registerCatalog().
xercesc::InputSource * ome::common::xml::EntityResolver::resolveEntity | ( | xercesc::XMLResourceIdentifier * | resource | ) |
Resolve an entity.
resource | the resource to resolve. |
References getSource().