Annotation of XML/entities.h, revision 1.40
1.1 httpng 1: /*
2: * entities.h : interface for the XML entities handking
1.4 veillard 3: *
4: * See Copyright for the status of this software.
5: *
1.16 daniel 6: * Daniel.Veillard@w3.org
1.1 httpng 7: */
8:
9: #ifndef __XML_ENTITIES_H__
10: #define __XML_ENTITIES_H__
1.12 daniel 11:
1.37 daniel 12: #include <libxml/tree.h>
1.1 httpng 13:
1.5 daniel 14: #ifdef __cplusplus
15: extern "C" {
16: #endif
17:
1.33 daniel 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;
1.6 daniel 29:
1.1 httpng 30: /*
1.2 httpng 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:
1.30 daniel 35: typedef struct _xmlEntity xmlEntity;
36: typedef xmlEntity *xmlEntityPtr;
37: struct _xmlEntity {
1.31 daniel 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 */
1.33 daniel 53: xmlEntityType etype; /* The entity type */
1.31 daniel 54: const xmlChar *ExternalID; /* External identifier for PUBLIC */
55: const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
1.35 daniel 56:
1.39 veillard 57: struct _xmlEntity *nexte; /* next entity in the hash table */
1.40 ! veillard 58: const xmlChar *URI; /* the full URI as computed */
1.39 veillard 59:
1.36 daniel 60: #ifdef WITH_EXTRA_ENT_DETECT
1.35 daniel 61: /* Referenced entities name stack */
62: xmlChar *ent; /* Current parsed Node */
63: int entNr; /* Depth of the parsing stack */
64: int entMax; /* Max depth of the parsing stack */
65: xmlChar * *entTab; /* array of nodes */
1.36 daniel 66: #endif
1.30 daniel 67: };
1.2 httpng 68:
69: /*
70: * ALl entities are stored in a table there is one table per DTD
71: * and one extra per document.
72: */
73:
74: #define XML_MIN_ENTITIES_TABLE 32
75:
1.30 daniel 76: typedef struct _xmlEntitiesTable xmlEntitiesTable;
77: typedef xmlEntitiesTable *xmlEntitiesTablePtr;
78: struct _xmlEntitiesTable {
1.2 httpng 79: int nb_entities; /* number of elements stored */
80: int max_entities; /* maximum number of elements */
1.32 daniel 81: xmlEntityPtr *table; /* the table of entities */
1.30 daniel 82: };
1.2 httpng 83:
1.12 daniel 84:
1.2 httpng 85: /*
1.1 httpng 86: * External functions :
87: */
1.18 daniel 88:
1.32 daniel 89: xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
1.25 daniel 90: const xmlChar *name,
1.24 daniel 91: int type,
1.25 daniel 92: const xmlChar *ExternalID,
93: const xmlChar *SystemID,
94: const xmlChar *content);
1.32 daniel 95: xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc,
1.25 daniel 96: const xmlChar *name,
1.24 daniel 97: int type,
1.25 daniel 98: const xmlChar *ExternalID,
99: const xmlChar *SystemID,
100: const xmlChar *content);
101: xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
1.24 daniel 102: xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
1.25 daniel 103: const xmlChar *name);
1.24 daniel 104: xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
1.25 daniel 105: const xmlChar *name);
1.24 daniel 106: xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
1.25 daniel 107: const xmlChar *name);
108: const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
109: const xmlChar *input);
1.26 daniel 110: xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
1.25 daniel 111: const xmlChar *input);
1.38 daniel 112: xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc,
113: const xmlChar *input);
1.24 daniel 114: xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
115: xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
116: void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
117: void xmlDumpEntitiesTable (xmlBufferPtr buf,
118: xmlEntitiesTablePtr table);
1.34 daniel 119: void xmlDumpEntityDecl (xmlBufferPtr buf,
120: xmlEntityPtr ent);
1.24 daniel 121: xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
1.27 daniel 122: void xmlCleanupPredefinedEntities(void);
1.5 daniel 123:
1.36 daniel 124: #ifdef WITH_EXTRA_ENT_DETECT
1.35 daniel 125: int xmlEntityAddReference (xmlEntityPtr ent,
126: const xmlChar *to);
1.36 daniel 127: #endif
128:
1.5 daniel 129: #ifdef __cplusplus
130: }
131: #endif
1.1 httpng 132:
133: # endif /* __XML_ENTITIES_H__ */
Webmaster