Xport Interface: parser::add_entity

Adds an entity reference to be used by the parser for possible conversion operations.

xhtml_document_type parser::add_entity(
  char chr,
  short num,
  const std::string& named_ref,
  xhtml_entity_appearance appearance
);

Parameters

chr

The character representation of the entity. Many entities can not be specified as a valid character, so the character's hex representation may be used, such as '\\xA2' for the cent character.

num

The numeric value for the character entity reference.

named_ref

The name reference for the character entity. For example, &lt; is the named reference for '<'.

appearance

An enumerator of xhtml_entity_appearance which specifies how the character entity will be displayed in the output document. Valid enuerators are unaltered, character_entity, numeric_entity, and named_entity.

Returns

Returns an xhtml_document_type enumerator, which specifies the type of document. Values (enumerators) of xhtml_document_type are dt_strict, dt_transitional, dt_frameset, and dt_unknown.

Remarks

This operation is used to add entities to watch for in the parsed input stream or file, and to specify how they will be displayed on the resulting document. A list of the most common character entity references are included by default in the parser. This list is displayed below, with their default appearance. The appearance of these and any entities can be modified with the operation parser::entity_appearance(). For the parser to convert entities from one type to another, the convert_entity option must be set, using the operation parser::option().

The list below displays the common character entity references which are automatically included in parser by default.

Entity char Entity # Entity name Default appearance
" 34 quot named_entity
& 38 amp named_entity
< 60 lt named_entity
> 62 gt named_entity
(space) 160 nbsp unaltered
¡ 161 iexcl named_entity
¤ 164 curren named_entity
¢ 162 cent named_entity
£ 163 pound named_entity
¥ 165 yen named_entity
¦ 166 brvbar named_entity
§ 167 sect named_entity
¨ 168 uml named_entity
© 169 copy named_entity
ª 170 ordf named_entity
« 171 laquo named_entity
¬ 172 not named_entity
® 174 reg named_entity
¯ 175 macr named_entity
° 176 deg named_entity
± 177 plusmn named_entity
² 178 sup2 named_entity
³ 179 sup3 named_entity
´ 180 acute named_entity
µ 181 micro named_entity
182 para named_entity
· 183 middot named_entity
¸ 184 cedil named_entity
&supl; 185 supl named_entity
º 186 ordm named_entity
» 187 raquo named_entity
¼ 188 frac14 named_entity
½ 189 frac12 named_entity
¾ 190 frac34 named_entity
¿ 191 iquest named_entity
× 215 times named_entity
÷ 247 divide named_entity

Complexity

Logarithmic

Example

Work Time Studio

Datasoft Solutions is proud to present their landmark product, Work Time Studio. Utilizing the tree container library, Work Time Studio provides unparalleled features in personal time, project and task management software. If you're looking for a way to increase your productivity, visit Work Time Studio's product website, and start being more productive today.