sptk2 logo
SPTK Home Page
Public Member Functions | Friends | List of all members
sptk::xdoc::XMLDocType Class Reference

#include <XMLDocType.h>

Public Member Functions

 XMLDocType ()=default
 
 XMLDocType (const char *name, const char *public_id=nullptr, const char *system_id=nullptr)
 
const Stringname () const
 
const StringpublicID () const
 
const StringsystemID () const
 
Entitiesentities ()
 
const Entitiesentities () const
 
bool encodeEntities (const char *str, Buffer &ret)
 
void decodeEntities (const char *str, size_t sz, Buffer &ret)
 
void removeEntity (const char *name)
 
const char * getReplacement (const char *name, uint32_t &replacementLength)
 
void setEntity (const String &name, const String &replacement)
 

Friends

class ImportXML
 

Detailed Description

XML document type.

Represents tag <DOCTYPE ...> in XML document. It can return a map of all entities(). Provides the name(), public_id() and system_id() functions.

Constructor & Destructor Documentation

◆ XMLDocType() [1/2]

sptk::xdoc::XMLDocType::XMLDocType ( )
default

Default constructor

◆ XMLDocType() [2/2]

sptk::xdoc::XMLDocType::XMLDocType ( const char *  name,
const char *  public_id = nullptr,
const char *  system_id = nullptr 
)
explicit

Constructor

Member Function Documentation

◆ decodeEntities()

void sptk::xdoc::XMLDocType::decodeEntities ( const char *  str,
size_t  sz,
Buffer ret 
)

Decodes entities in string to their actual values.

Converts "&lt;test&gt;" to "<test>"

Parameters
strText to convert
szText length
retConverted text is stored here

◆ encodeEntities()

bool sptk::xdoc::XMLDocType::encodeEntities ( const char *  str,
Buffer ret 
)

Encodes string to XML representation.

Converts "<test>" to "&lt;test&gt;"

Returns
true, any entities replaced.
Parameters
strString to convert
retConverted text is stored here

◆ entities() [1/2]

Entities & sptk::xdoc::XMLDocType::entities ( )
inline

Returns a map of all entities described in the DTD

NOTE: Map doesn't hold default entities.

◆ entities() [2/2]

const Entities & sptk::xdoc::XMLDocType::entities ( ) const
inline

Returns a map of all entities described in the DTD

NOTE: Map doesn't hold default entities.

◆ getReplacement()

const char * sptk::xdoc::XMLDocType::getReplacement ( const char *  name,
uint32_t &  replacementLength 
)

Returnes replacement value for named entity.

If entity is not found, empty string is returned.

Parameters
nameEntity name
replacementLengthLength of the replacement

◆ name()

const String & sptk::xdoc::XMLDocType::name ( ) const
inline

Returns the name of the document type as specified in the <!DOCTYPE name> tag

◆ publicID()

const String & sptk::xdoc::XMLDocType::publicID ( ) const
inline

Returns the public identifier of the external DTD subset

Returns empty string if there is no public identifier

◆ removeEntity()

void sptk::xdoc::XMLDocType::removeEntity ( const char *  name)
inline

Removes named entity from entity map

Parameters
nameEntity to remove

◆ setEntity()

void sptk::xdoc::XMLDocType::setEntity ( const String name,
const String replacement 
)
inline

Adds an entity to the map

If entity named 'name' exists already in map, its value is replaced with 'replacement'

Parameters
nameEntity to add/change
replacementValue that represents entity

◆ systemID()

const String & sptk::xdoc::XMLDocType::systemID ( ) const
inline

Returns the system identifier of the external DTD subset.

Returns empty string if there is no system identifier


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

Fri Oct 14 2022 09:58:49: SPTK 5.4.1