libxml2: entities.h File Reference

libxml2

Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
entities.h File Reference

XML entities. More...

## Data Structures
struct | _xmlEntity
| An entity declaration. More...

## Enumerations
enum | xmlEntityType
| The different entity types. More...

## Functions
xmlEntity * | xmlNewEntity (xmlDoc *doc, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *content)
| Create a new entity.
void | xmlFreeEntity (xmlEntity *entity)
| Frees the entity.
int | xmlAddEntity (xmlDoc *doc, int extSubset, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *content, xmlEntity **out)
| Register a new entity for this document.
xmlEntity * | xmlAddDocEntity (xmlDoc *doc, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *content)
| Add a new entity to the document's internal subset.
xmlEntity * | xmlAddDtdEntity (xmlDoc *doc, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *content)
| Add a new entity to the document's external subset.
xmlEntity * | xmlGetPredefinedEntity (const xmlChar *name)
| Look up a predefined entity.
xmlEntity * | xmlGetDocEntity (const xmlDoc *doc, const xmlChar *name)
| Look up a general entity in the internal and external subset of `doc`.
xmlEntity * | xmlGetDtdEntity (xmlDoc *doc, const xmlChar *name)
| Look up a general entity in the external subset of `doc`.
xmlEntity * | xmlGetParameterEntity (xmlDoc *doc, const xmlChar *name)
| Look up a paramater entity in the internal and external subset of `doc`.
xmlChar * | xmlEncodeEntitiesReentrant (xmlDoc *doc, const xmlChar *input)
| Replace special characters with predefined entities or numeric character references.
xmlChar * | xmlEncodeSpecialChars (const xmlDoc *doc, const xmlChar *input)
| Replace special characters with predefined entities or numeric character references.
xmlEntitiesTable * | xmlCreateEntitiesTable (void)
| Create and initialize an empty entities hash table.
xmlEntitiesTable * | xmlCopyEntitiesTable (xmlEntitiesTable *table)
| Build a copy of an entity table.
void | xmlFreeEntitiesTable (xmlEntitiesTable *table)
| Deallocate the memory used by an entities hash table.
void | xmlDumpEntitiesTable (xmlBuffer *buf, xmlEntitiesTable *table)
| This will dump the content of the entity table as an XML DTD definition.
void | xmlDumpEntityDecl (xmlBuffer *buf, xmlEntity *ent)
| This will dump the content of the entity table as an XML DTD definition.

## Detailed Description

XML entities.

This module provides an API to work with XML entities.

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Enumeration Type Documentation

## ◆ xmlEntityType

enum xmlEntityType

The different entity types.

Enumerator
XML_INTERNAL_GENERAL_ENTITY | internal general entity
XML_EXTERNAL_GENERAL_PARSED_ENTITY | external general parsed entity
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY | external general unparsed entity
XML_INTERNAL_PARAMETER_ENTITY | internal parameter entity
XML_EXTERNAL_PARAMETER_ENTITY | external parameter entity
XML_INTERNAL_PREDEFINED_ENTITY | internal predefined entity

## Function Documentation

## ◆ xmlAddDocEntity()

xmlEntity * xmlAddDocEntity | ( | xmlDoc * | doc,
|  | const xmlChar * | name,
|  | int | type,
|  | const xmlChar * | publicId,
|  | const xmlChar * | systemId,
|  | const xmlChar * | content
| ) |  |

Add a new entity to the document's internal subset.

xmlAddEntity offers better error handling.

Parameters

  doc | the document
  name | the entity name
  type | an xmlEntityType value
  publicId | the publid identifier (optional)
  systemId | the system identifier (URL) (optional)
  content | the entity content

Returns
  a pointer to the entity or NULL in case of error

## ◆ xmlAddDtdEntity()

xmlEntity * xmlAddDtdEntity | ( | xmlDoc * | doc,
|  | const xmlChar * | name,
|  | int | type,
|  | const xmlChar * | publicId,
|  | const xmlChar * | systemId,
|  | const xmlChar * | content
| ) |  |

Add a new entity to the document's external subset.

xmlAddEntity offers better error handling.

Parameters

  doc | the document
  name | the entity name
  type | an xmlEntityType value
  publicId | the publid identifier (optional)
  systemId | the system identifier (URL) (optional)
  content | the entity content

Returns
  a pointer to the entity or NULL in case of error

## ◆ xmlAddEntity()

int xmlAddEntity | ( | xmlDoc * | doc,
|  | int | extSubset,
|  | const xmlChar * | name,
|  | int | type,
|  | const xmlChar * | publicId,
|  | const xmlChar * | systemId,
|  | const xmlChar * | content,
|  | xmlEntity ** | out
| ) |  |

Register a new entity for this document.

Since
  2.13.0

Parameters

  doc | the document
  extSubset | add to the external or internal subset
  name | the entity name
  type | an xmlEntityType value
  publicId | the publid identifier (optional)
  systemId | the system identifier (URL) (optional)
  content | the entity content
  out | pointer to resulting entity (optional)

Returns
  an xmlParserErrors error code.

