You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.6 KiB

4 years ago
  1. /*
  2. * Summary: interface for the XML entities handling
  3. * Description: this module provides some of the entity API needed
  4. * for the parser and applications.
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Daniel Veillard
  9. */
  10. #ifndef __XML_ENTITIES_H__
  11. #define __XML_ENTITIES_H__
  12. #include <libxml/xmlversion.h>
  13. #include <libxml/tree.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*
  18. * The different valid entity types.
  19. */
  20. typedef enum {
  21. XML_INTERNAL_GENERAL_ENTITY = 1,
  22. XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
  23. XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
  24. XML_INTERNAL_PARAMETER_ENTITY = 4,
  25. XML_EXTERNAL_PARAMETER_ENTITY = 5,
  26. XML_INTERNAL_PREDEFINED_ENTITY = 6
  27. } xmlEntityType;
  28. /*
  29. * An unit of storage for an entity, contains the string, the value
  30. * and the linkind data needed for the linking in the hash table.
  31. */
  32. struct _xmlEntity {
  33. void *_private; /* application data */
  34. xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
  35. const xmlChar *name; /* Entity name */
  36. struct _xmlNode *children; /* First child link */
  37. struct _xmlNode *last; /* Last child link */
  38. struct _xmlDtd *parent; /* -> DTD */
  39. struct _xmlNode *next; /* next sibling link */
  40. struct _xmlNode *prev; /* previous sibling link */
  41. struct _xmlDoc *doc; /* the containing document */
  42. xmlChar *orig; /* content without ref substitution */
  43. xmlChar *content; /* content or ndata if unparsed */
  44. int length; /* the content length */
  45. xmlEntityType etype; /* The entity type */
  46. const xmlChar *ExternalID; /* External identifier for PUBLIC */
  47. const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
  48. struct _xmlEntity *nexte; /* unused */
  49. const xmlChar *URI; /* the full URI as computed */
  50. int owner; /* does the entity own the childrens */
  51. int checked; /* was the entity content checked */
  52. /* this is also used to count entities
  53. * references done from that entity
  54. * and if it contains '<' */
  55. };
  56. /*
  57. * All entities are stored in an hash table.
  58. * There is 2 separate hash tables for global and parameter entities.
  59. */
  60. typedef struct _xmlHashTable xmlEntitiesTable;
  61. typedef xmlEntitiesTable *xmlEntitiesTablePtr;
  62. /*
  63. * External functions:
  64. */
  65. #ifdef LIBXML_LEGACY_ENABLED
  66. XMLPUBFUN void XMLCALL
  67. xmlInitializePredefinedEntities (void);
  68. #endif /* LIBXML_LEGACY_ENABLED */
  69. XMLPUBFUN xmlEntityPtr XMLCALL
  70. xmlNewEntity (xmlDocPtr doc,
  71. const xmlChar *name,
  72. int type,
  73. const xmlChar *ExternalID,
  74. const xmlChar *SystemID,
  75. const xmlChar *content);
  76. XMLPUBFUN xmlEntityPtr XMLCALL
  77. xmlAddDocEntity (xmlDocPtr doc,
  78. const xmlChar *name,
  79. int type,
  80. const xmlChar *ExternalID,
  81. const xmlChar *SystemID,
  82. const xmlChar *content);
  83. XMLPUBFUN xmlEntityPtr XMLCALL
  84. xmlAddDtdEntity (xmlDocPtr doc,
  85. const xmlChar *name,
  86. int type,
  87. const xmlChar *ExternalID,
  88. const xmlChar *SystemID,
  89. const xmlChar *content);
  90. XMLPUBFUN xmlEntityPtr XMLCALL
  91. xmlGetPredefinedEntity (const xmlChar *name);
  92. XMLPUBFUN xmlEntityPtr XMLCALL
  93. xmlGetDocEntity (const xmlDoc *doc,
  94. const xmlChar *name);
  95. XMLPUBFUN xmlEntityPtr XMLCALL
  96. xmlGetDtdEntity (xmlDocPtr doc,
  97. const xmlChar *name);
  98. XMLPUBFUN xmlEntityPtr XMLCALL
  99. xmlGetParameterEntity (xmlDocPtr doc,
  100. const xmlChar *name);
  101. #ifdef LIBXML_LEGACY_ENABLED
  102. XMLPUBFUN const xmlChar * XMLCALL
  103. xmlEncodeEntities (xmlDocPtr doc,
  104. const xmlChar *input);
  105. #endif /* LIBXML_LEGACY_ENABLED */
  106. XMLPUBFUN xmlChar * XMLCALL
  107. xmlEncodeEntitiesReentrant(xmlDocPtr doc,
  108. const xmlChar *input);
  109. XMLPUBFUN xmlChar * XMLCALL
  110. xmlEncodeSpecialChars (const xmlDoc *doc,
  111. const xmlChar *input);
  112. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  113. xmlCreateEntitiesTable (void);
  114. #ifdef LIBXML_TREE_ENABLED
  115. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  116. xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
  117. #endif /* LIBXML_TREE_ENABLED */
  118. XMLPUBFUN void XMLCALL
  119. xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
  120. #ifdef LIBXML_OUTPUT_ENABLED
  121. XMLPUBFUN void XMLCALL
  122. xmlDumpEntitiesTable (xmlBufferPtr buf,
  123. xmlEntitiesTablePtr table);
  124. XMLPUBFUN void XMLCALL
  125. xmlDumpEntityDecl (xmlBufferPtr buf,
  126. xmlEntityPtr ent);
  127. #endif /* LIBXML_OUTPUT_ENABLED */
  128. #ifdef LIBXML_LEGACY_ENABLED
  129. XMLPUBFUN void XMLCALL
  130. xmlCleanupPredefinedEntities(void);
  131. #endif /* LIBXML_LEGACY_ENABLED */
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. # endif /* __XML_ENTITIES_H__ */