ome-common 5.2.0-m2

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ome::common::xml::EntityResolver Class Reference

Xerces entity resolver. More...

`#include <ome/common/xml/EntityResolver.h>`

Inheritance diagram for ome::common::xml::EntityResolver:
[legend]
Collaboration diagram for ome::common::xml::EntityResolver:
[legend]

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

## Detailed Description

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.

## Member Function Documentation

xercesc::InputSource * ome::common::xml::EntityResolver::getSource | ( | const std::string & | resource | ) |
| 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.

Parameters

  resource | the resource to resolve.

Returns
  the input source for the file, or null on failure.

References entity_data_map, entity_path_map, and logger.

Referenced by resolveEntity().

Here is the caller graph for this function:

void ome::common::xml::EntityResolver::registerCatalog | ( | const boost::filesystem::path & | file | ) |

Register a catalog with the entity resolver.

Parameters

  file | the filename of the catalog.

References ome::common::canonical(), ome::common::xml::dom::createDocument(), ome::common::xml::dom::Document::getDocumentElement(), logger, and registerEntity().

void ome::common::xml::EntityResolver::registerEntity | ( | const std::string & | id,
|  | const boost::filesystem::path & | file
| ) |  |

Register a file with the entity resolver.

Parameters

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

Here is the caller graph for this function:

xercesc::InputSource * ome::common::xml::EntityResolver::resolveEntity | ( | xercesc::XMLResourceIdentifier * | resource | ) |

Resolve an entity.

Parameters

  resource | the resource to resolve.

Returns
  an input source containing the cached content, or null if the resource was not cached.

References getSource().

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

- ome/common/xml/EntityResolver.h
- ome/common/xml/EntityResolver.cpp