## ◆ xmlCopyEntitiesTable()

xmlEntitiesTable * xmlCopyEntitiesTable | ( | xmlEntitiesTable * | table | ) |

Build a copy of an entity table.

Deprecated:
  Internal function, don't use.

Parameters

  table | An entity table

Returns
  the new xmlEntitiesTable or NULL in case of error.

## ◆ xmlCreateEntitiesTable()

xmlEntitiesTable * xmlCreateEntitiesTable | ( | void |  | ) |

Create and initialize an empty entities hash table.

Deprecated:
  Internal function, don't use.

Returns
  the xmlEntitiesTable just created or NULL in case of error.

## ◆ xmlDumpEntitiesTable()

void xmlDumpEntitiesTable | ( | xmlBuffer * | buf,
|  | xmlEntitiesTable * | table
| ) |  |

This will dump the content of the entity table as an XML DTD definition.

Deprecated:
  Internal function, don't use.

Parameters

  buf | An XML buffer.
  table | An entity table

## ◆ xmlDumpEntityDecl()

void xmlDumpEntityDecl | ( | xmlBuffer * | buf,
|  | xmlEntity * | ent
| ) |  |

This will dump the content of the entity table as an XML DTD definition.

Deprecated:
  Internal function, don't use.

Parameters

  buf | An XML buffer.
  ent | An entity table

## ◆ xmlEncodeEntitiesReentrant()

xmlChar * xmlEncodeEntitiesReentrant | ( | xmlDoc * | doc,
|  | const xmlChar * | input
| ) |  |

Replace special characters with predefined entities or numeric character references.

If `doc` is NULL or an XML document, replaces `<`, `>` and `&` with predefined entities. Carriage return is replaced with `&#13;`. If `doc` or its encoding are NULL, non-ASCII characters are replaced with a hexadecimal character reference.

If `doc` is an HTML document, follows the HTML serialization rules.

Silently removes some invalid characters like ASCII control codes.

See xmlEncodeSpecialChars for an alternative.

Parameters

  doc | the document containing the string (optional)
  input | A string to convert to XML.

Returns
  a newly allocated string with substitutions.

## ◆ xmlEncodeSpecialChars()

xmlChar * xmlEncodeSpecialChars | ( | const xmlDoc * | doc,
|  | const xmlChar * | input
| ) |  |

Replace special characters with predefined entities or numeric character references.

Replaces `<`, `>`, `&` and `"` with predefined entities. Carriage return is replaced with `&#13;`.

Parameters

  doc | unused
  input | A string to convert to XML.

Returns
  a newly allocated string with substitutions.

## ◆ xmlFreeEntitiesTable()

void xmlFreeEntitiesTable | ( | xmlEntitiesTable * | table | ) |

Deallocate the memory used by an entities hash table.

Deprecated:
  Internal function, don't use.

Parameters

  table | An entity table

## ◆ xmlFreeEntity()

void xmlFreeEntity | ( | xmlEntity * | entity | ) |

Frees the entity.

Parameters

  entity | an entity

## ◆ xmlGetDocEntity()

xmlEntity * xmlGetDocEntity | ( | const xmlDoc * | doc,
|  | const xmlChar * | name
| ) |  |

Look up a general entity in the internal and external subset of `doc`.

Also checks for predefined entities.

Parameters

  doc | the document referencing the entity
  name | the entity name

Returns
  a pointer to the entity or NULL if not found.

## ◆ xmlGetDtdEntity()

xmlEntity * xmlGetDtdEntity | ( | xmlDoc * | doc,
|  | const xmlChar * | name
| ) |  |

Look up a general entity in the external subset of `doc`.

Parameters

  doc | the document
  name | the entity name

Returns
  a pointer to the entity or NULL if not found.

## ◆ xmlGetParameterEntity()

xmlEntity * xmlGetParameterEntity | ( | xmlDoc * | doc,
|  | const xmlChar * | name
| ) |  |

Look up a paramater entity in the internal and external subset of `doc`.

Parameters

  doc | the document
  name | the entity name

Returns
  a pointer to the entity or NULL if not found.

## ◆ xmlGetPredefinedEntity()

xmlEntity * xmlGetPredefinedEntity | ( | const xmlChar * | name | ) |

Look up a predefined entity.

Parameters

  name | the entity name

Returns
  the entity, or NULL if not found.

## ◆ xmlNewEntity()

xmlEntity * xmlNewEntity | ( | xmlDoc * | doc,
|  | const xmlChar * | name,
|  | int | type,
|  | const xmlChar * | publicId,
|  | const xmlChar * | systemId,
|  | const xmlChar * | content
| ) |  |

Create a new entity.

Like xmlAddDocEntity, but if `doc` is NULL or has no internal subset defined, an unlinked entity will be returned. It is then the responsibility of the caller to link it to the document later or free it when not needed anymore.

Parameters

  doc | the document (optional)
  name | the entity name
  type | an xmlEntityType value
  publicId | the publid identifier (optional)
  systemId | the system identifier (URL) (optional)
  content | the entity content

Returns
  a pointer to the entity or NULL in case of error