entities.h

Go to the documentation of this file.
00001 /*
00002  * Summary: interface for the XML entities handling
00003  * Description: this module provides some of the entity API needed
00004  *              for the parser and applications.
00005  *
00006  * Copy: See Copyright for the status of this software.
00007  *
00008  * Author: Daniel Veillard
00009  */
00010 
00011 #ifndef __XML_ENTITIES_H__
00012 #define __XML_ENTITIES_H__
00013 
00014 #include <libxml/xmlversion.h>
00015 #include <libxml/tree.h>
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 /*
00022  * The different valid entity types.
00023  */
00024 typedef enum {
00025     XML_INTERNAL_GENERAL_ENTITY = 1,
00026     XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
00027     XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
00028     XML_INTERNAL_PARAMETER_ENTITY = 4,
00029     XML_EXTERNAL_PARAMETER_ENTITY = 5,
00030     XML_INTERNAL_PREDEFINED_ENTITY = 6
00031 } xmlEntityType;
00032 
00033 /*
00034  * An unit of storage for an entity, contains the string, the value
00035  * and the linkind data needed for the linking in the hash table.
00036  */
00037 
00038 struct _xmlEntity {
00039     void           *_private;           /* application data */
00040     xmlElementType          type;       /* XML_ENTITY_DECL, must be second ! */
00041     const xmlChar          *name;   /* Entity name */
00042     struct _xmlNode    *children;   /* First child link */
00043     struct _xmlNode        *last;   /* Last child link */
00044     struct _xmlDtd       *parent;   /* -> DTD */
00045     struct _xmlNode        *next;   /* next sibling link  */
00046     struct _xmlNode        *prev;   /* previous sibling link  */
00047     struct _xmlDoc          *doc;       /* the containing document */
00048 
00049     xmlChar                *orig;   /* content without ref substitution */
00050     xmlChar             *content;   /* content or ndata if unparsed */
00051     int                   length;   /* the content length */
00052     xmlEntityType          etype;   /* The entity type */
00053     const xmlChar    *ExternalID;   /* External identifier for PUBLIC */
00054     const xmlChar      *SystemID;   /* URI for a SYSTEM or PUBLIC Entity */
00055 
00056     struct _xmlEntity     *nexte;   /* unused */
00057     const xmlChar           *URI;   /* the full URI as computed */
00058     int                    owner;   /* does the entity own the childrens */
00059     int          checked;   /* was the entity content checked */
00060 };
00061 
00062 /*
00063  * All entities are stored in an hash table.
00064  * There is 2 separate hash tables for global and parameter entities.
00065  */
00066 
00067 typedef struct _xmlHashTable xmlEntitiesTable;
00068 typedef xmlEntitiesTable *xmlEntitiesTablePtr;
00069 
00070 /*
00071  * External functions:
00072  */
00073 
00074 #ifdef LIBXML_LEGACY_ENABLED
00075 XMLPUBFUN void XMLCALL      
00076         xmlInitializePredefinedEntities (void);
00077 #endif /* LIBXML_LEGACY_ENABLED */
00078 XMLPUBFUN xmlEntityPtr XMLCALL
00079             xmlAddDocEntity     (xmlDocPtr doc,
00080                          const xmlChar *name,
00081                          int type,
00082                          const xmlChar *ExternalID,
00083                          const xmlChar *SystemID,
00084                          const xmlChar *content);
00085 XMLPUBFUN xmlEntityPtr XMLCALL      
00086             xmlAddDtdEntity     (xmlDocPtr doc,
00087                          const xmlChar *name,
00088                          int type,
00089                          const xmlChar *ExternalID,
00090                          const xmlChar *SystemID,
00091                          const xmlChar *content);
00092 XMLPUBFUN xmlEntityPtr XMLCALL      
00093             xmlGetPredefinedEntity  (const xmlChar *name);
00094 XMLPUBFUN xmlEntityPtr XMLCALL      
00095             xmlGetDocEntity     (xmlDocPtr doc,
00096                          const xmlChar *name);
00097 XMLPUBFUN xmlEntityPtr XMLCALL      
00098             xmlGetDtdEntity     (xmlDocPtr doc,
00099                          const xmlChar *name);
00100 XMLPUBFUN xmlEntityPtr XMLCALL      
00101             xmlGetParameterEntity   (xmlDocPtr doc,
00102                          const xmlChar *name);
00103 #ifdef LIBXML_LEGACY_ENABLED
00104 XMLPUBFUN const xmlChar * XMLCALL       
00105             xmlEncodeEntities   (xmlDocPtr doc,
00106                          const xmlChar *input);
00107 #endif /* LIBXML_LEGACY_ENABLED */
00108 XMLPUBFUN xmlChar * XMLCALL     
00109             xmlEncodeEntitiesReentrant(xmlDocPtr doc,
00110                          const xmlChar *input);
00111 XMLPUBFUN xmlChar * XMLCALL     
00112             xmlEncodeSpecialChars   (xmlDocPtr doc,
00113                          const xmlChar *input);
00114 XMLPUBFUN xmlEntitiesTablePtr XMLCALL   
00115             xmlCreateEntitiesTable  (void);
00116 #ifdef LIBXML_TREE_ENABLED
00117 XMLPUBFUN xmlEntitiesTablePtr XMLCALL   
00118             xmlCopyEntitiesTable    (xmlEntitiesTablePtr table);
00119 #endif /* LIBXML_TREE_ENABLED */
00120 XMLPUBFUN void XMLCALL          
00121             xmlFreeEntitiesTable    (xmlEntitiesTablePtr table);
00122 #ifdef LIBXML_OUTPUT_ENABLED
00123 XMLPUBFUN void XMLCALL          
00124             xmlDumpEntitiesTable    (xmlBufferPtr buf,
00125                          xmlEntitiesTablePtr table);
00126 XMLPUBFUN void XMLCALL          
00127             xmlDumpEntityDecl   (xmlBufferPtr buf,
00128                          xmlEntityPtr ent);
00129 #endif /* LIBXML_OUTPUT_ENABLED */
00130 #ifdef LIBXML_LEGACY_ENABLED
00131 XMLPUBFUN void XMLCALL          
00132             xmlCleanupPredefinedEntities(void);
00133 #endif /* LIBXML_LEGACY_ENABLED */
00134 
00135 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 # endif /* __XML_ENTITIES_H__ */
footer
 SourceForge.net Logo