Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * tree.h : describes the structures found in an tree resulting |
| 3 | * from an XML parsing. |
| 4 | * |
| 5 | * See Copyright for the status of this software. |
| 6 | * |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 7 | * Daniel.Veillard@w3.org |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __XML_TREE_H__ |
| 11 | #define __XML_TREE_H__ |
| 12 | |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 18 | #include <stdio.h> |
| 19 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 20 | /* |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 21 | * The different element types carried by an XML tree |
| 22 | * |
| 23 | * NOTE: This is synchronized with DOM Level1 values |
| 24 | * See http://www.w3.org/TR/REC-DOM-Level-1/ |
| 25 | */ |
| 26 | typedef enum { |
| 27 | XML_ELEMENT_NODE= 1, |
| 28 | XML_ATTRIBUTE_NODE= 2, |
| 29 | XML_TEXT_NODE= 3, |
| 30 | XML_CDATA_SECTION_NODE= 4, |
| 31 | XML_ENTITY_REF_NODE= 5, |
| 32 | XML_ENTITY_NODE= 6, |
| 33 | XML_PI_NODE= 7, |
| 34 | XML_COMMENT_NODE= 8, |
| 35 | XML_DOCUMENT_NODE= 9, |
| 36 | XML_DOCUMENT_TYPE_NODE= 10, |
| 37 | XML_DOCUMENT_FRAG_NODE= 11, |
| 38 | XML_NOTATION_NODE= 12 |
| 39 | } xmlElementType; |
| 40 | |
| 41 | /* |
Daniel Veillard | 0ba4d53 | 1998-11-01 19:34:31 +0000 | [diff] [blame] | 42 | * Size of an internal character representation. |
| 43 | * |
| 44 | * Currently we use 8bit chars internal representation for memory efficiency, |
| 45 | * but the parser is not tied to that, just define UNICODE to switch to |
| 46 | * a 16 bits internal representation. Note that with 8 bits wide |
| 47 | * CHARs one can still use UTF-8 to handle correctly non ISO-Latin |
| 48 | * input. |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 49 | */ |
| 50 | #ifdef UNICODE |
| 51 | typedef unsigned short CHAR; |
| 52 | #else |
| 53 | typedef unsigned char CHAR; |
| 54 | #endif |
| 55 | |
| 56 | /* |
| 57 | * a DTD Notation definition |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 58 | */ |
| 59 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 60 | typedef struct xmlNotation { |
| 61 | const CHAR *name; /* Notation name */ |
| 62 | const CHAR *PublicID; /* Public identifier, if any */ |
| 63 | const CHAR *SystemID; /* System identifier, if any */ |
| 64 | } xmlNotation; |
| 65 | typedef xmlNotation *xmlNotationPtr; |
| 66 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 67 | /* |
| 68 | * a DTD Attribute definition |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 69 | */ |
| 70 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 71 | typedef enum { |
| 72 | XML_ATTRIBUTE_CDATA = 1, |
| 73 | XML_ATTRIBUTE_ID, |
| 74 | XML_ATTRIBUTE_IDREF , |
| 75 | XML_ATTRIBUTE_IDREFS, |
| 76 | XML_ATTRIBUTE_ENTITY, |
| 77 | XML_ATTRIBUTE_ENTITIES, |
| 78 | XML_ATTRIBUTE_NMTOKEN, |
| 79 | XML_ATTRIBUTE_NMTOKENS, |
| 80 | XML_ATTRIBUTE_ENUMERATION, |
| 81 | XML_ATTRIBUTE_NOTATION |
| 82 | } xmlAttributeType; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 83 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 84 | typedef enum { |
| 85 | XML_ATTRIBUTE_NONE = 1, |
| 86 | XML_ATTRIBUTE_REQUIRED, |
| 87 | XML_ATTRIBUTE_IMPLIED, |
| 88 | XML_ATTRIBUTE_FIXED |
| 89 | } xmlAttributeDefault; |
| 90 | |
| 91 | typedef struct xmlEnumeration { |
| 92 | struct xmlEnumeration *next; /* next one */ |
| 93 | const CHAR *name; /* Enumeration name */ |
| 94 | } xmlEnumeration; |
| 95 | typedef xmlEnumeration *xmlEnumerationPtr; |
| 96 | |
| 97 | typedef struct xmlAttribute { |
| 98 | const CHAR *elem; /* Element holding the attribute */ |
| 99 | const CHAR *name; /* Attribute name */ |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 100 | struct xmlAttribute *next; /* list of attributes of an element */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 101 | xmlAttributeType type; /* The type */ |
| 102 | xmlAttributeDefault def; /* the default */ |
| 103 | const CHAR *defaultValue;/* or the default value */ |
| 104 | xmlEnumerationPtr tree; /* or the enumeration tree if any */ |
| 105 | } xmlAttribute; |
| 106 | typedef xmlAttribute *xmlAttributePtr; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 107 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 108 | /* |
| 109 | * a DTD Element definition. |
| 110 | */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 111 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 112 | XML_ELEMENT_CONTENT_PCDATA = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 113 | XML_ELEMENT_CONTENT_ELEMENT, |
| 114 | XML_ELEMENT_CONTENT_SEQ, |
| 115 | XML_ELEMENT_CONTENT_OR |
| 116 | } xmlElementContentType; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 117 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 118 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 119 | XML_ELEMENT_CONTENT_ONCE = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 120 | XML_ELEMENT_CONTENT_OPT, |
| 121 | XML_ELEMENT_CONTENT_MULT, |
| 122 | XML_ELEMENT_CONTENT_PLUS |
| 123 | } xmlElementContentOccur; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 124 | |
| 125 | typedef struct xmlElementContent { |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 126 | xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ |
| 127 | xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ |
| 128 | const CHAR *name; /* Element name */ |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 129 | struct xmlElementContent *c1; /* first child */ |
| 130 | struct xmlElementContent *c2; /* second child */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 131 | } xmlElementContent; |
| 132 | typedef xmlElementContent *xmlElementContentPtr; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 133 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 134 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 135 | XML_ELEMENT_TYPE_EMPTY = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 136 | XML_ELEMENT_TYPE_ANY, |
| 137 | XML_ELEMENT_TYPE_MIXED, |
| 138 | XML_ELEMENT_TYPE_ELEMENT |
| 139 | } xmlElementTypeVal; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 140 | |
| 141 | typedef struct xmlElement { |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 142 | const CHAR *name; /* Element name */ |
| 143 | xmlElementTypeVal type; /* The type */ |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 144 | xmlElementContentPtr content; /* the allowed element content */ |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 145 | xmlAttributePtr attributes; /* List of the declared attributes */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 146 | } xmlElement; |
| 147 | typedef xmlElement *xmlElementPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 148 | |
| 149 | /* |
| 150 | * An XML namespace. |
| 151 | * Note that prefix == NULL is valid, it defines the default namespace |
| 152 | * within the subtree (until overriden). |
| 153 | */ |
| 154 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 155 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 156 | XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 157 | XML_LOCAL_NAMESPACE /* new style local scoping */ |
| 158 | } xmlNsType; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 159 | |
| 160 | typedef struct xmlNs { |
| 161 | struct xmlNs *next; /* next Ns link for this node */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 162 | xmlNsType type; /* global or local */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 163 | const CHAR *href; /* URL for the namespace */ |
| 164 | const CHAR *prefix; /* prefix for the namespace */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 165 | } xmlNs; |
| 166 | typedef xmlNs *xmlNsPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 167 | |
| 168 | /* |
| 169 | * An XML DtD, as defined by <!DOCTYPE. |
| 170 | */ |
| 171 | typedef struct xmlDtd { |
| 172 | const CHAR *name; /* Name of the DTD */ |
| 173 | const CHAR *ExternalID; /* External identifier for PUBLIC DTD */ |
| 174 | const CHAR *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 175 | void *notations; /* Hash table for notations if any */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 176 | void *elements; /* Hash table for elements if any */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 177 | void *attributes; /* Hash table for attributes if any */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 178 | void *entities; /* Hash table for entities if any */ |
| 179 | /* struct xmlDtd *next; * next link for this document */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 180 | } xmlDtd; |
| 181 | typedef xmlDtd *xmlDtdPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 182 | |
| 183 | /* |
| 184 | * A attribute of an XML node. |
| 185 | */ |
| 186 | typedef struct xmlAttr { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 187 | #ifndef XML_WITHOUT_CORBA |
| 188 | void *_private; /* for Corba, must be first ! */ |
| 189 | void *vepv; /* for Corba, must be next ! */ |
| 190 | #endif |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 191 | xmlElementType type; /* XML_ATTRIBUTE_NODE, must be third ! */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 192 | struct xmlNode *node; /* attr->node link */ |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 193 | struct xmlAttr *next; /* attribute list link */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 194 | const CHAR *name; /* the name of the property */ |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 195 | struct xmlNode *val; /* the value of the property */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 196 | } xmlAttr; |
| 197 | typedef xmlAttr *xmlAttrPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 198 | |
| 199 | /* |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame^] | 200 | * An XML ID instance. |
| 201 | */ |
| 202 | |
| 203 | typedef struct xmlID { |
| 204 | struct xmlID *next; /* next ID */ |
| 205 | const CHAR *value; /* The ID name */ |
| 206 | xmlAttrPtr attr; /* The attribut holding it */ |
| 207 | } xmlID; |
| 208 | typedef xmlID *xmlIDPtr; |
| 209 | |
| 210 | /* |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 211 | * A node in an XML tree. |
| 212 | */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 213 | typedef struct xmlNode { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 214 | #ifndef XML_WITHOUT_CORBA |
| 215 | void *_private; /* for Corba, must be first ! */ |
| 216 | void *vepv; /* for Corba, must be next ! */ |
| 217 | #endif |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 218 | xmlElementType type; /* type number in the DTD, must be third ! */ |
Daniel Veillard | 0bef131 | 1998-10-14 02:36:47 +0000 | [diff] [blame] | 219 | struct xmlDoc *doc; /* the containing document */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 220 | struct xmlNode *parent; /* child->parent link */ |
| 221 | struct xmlNode *next; /* next sibling link */ |
Daniel Veillard | 0bef131 | 1998-10-14 02:36:47 +0000 | [diff] [blame] | 222 | struct xmlNode *prev; /* previous sibling link */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 223 | struct xmlNode *childs; /* parent->childs link */ |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 224 | struct xmlNode *last; /* last child link */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 225 | struct xmlAttr *properties; /* properties list */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 226 | const CHAR *name; /* the name of the node, or the entity */ |
| 227 | xmlNs *ns; /* pointer to the associated namespace */ |
| 228 | xmlNs *nsDef; /* namespace definitions on this node */ |
| 229 | CHAR *content; /* the content */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 230 | } _xmlNode; |
| 231 | typedef _xmlNode xmlNode; |
| 232 | typedef _xmlNode *xmlNodePtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 233 | |
| 234 | /* |
| 235 | * An XML document. |
| 236 | */ |
| 237 | typedef struct xmlDoc { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 238 | #ifndef XML_WITHOUT_CORBA |
| 239 | void *_private; /* for Corba, must be first ! */ |
| 240 | void *vepv; /* for Corba, must be next ! */ |
| 241 | #endif |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 242 | xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 243 | char *name; /* name/filename/URI of the document */ |
| 244 | const CHAR *version; /* the XML version string */ |
| 245 | const CHAR *encoding; /* encoding, if any */ |
Daniel Veillard | 15a8df4 | 1998-09-24 19:15:06 +0000 | [diff] [blame] | 246 | int compression;/* level of zlib compression */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 247 | int standalone; /* standalone document (no external refs) */ |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 248 | struct xmlDtd *intSubset; /* the document internal subset */ |
| 249 | struct xmlDtd *extSubset; /* the document external subset */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 250 | struct xmlNs *oldNs; /* Global namespace, the old way */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 251 | struct xmlNode *root; /* the document tree */ |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame^] | 252 | void *ids; /* Hash table for ID attributes if any */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 253 | } _xmlDoc; |
| 254 | typedef _xmlDoc xmlDoc; |
| 255 | typedef xmlDoc *xmlDocPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 256 | |
| 257 | /* |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 258 | * A buffer structure |
| 259 | */ |
| 260 | |
| 261 | typedef struct xmlBuffer { |
| 262 | CHAR *content; /* The buffer content UTF8 */ |
| 263 | unsigned int use; /* The buffer size used */ |
| 264 | unsigned int size; /* The buffer size */ |
| 265 | } _xmlBuffer; |
| 266 | typedef _xmlBuffer xmlBuffer; |
| 267 | typedef xmlBuffer *xmlBufferPtr; |
| 268 | |
| 269 | /* |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 270 | * Variables. |
| 271 | */ |
| 272 | extern xmlNsPtr baseDTD; |
| 273 | extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ |
| 274 | extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ |
| 275 | |
| 276 | /* |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 277 | * Handling Buffers. |
| 278 | */ |
| 279 | |
| 280 | xmlBufferPtr xmlBufferCreate(void); |
| 281 | void xmlBufferFree(xmlBufferPtr buf); |
| 282 | int xmlBufferDump(FILE *file, xmlBufferPtr buf); |
| 283 | void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len); |
| 284 | void xmlBufferCat(xmlBufferPtr buf, const CHAR *str); |
| 285 | void xmlBufferCCat(xmlBufferPtr buf, const char *str); |
Daniel Veillard | e2d034d | 1999-07-27 19:52:06 +0000 | [diff] [blame] | 286 | int xmlBufferShrink(xmlBufferPtr buf, int len); |
| 287 | void xmlBufferEmpty(xmlBufferPtr buf); |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 288 | |
| 289 | /* |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 290 | * Creating/freeing new structures |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 291 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 292 | xmlDtdPtr xmlCreateIntSubset(xmlDocPtr doc, const CHAR *name, |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 293 | const CHAR *ExternalID, const CHAR *SystemID); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 294 | xmlDtdPtr xmlNewDtd(xmlDocPtr doc, const CHAR *name, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 295 | const CHAR *ExternalID, const CHAR *SystemID); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 296 | void xmlFreeDtd(xmlDtdPtr cur); |
| 297 | xmlNsPtr xmlNewGlobalNs(xmlDocPtr doc, const CHAR *href, const CHAR *prefix); |
| 298 | xmlNsPtr xmlNewNs(xmlNodePtr node, const CHAR *href, const CHAR *prefix); |
| 299 | void xmlFreeNs(xmlNsPtr cur); |
| 300 | xmlDocPtr xmlNewDoc(const CHAR *version); |
| 301 | void xmlFreeDoc(xmlDocPtr cur); |
| 302 | xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const CHAR *name, |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 303 | const CHAR *value); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 304 | xmlAttrPtr xmlNewProp(xmlNodePtr node, const CHAR *name, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 305 | const CHAR *value); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 306 | void xmlFreePropList(xmlAttrPtr cur); |
| 307 | void xmlFreeProp(xmlAttrPtr cur); |
| 308 | xmlAttrPtr xmlCopyProp(xmlAttrPtr cur); |
| 309 | xmlAttrPtr xmlCopyPropList(xmlAttrPtr cur); |
| 310 | xmlDtdPtr xmlCopyDtd(xmlDtdPtr dtd); |
| 311 | xmlDocPtr xmlCopyDoc(xmlDocPtr doc, int recursive); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 312 | |
| 313 | /* |
| 314 | * Creating new nodes |
| 315 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 316 | xmlNodePtr xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, |
Daniel Veillard | 15b75af | 1999-07-26 16:42:37 +0000 | [diff] [blame] | 317 | const CHAR *name, const CHAR *content); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 318 | xmlNodePtr xmlNewNode(xmlNsPtr ns, const CHAR *name); |
| 319 | xmlNodePtr xmlNewChild(xmlNodePtr parent, xmlNsPtr ns, |
Daniel Veillard | 15b75af | 1999-07-26 16:42:37 +0000 | [diff] [blame] | 320 | const CHAR *name, const CHAR *content); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 321 | xmlNodePtr xmlNewDocText(xmlDocPtr doc, const CHAR *content); |
| 322 | xmlNodePtr xmlNewText(const CHAR *content); |
| 323 | xmlNodePtr xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len); |
| 324 | xmlNodePtr xmlNewTextLen(const CHAR *content, int len); |
Daniel Veillard | 517752b | 1999-04-05 12:20:10 +0000 | [diff] [blame] | 325 | xmlNodePtr xmlNewDocComment(xmlDocPtr doc, const CHAR *content); |
| 326 | xmlNodePtr xmlNewComment(const CHAR *content); |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 327 | xmlNodePtr xmlNewCDataBlock(xmlDocPtr doc, const CHAR *content, int len); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 328 | xmlNodePtr xmlNewReference(xmlDocPtr doc, const CHAR *name); |
| 329 | xmlNodePtr xmlCopyNode(xmlNodePtr node, int recursive); |
| 330 | xmlNodePtr xmlCopyNodeList(xmlNodePtr node); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 331 | |
| 332 | /* |
| 333 | * Navigating |
| 334 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 335 | xmlNodePtr xmlGetLastChild(xmlNodePtr parent); |
| 336 | int xmlNodeIsText(xmlNodePtr node); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 337 | |
| 338 | /* |
| 339 | * Changing the structure |
| 340 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 341 | xmlNodePtr xmlAddChild(xmlNodePtr parent, xmlNodePtr cur); |
| 342 | void xmlUnlinkNode(xmlNodePtr cur); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 343 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 344 | xmlNodePtr xmlTextMerge(xmlNodePtr first, xmlNodePtr second); |
| 345 | void xmlTextConcat(xmlNodePtr node, const CHAR *content, int len); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 346 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 347 | void xmlFreeNodeList(xmlNodePtr cur); |
| 348 | void xmlFreeNode(xmlNodePtr cur); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 349 | |
| 350 | /* |
| 351 | * Namespaces |
| 352 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 353 | xmlNsPtr xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 354 | const CHAR *nameSpace); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 355 | xmlNsPtr xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 356 | const CHAR *href); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 357 | void xmlSetNs(xmlNodePtr node, xmlNsPtr ns); |
| 358 | xmlNsPtr xmlCopyNamespace(xmlNsPtr cur); |
| 359 | xmlNsPtr xmlCopyNamespaceList(xmlNsPtr cur); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 360 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 361 | /* |
| 362 | * Changing the content. |
| 363 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 364 | xmlAttrPtr xmlSetProp(xmlNodePtr node, const CHAR *name, |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 365 | const CHAR *value); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 366 | CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name); |
| 367 | xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, const CHAR *value); |
| 368 | xmlNodePtr xmlStringLenGetNodeList(xmlDocPtr doc, const CHAR *value, |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 369 | int len); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 370 | CHAR *xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine); |
| 371 | void xmlNodeSetContent(xmlNodePtr cur, const CHAR *content); |
| 372 | void xmlNodeSetContentLen(xmlNodePtr cur, const CHAR *content, int len); |
| 373 | void xmlNodeAddContent(xmlNodePtr cur, const CHAR *content); |
| 374 | void xmlNodeAddContentLen(xmlNodePtr cur, const CHAR *content, int len); |
| 375 | CHAR *xmlNodeGetContent(xmlNodePtr cur); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 376 | |
| 377 | /* |
| 378 | * Internal, don't use |
| 379 | */ |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 380 | void xmlBufferWriteCHAR(xmlBufferPtr buf, const CHAR *string); |
| 381 | void xmlBufferWriteChar(xmlBufferPtr buf, const char *string); |
Daniel Veillard | 011b63c | 1999-06-02 17:44:04 +0000 | [diff] [blame] | 382 | void xmlBufferWriteQuotedString(xmlBufferPtr buf, const CHAR *string); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 383 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 384 | /* |
| 385 | * Saving |
| 386 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 387 | void xmlDocDumpMemory(xmlDocPtr cur, CHAR**mem, int *size); |
| 388 | void xmlDocDump(FILE *f, xmlDocPtr cur); |
Daniel Veillard | 151b1b0 | 1998-09-23 00:49:46 +0000 | [diff] [blame] | 389 | int xmlSaveFile(const char *filename, xmlDocPtr cur); |
| 390 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 391 | /* |
| 392 | * Compression |
| 393 | */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 394 | int xmlGetDocCompressMode (xmlDocPtr doc); |
| 395 | void xmlSetDocCompressMode (xmlDocPtr doc, int mode); |
| 396 | int xmlGetCompressMode(void); |
| 397 | void xmlSetCompressMode(int mode); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 398 | |
| 399 | #ifdef __cplusplus |
| 400 | } |
| 401 | #endif |
| 402 | |
| 403 | #endif /* __XML_TREE_H__ */ |
| 404 | |