Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * entities.h : interface for the XML entities handking |
| 3 | * |
| 4 | * See Copyright for the status of this software. |
| 5 | * |
| 6 | * Daniel.Veillard@w3.org |
| 7 | */ |
| 8 | |
| 9 | #ifndef __XML_ENTITIES_H__ |
| 10 | #define __XML_ENTITIES_H__ |
| 11 | |
| 12 | #include <libxml/tree.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /* |
| 19 | * The different valid entity types |
| 20 | */ |
| 21 | typedef enum { |
| 22 | XML_INTERNAL_GENERAL_ENTITY = 1, |
| 23 | XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, |
| 24 | XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, |
| 25 | XML_INTERNAL_PARAMETER_ENTITY = 4, |
| 26 | XML_EXTERNAL_PARAMETER_ENTITY = 5, |
| 27 | XML_INTERNAL_PREDEFINED_ENTITY = 6 |
| 28 | } xmlEntityType; |
| 29 | |
| 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 | |
| 35 | typedef struct _xmlEntity xmlEntity; |
| 36 | typedef xmlEntity *xmlEntityPtr; |
| 37 | struct _xmlEntity { |
| 38 | #ifndef XML_WITHOUT_CORBA |
| 39 | void *_private; /* for Corba, must be first ! */ |
| 40 | #endif |
| 41 | xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ |
| 42 | const xmlChar *name; /* Attribute name */ |
| 43 | struct _xmlNode *children; /* NULL */ |
| 44 | struct _xmlNode *last; /* NULL */ |
| 45 | struct _xmlDtd *parent; /* -> DTD */ |
| 46 | struct _xmlNode *next; /* next sibling link */ |
| 47 | struct _xmlNode *prev; /* previous sibling link */ |
| 48 | struct _xmlDoc *doc; /* the containing document */ |
| 49 | |
| 50 | xmlChar *orig; /* content without ref substitution */ |
| 51 | xmlChar *content; /* content or ndata if unparsed */ |
| 52 | int length; /* the content length */ |
| 53 | xmlEntityType etype; /* The entity type */ |
| 54 | const xmlChar *ExternalID; /* External identifier for PUBLIC */ |
| 55 | const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ |
| 56 | |
| 57 | struct _xmlEntity *nexte; /* unused */ |
| 58 | const xmlChar *URI; /* the full URI as computed */ |
| 59 | }; |
| 60 | |
| 61 | /* |
| 62 | * ALl entities are stored in an hash table |
| 63 | * there is 2 separate hash tables for global and parmeter entities |
| 64 | */ |
| 65 | |
| 66 | typedef struct _xmlHashTable xmlEntitiesTable; |
| 67 | typedef xmlEntitiesTable *xmlEntitiesTablePtr; |
| 68 | |
| 69 | /* |
| 70 | * External functions : |
| 71 | */ |
| 72 | |
| 73 | void xmlInitializePredefinedEntities (void); |
| 74 | xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc, |
| 75 | const xmlChar *name, |
| 76 | int type, |
| 77 | const xmlChar *ExternalID, |
| 78 | const xmlChar *SystemID, |
| 79 | const xmlChar *content); |
| 80 | xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc, |
| 81 | const xmlChar *name, |
| 82 | int type, |
| 83 | const xmlChar *ExternalID, |
| 84 | const xmlChar *SystemID, |
| 85 | const xmlChar *content); |
| 86 | xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name); |
| 87 | xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc, |
| 88 | const xmlChar *name); |
| 89 | xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc, |
| 90 | const xmlChar *name); |
| 91 | xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc, |
| 92 | const xmlChar *name); |
| 93 | const xmlChar * xmlEncodeEntities (xmlDocPtr doc, |
| 94 | const xmlChar *input); |
| 95 | xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc, |
| 96 | const xmlChar *input); |
| 97 | xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc, |
| 98 | const xmlChar *input); |
| 99 | xmlEntitiesTablePtr xmlCreateEntitiesTable (void); |
| 100 | xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table); |
| 101 | void xmlFreeEntitiesTable (xmlEntitiesTablePtr table); |
| 102 | void xmlDumpEntitiesTable (xmlBufferPtr buf, |
| 103 | xmlEntitiesTablePtr table); |
| 104 | void xmlDumpEntityDecl (xmlBufferPtr buf, |
| 105 | xmlEntityPtr ent); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 106 | void xmlCleanupPredefinedEntities(void); |
| 107 | |
| 108 | |
| 109 | #ifdef __cplusplus |
| 110 | } |
| 111 | #endif |
| 112 | |
| 113 | # endif /* __XML_ENTITIES_H__ */ |