entities.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. #define XML_TREE_INTERNALS
  14. #include <libxml/tree.h>
  15. #undef XML_TREE_INTERNALS
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /*
  20. * The different valid entity types.
  21. */
  22. typedef enum {
  23. XML_INTERNAL_GENERAL_ENTITY = 1,
  24. XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
  25. XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
  26. XML_INTERNAL_PARAMETER_ENTITY = 4,
  27. XML_EXTERNAL_PARAMETER_ENTITY = 5,
  28. XML_INTERNAL_PREDEFINED_ENTITY = 6
  29. } xmlEntityType;
  30. /*
  31. * An unit of storage for an entity, contains the string, the value
  32. * and the linkind data needed for the linking in the hash table.
  33. */
  34. struct _xmlEntity {
  35. void *_private; /* application data */
  36. xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
  37. const xmlChar *name; /* Entity name */
  38. struct _xmlNode *children; /* First child link */
  39. struct _xmlNode *last; /* Last child link */
  40. struct _xmlDtd *parent; /* -> DTD */
  41. struct _xmlNode *next; /* next sibling link */
  42. struct _xmlNode *prev; /* previous sibling link */
  43. struct _xmlDoc *doc; /* the containing document */
  44. xmlChar *orig; /* content without ref substitution */
  45. xmlChar *content; /* content or ndata if unparsed */
  46. int length; /* the content length */
  47. xmlEntityType etype; /* The entity type */
  48. const xmlChar *ExternalID; /* External identifier for PUBLIC */
  49. const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
  50. struct _xmlEntity *nexte; /* unused */
  51. const xmlChar *URI; /* the full URI as computed */
  52. int owner; /* does the entity own the childrens */
  53. int flags; /* various flags */
  54. unsigned long expandedSize; /* expanded size */
  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. XML_DEPRECATED
  67. XMLPUBFUN void
  68. xmlInitializePredefinedEntities (void);
  69. #endif /* LIBXML_LEGACY_ENABLED */
  70. XMLPUBFUN xmlEntityPtr
  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 void
  78. xmlFreeEntity (xmlEntityPtr entity);
  79. XMLPUBFUN xmlEntityPtr
  80. xmlAddDocEntity (xmlDocPtr doc,
  81. const xmlChar *name,
  82. int type,
  83. const xmlChar *ExternalID,
  84. const xmlChar *SystemID,
  85. const xmlChar *content);
  86. XMLPUBFUN xmlEntityPtr
  87. xmlAddDtdEntity (xmlDocPtr doc,
  88. const xmlChar *name,
  89. int type,
  90. const xmlChar *ExternalID,
  91. const xmlChar *SystemID,
  92. const xmlChar *content);
  93. XMLPUBFUN xmlEntityPtr
  94. xmlGetPredefinedEntity (const xmlChar *name);
  95. XMLPUBFUN xmlEntityPtr
  96. xmlGetDocEntity (const xmlDoc *doc,
  97. const xmlChar *name);
  98. XMLPUBFUN xmlEntityPtr
  99. xmlGetDtdEntity (xmlDocPtr doc,
  100. const xmlChar *name);
  101. XMLPUBFUN xmlEntityPtr
  102. xmlGetParameterEntity (xmlDocPtr doc,
  103. const xmlChar *name);
  104. #ifdef LIBXML_LEGACY_ENABLED
  105. XML_DEPRECATED
  106. XMLPUBFUN const xmlChar *
  107. xmlEncodeEntities (xmlDocPtr doc,
  108. const xmlChar *input);
  109. #endif /* LIBXML_LEGACY_ENABLED */
  110. XMLPUBFUN xmlChar *
  111. xmlEncodeEntitiesReentrant(xmlDocPtr doc,
  112. const xmlChar *input);
  113. XMLPUBFUN xmlChar *
  114. xmlEncodeSpecialChars (const xmlDoc *doc,
  115. const xmlChar *input);
  116. XMLPUBFUN xmlEntitiesTablePtr
  117. xmlCreateEntitiesTable (void);
  118. #ifdef LIBXML_TREE_ENABLED
  119. XMLPUBFUN xmlEntitiesTablePtr
  120. xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
  121. #endif /* LIBXML_TREE_ENABLED */
  122. XMLPUBFUN void
  123. xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
  124. #ifdef LIBXML_OUTPUT_ENABLED
  125. XMLPUBFUN void
  126. xmlDumpEntitiesTable (xmlBufferPtr buf,
  127. xmlEntitiesTablePtr table);
  128. XMLPUBFUN void
  129. xmlDumpEntityDecl (xmlBufferPtr buf,
  130. xmlEntityPtr ent);
  131. #endif /* LIBXML_OUTPUT_ENABLED */
  132. #ifdef LIBXML_LEGACY_ENABLED
  133. XMLPUBFUN void
  134. xmlCleanupPredefinedEntities(void);
  135. #endif /* LIBXML_LEGACY_ENABLED */
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. # endif /* __XML_ENTITIES_H__ */