entities.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. };
  53. /*
  54. * All entities are stored in an hash table.
  55. * There is 2 separate hash tables for global and parameter entities.
  56. */
  57. typedef struct _xmlHashTable xmlEntitiesTable;
  58. typedef xmlEntitiesTable *xmlEntitiesTablePtr;
  59. /*
  60. * External functions:
  61. */
  62. #ifdef LIBXML_LEGACY_ENABLED
  63. XMLPUBFUN void XMLCALL
  64. xmlInitializePredefinedEntities (void);
  65. #endif /* LIBXML_LEGACY_ENABLED */
  66. XMLPUBFUN xmlEntityPtr XMLCALL
  67. xmlAddDocEntity (xmlDocPtr doc,
  68. const xmlChar *name,
  69. int type,
  70. const xmlChar *ExternalID,
  71. const xmlChar *SystemID,
  72. const xmlChar *content);
  73. XMLPUBFUN xmlEntityPtr XMLCALL
  74. xmlAddDtdEntity (xmlDocPtr doc,
  75. const xmlChar *name,
  76. int type,
  77. const xmlChar *ExternalID,
  78. const xmlChar *SystemID,
  79. const xmlChar *content);
  80. XMLPUBFUN xmlEntityPtr XMLCALL
  81. xmlGetPredefinedEntity (const xmlChar *name);
  82. XMLPUBFUN xmlEntityPtr XMLCALL
  83. xmlGetDocEntity (xmlDocPtr doc,
  84. const xmlChar *name);
  85. XMLPUBFUN xmlEntityPtr XMLCALL
  86. xmlGetDtdEntity (xmlDocPtr doc,
  87. const xmlChar *name);
  88. XMLPUBFUN xmlEntityPtr XMLCALL
  89. xmlGetParameterEntity (xmlDocPtr doc,
  90. const xmlChar *name);
  91. #ifdef LIBXML_LEGACY_ENABLED
  92. XMLPUBFUN const xmlChar * XMLCALL
  93. xmlEncodeEntities (xmlDocPtr doc,
  94. const xmlChar *input);
  95. #endif /* LIBXML_LEGACY_ENABLED */
  96. XMLPUBFUN xmlChar * XMLCALL
  97. xmlEncodeEntitiesReentrant(xmlDocPtr doc,
  98. const xmlChar *input);
  99. XMLPUBFUN xmlChar * XMLCALL
  100. xmlEncodeSpecialChars (xmlDocPtr doc,
  101. const xmlChar *input);
  102. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  103. xmlCreateEntitiesTable (void);
  104. #ifdef LIBXML_TREE_ENABLED
  105. XMLPUBFUN xmlEntitiesTablePtr XMLCALL
  106. xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
  107. #endif /* LIBXML_TREE_ENABLED */
  108. XMLPUBFUN void XMLCALL
  109. xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
  110. #ifdef LIBXML_OUTPUT_ENABLED
  111. XMLPUBFUN void XMLCALL
  112. xmlDumpEntitiesTable (xmlBufferPtr buf,
  113. xmlEntitiesTablePtr table);
  114. XMLPUBFUN void XMLCALL
  115. xmlDumpEntityDecl (xmlBufferPtr buf,
  116. xmlEntityPtr ent);
  117. #endif /* LIBXML_OUTPUT_ENABLED */
  118. #ifdef LIBXML_LEGACY_ENABLED
  119. XMLPUBFUN void XMLCALL
  120. xmlCleanupPredefinedEntities(void);
  121. #endif /* LIBXML_LEGACY_ENABLED */
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. # endif /* __XML_ENTITIES_H__ */