cxxtools::xml::EntityResolver Class Reference

Entity resolver class which associates entities to resolved entity values. More...

#include <cxxtools/xml/entityresolver.h>

Public Member Functions

 EntityResolver ()
 Constructs a new Resolver object and initializes the entity list using the XML default entities.
void clear ()
 Resets the entity list to the XML default entities.
void addEntity (const String &entity, const String &token)
 Adds the given entity and the given resolved entity value (token) to the entity list.
String resolveEntity (const String &entity) const
 Returns the resolved entity value (token) for the given entity.
String getEntity (Char ch) const
 Returns the entity value (token) of the given character.
void getEntity (std::basic_ostream< Char > &os, Char ch) const
 Outputs the entity value (token) of the given character.

Detailed Description

Entity resolver class which associates entities to resolved entity values.

Entities can be added to this class using the method addEntity(). This method takes the entity and the resolved entity value. To resolve the resolves value for an entity the method resolveEntity() can be used.

Constructor & Destructor Documentation

cxxtools::xml::EntityResolver::EntityResolver ( )
inline

Constructs a new Resolver object and initializes the entity list using the XML default entities.

The constructor calls clear() which clears the entity list and adds the XML default entities.

Member Function Documentation

void cxxtools::xml::EntityResolver::addEntity ( const String entity,
const String token 
)
inline

Adds the given entity and the given resolved entity value (token) to the entity list.

To determine the resolved entity value of a entity the method resolveEntity() can be used.

Parameters
entityA list entry for this entity is created and associated with the also given token.
tokenThe resolved entity value that is associated with the also given entity.
void cxxtools::xml::EntityResolver::clear ( )
inline

Resets the entity list to the XML default entities.

The default entities are all entities from HTML4

String cxxtools::xml::EntityResolver::getEntity ( Char  ch) const

Returns the entity value (token) of the given character.

Returns the entity of the given char. If there is no entity found, either the given character as a string or a numeric entity is returned depending of the passed flag.

void cxxtools::xml::EntityResolver::getEntity ( std::basic_ostream< Char > &  os,
Char  ch 
) const

Outputs the entity value (token) of the given character.

Returns the entity of the given char. If there is no entity found, either the given character as a string or a numeric entity is returned depending of the passed flag.

String cxxtools::xml::EntityResolver::resolveEntity ( const String entity) const

Returns the resolved entity value (token) for the given entity.

If the entity is not in the list or an dec or hex entity is invalid an exception is thrown.

Parameters
entityThe resolved entity value for this entity is returned.
Returns
The resolved entity.
Exceptions
XmlErrorif the entity is not in the list.

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