entities.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. }
  28. xmlEntityType;
  29. /*
  30. * An unit of storage for an entity, contains the string, the value
  31. * and the linkind data needed for the linking in the hash table.
  32. */
  33. struct _xmlEntity {
  34. void *_private; /* application data */
  35. xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
  36. const xmlChar *name; /* Entity name */
  37. struct _xmlNode *children; /* First child link */
  38. struct _xmlNode *last; /* Last child link */
  39. struct _xmlDtd *parent; /* -> DTD */
  40. struct _xmlNode *next; /* next sibling link */
  41. struct _xmlNode *prev; /* previous sibling link */
  42. struct _xmlDoc *doc; /* the containing document */
  43. xmlChar *orig; /* content without ref substitution */
  44. xmlChar *content; /* content or ndata if unparsed */
  45. int length; /* the content length */
  46. xmlEntityType etype; /* The entity type */
  47. const xmlChar *ExternalID; /* External identifier for PUBLIC */
  48. const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
  49. struct _xmlEntity *nexte; /* unused */
  50. const xmlChar *URI; /* the full URI as computed */
  51. int owner; /* does the entity own the childrens */
  52. int checked; /* was the entity content checked */
  53. /* this is also used to count entites
  54. * references done from that entity
  55. * and if it contains '<' */
  56. };
  57. /*
  58. * All entities are stored in an hash table.
  59. * There is 2 separate hash tables for global and parameter entities.
  60. */
  61. typedef struct _xmlHashTable xmlEntitiesTable;
  62. typedef xmlEntitiesTable *xmlEntitiesTablePtr;
  63. /*
  64. * External functions:
  65. */
  66. #ifdef LIBXML_LEGACY_ENABLED
  67. XMLPUBFUN void XMLCALL
  68. xmlInitializePredefinedEntities (void);
  69. #endif /* LIBXML_LEGACY_ENABLED */
  70. XMLPUBFUN xmlEntityPtr XMLCALL
  71. xmlNewEntity (xmlDocPtr doc,
  72. const xmlChar *name,
  73. int type,
  74. const xmlChar *ExternalID,
  75. const xmlChar *SystemID,
  76. const xmlChar *content);
  77. XMLPUBFUN xmlEntityPtr XMLCALL
  78. xmlAddDocEntity (xmlDocPtr doc,
  79. const xmlChar *name,
  80. int type,
  81. const xmlChar *ExternalID,
  82. const xmlChar *SystemID,
  83. const xmlChar *content);
  84. XMLPUBFUN xmlEntityPtr XMLCALL
  85. xmlAddDtdEntity (xmlDocPtr doc,
  86. const xmlChar *name,
  87. int type,
  88. const xmlChar *ExternalID,
  89. const xmlChar *SystemID,
  90. const xmlChar *content);
  91. XMLPUBFUN xmlEntityPtr XMLCALL
  92. xmlGetPredefinedEntity (const xmlChar *name);
  93. XMLPUBFUN xmlEntityPtr XMLCALL
  94. xmlGetDocEntity (xmlDocPtr doc,
  95. const xmlChar *name);
  96. XMLPUBFUN xmlEntityPtr XMLCALL
  97. xmlGetDtdEntity (xmlDocPtr doc,
  98. const xmlChar *name);
  99. XMLPUBFUN xmlEntityPtr XMLCALL
  100. xmlGetParameterEntity (xmlDocPtr doc,
  101. const xmlChar *name);
  102. #ifdef LIBXML_LEGACY_ENABLED
  103. XMLPUBFUN const xmlChar * XMLCALL
  104. xmlEncodeEntities (xmlDocPtr doc,
  105. const xmlChar *input);
  106. #endif /* LIBXML_LEGACY_ENABLED */
  107. XMLPUBFUN xmlChar * XMLCALL
  108. xmlEncodeEntitiesReentrant(xmlDocPtr doc,
  109. const xmlChar *input);
  110. XMLPUBFUN xmlChar * XMLCALL
  111. xmlEncodeSpecialChars (xmlDocPtr doc,
  112. const xmlChar *input);
  113. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  114. xmlCreateEntitiesTable (void);
  115. #ifdef LIBXML_TREE_ENABLED
  116. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  117. xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
  118. #endif /* LIBXML_TREE_ENABLED */
  119. XMLPUBFUN void XMLCALL
  120. xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
  121. #ifdef LIBXML_OUTPUT_ENABLED
  122. XMLPUBFUN void XMLCALL
  123. xmlDumpEntitiesTable (xmlBufferPtr buf,
  124. xmlEntitiesTablePtr table);
  125. XMLPUBFUN void XMLCALL
  126. xmlDumpEntityDecl (xmlBufferPtr buf,
  127. xmlEntityPtr ent);
  128. #endif /* LIBXML_OUTPUT_ENABLED */
  129. #ifdef LIBXML_LEGACY_ENABLED
  130. XMLPUBFUN void XMLCALL
  131. xmlCleanupPredefinedEntities(void);
  132. #endif /* LIBXML_LEGACY_ENABLED */
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. # endif /* __XML_ENTITIES_H__ */