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 | |
Daniel Veillard | 82c305b | 1999-12-15 19:08:23 +0000 | [diff] [blame] | 13 | #include <stdio.h> |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 14 | #include <libxml/xmlversion.h> |
Daniel Veillard | 82c305b | 1999-12-15 19:08:23 +0000 | [diff] [blame] | 15 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /* |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 22 | * The different element types carried by an XML tree |
| 23 | * |
| 24 | * NOTE: This is synchronized with DOM Level1 values |
| 25 | * See http://www.w3.org/TR/REC-DOM-Level-1/ |
| 26 | */ |
| 27 | typedef enum { |
| 28 | XML_ELEMENT_NODE= 1, |
| 29 | XML_ATTRIBUTE_NODE= 2, |
| 30 | XML_TEXT_NODE= 3, |
| 31 | XML_CDATA_SECTION_NODE= 4, |
| 32 | XML_ENTITY_REF_NODE= 5, |
| 33 | XML_ENTITY_NODE= 6, |
| 34 | XML_PI_NODE= 7, |
| 35 | XML_COMMENT_NODE= 8, |
| 36 | XML_DOCUMENT_NODE= 9, |
| 37 | XML_DOCUMENT_TYPE_NODE= 10, |
| 38 | XML_DOCUMENT_FRAG_NODE= 11, |
Daniel Veillard | 7c1206f | 1999-10-14 09:10:25 +0000 | [diff] [blame] | 39 | XML_NOTATION_NODE= 12, |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 40 | XML_HTML_DOCUMENT_NODE= 13, |
| 41 | XML_DTD_NODE= 14, |
| 42 | XML_ELEMENT_DECL= 15, |
| 43 | XML_ATTRIBUTE_DECL= 16, |
| 44 | XML_ENTITY_DECL= 17 |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 45 | } xmlElementType; |
| 46 | |
| 47 | /* |
Daniel Veillard | 0ba4d53 | 1998-11-01 19:34:31 +0000 | [diff] [blame] | 48 | * Size of an internal character representation. |
| 49 | * |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 50 | * We use 8bit chars internal representation for memory efficiency, |
| 51 | * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle |
| 52 | * correctly non ISO-Latin input. |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 53 | */ |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 54 | |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 55 | typedef unsigned char xmlChar; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 56 | |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 57 | #ifndef WIN32 |
| 58 | #ifndef CHAR |
| 59 | #define CHAR xmlChar |
| 60 | #endif |
| 61 | #endif |
| 62 | |
| 63 | #define BAD_CAST (xmlChar *) |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 64 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 65 | /* |
| 66 | * a DTD Notation definition |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 67 | */ |
| 68 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 69 | typedef struct _xmlNotation xmlNotation; |
| 70 | typedef xmlNotation *xmlNotationPtr; |
| 71 | struct _xmlNotation { |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 72 | const xmlChar *name; /* Notation name */ |
| 73 | const xmlChar *PublicID; /* Public identifier, if any */ |
| 74 | const xmlChar *SystemID; /* System identifier, if any */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 75 | }; |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 76 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 77 | /* |
| 78 | * a DTD Attribute definition |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 79 | */ |
| 80 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 81 | typedef enum { |
| 82 | XML_ATTRIBUTE_CDATA = 1, |
| 83 | XML_ATTRIBUTE_ID, |
| 84 | XML_ATTRIBUTE_IDREF , |
| 85 | XML_ATTRIBUTE_IDREFS, |
| 86 | XML_ATTRIBUTE_ENTITY, |
| 87 | XML_ATTRIBUTE_ENTITIES, |
| 88 | XML_ATTRIBUTE_NMTOKEN, |
| 89 | XML_ATTRIBUTE_NMTOKENS, |
| 90 | XML_ATTRIBUTE_ENUMERATION, |
| 91 | XML_ATTRIBUTE_NOTATION |
| 92 | } xmlAttributeType; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 93 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 94 | typedef enum { |
| 95 | XML_ATTRIBUTE_NONE = 1, |
| 96 | XML_ATTRIBUTE_REQUIRED, |
| 97 | XML_ATTRIBUTE_IMPLIED, |
| 98 | XML_ATTRIBUTE_FIXED |
| 99 | } xmlAttributeDefault; |
| 100 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 101 | typedef struct _xmlEnumeration xmlEnumeration; |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 102 | typedef xmlEnumeration *xmlEnumerationPtr; |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 103 | struct _xmlEnumeration { |
| 104 | struct _xmlEnumeration *next; /* next one */ |
| 105 | const xmlChar *name; /* Enumeration name */ |
| 106 | }; |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 107 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 108 | typedef struct _xmlAttribute xmlAttribute; |
| 109 | typedef xmlAttribute *xmlAttributePtr; |
| 110 | struct _xmlAttribute { |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 111 | #ifndef XML_WITHOUT_CORBA |
| 112 | void *_private; /* for Corba, must be first ! */ |
| 113 | #endif |
| 114 | xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ |
| 115 | const xmlChar *name; /* Attribute name */ |
| 116 | struct _xmlNode *children; /* NULL */ |
| 117 | struct _xmlNode *last; /* NULL */ |
| 118 | struct _xmlDtd *parent; /* -> DTD */ |
| 119 | struct _xmlNode *next; /* next sibling link */ |
| 120 | struct _xmlNode *prev; /* previous sibling link */ |
| 121 | struct _xmlDoc *doc; /* the containing document */ |
| 122 | |
| 123 | struct _xmlAttribute *nexth; /* next in hash table */ |
| 124 | xmlAttributeType atype; /* The attribute type */ |
| 125 | xmlAttributeDefault def; /* the default */ |
| 126 | const xmlChar *defaultValue; /* or the default value */ |
| 127 | xmlEnumerationPtr tree; /* or the enumeration tree if any */ |
| 128 | const xmlChar *prefix; /* the namespace prefix if any */ |
| 129 | const xmlChar *elem; /* Element holding the attribute */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 130 | }; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 131 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 132 | /* |
| 133 | * a DTD Element definition. |
| 134 | */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 135 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 136 | XML_ELEMENT_CONTENT_PCDATA = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 137 | XML_ELEMENT_CONTENT_ELEMENT, |
| 138 | XML_ELEMENT_CONTENT_SEQ, |
| 139 | XML_ELEMENT_CONTENT_OR |
| 140 | } xmlElementContentType; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 141 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 142 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 143 | XML_ELEMENT_CONTENT_ONCE = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 144 | XML_ELEMENT_CONTENT_OPT, |
| 145 | XML_ELEMENT_CONTENT_MULT, |
| 146 | XML_ELEMENT_CONTENT_PLUS |
| 147 | } xmlElementContentOccur; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 148 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 149 | typedef struct _xmlElementContent xmlElementContent; |
| 150 | typedef xmlElementContent *xmlElementContentPtr; |
| 151 | struct _xmlElementContent { |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 152 | xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ |
| 153 | xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 154 | const xmlChar *name; /* Element name */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 155 | struct _xmlElementContent *c1; /* first child */ |
| 156 | struct _xmlElementContent *c2; /* second child */ |
| 157 | }; |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 158 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 159 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 160 | XML_ELEMENT_TYPE_EMPTY = 1, |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 161 | XML_ELEMENT_TYPE_ANY, |
| 162 | XML_ELEMENT_TYPE_MIXED, |
| 163 | XML_ELEMENT_TYPE_ELEMENT |
| 164 | } xmlElementTypeVal; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 165 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 166 | typedef struct _xmlElement xmlElement; |
| 167 | typedef xmlElement *xmlElementPtr; |
| 168 | struct _xmlElement { |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 169 | #ifndef XML_WITHOUT_CORBA |
| 170 | void *_private; /* for Corba, must be first ! */ |
| 171 | #endif |
| 172 | xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 173 | const xmlChar *name; /* Element name */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 174 | struct _xmlNode *children; /* NULL */ |
| 175 | struct _xmlNode *last; /* NULL */ |
| 176 | struct _xmlDtd *parent; /* -> DTD */ |
| 177 | struct _xmlNode *next; /* next sibling link */ |
| 178 | struct _xmlNode *prev; /* previous sibling link */ |
| 179 | struct _xmlDoc *doc; /* the containing document */ |
| 180 | |
| 181 | xmlElementTypeVal etype; /* The type */ |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 182 | xmlElementContentPtr content; /* the allowed element content */ |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 183 | xmlAttributePtr attributes; /* List of the declared attributes */ |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 184 | const xmlChar *prefix; /* the namespace prefix if any */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 185 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * An XML namespace. |
| 189 | * Note that prefix == NULL is valid, it defines the default namespace |
| 190 | * within the subtree (until overriden). |
| 191 | */ |
| 192 | |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 193 | typedef enum { |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 194 | XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 195 | XML_LOCAL_NAMESPACE /* new style local scoping */ |
| 196 | } xmlNsType; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 197 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 198 | typedef struct _xmlNs xmlNs; |
| 199 | typedef xmlNs *xmlNsPtr; |
| 200 | struct _xmlNs { |
| 201 | struct _xmlNs *next; /* next Ns link for this node */ |
Daniel Veillard | 1899e85 | 1999-02-01 12:18:54 +0000 | [diff] [blame] | 202 | xmlNsType type; /* global or local */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 203 | const xmlChar *href; /* URL for the namespace */ |
| 204 | const xmlChar *prefix; /* prefix for the namespace */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 205 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 206 | |
| 207 | /* |
| 208 | * An XML DtD, as defined by <!DOCTYPE. |
| 209 | */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 210 | typedef struct _xmlDtd xmlDtd; |
| 211 | typedef xmlDtd *xmlDtdPtr; |
| 212 | struct _xmlDtd { |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 213 | #ifndef XML_WITHOUT_CORBA |
| 214 | void *_private; /* for Corba, must be first ! */ |
| 215 | #endif |
| 216 | xmlElementType type; /* XML_DTD_NODE, must be second ! */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 217 | const xmlChar *name; /* Name of the DTD */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 218 | struct _xmlNode *children; /* the value of the property link */ |
| 219 | struct _xmlNode *last; /* last child link */ |
| 220 | struct _xmlDoc *parent; /* child->parent link */ |
| 221 | struct _xmlNode *next; /* next sibling link */ |
| 222 | struct _xmlNode *prev; /* previous sibling link */ |
| 223 | struct _xmlDoc *doc; /* the containing document */ |
| 224 | |
| 225 | /* End of common part */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 226 | void *notations; /* Hash table for notations if any */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 227 | void *elements; /* Hash table for elements if any */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 228 | void *attributes; /* Hash table for attributes if any */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 229 | void *entities; /* Hash table for entities if any */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 230 | const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ |
| 231 | const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 232 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 233 | |
| 234 | /* |
| 235 | * A attribute of an XML node. |
| 236 | */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 237 | typedef struct _xmlAttr xmlAttr; |
| 238 | typedef xmlAttr *xmlAttrPtr; |
| 239 | struct _xmlAttr { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 240 | #ifndef XML_WITHOUT_CORBA |
| 241 | void *_private; /* for Corba, must be first ! */ |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 242 | #endif |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 243 | xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 244 | const xmlChar *name; /* the name of the property */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 245 | struct _xmlNode *children; /* the value of the property */ |
| 246 | struct _xmlNode *last; /* NULL */ |
| 247 | struct _xmlNode *parent; /* child->parent link */ |
| 248 | struct _xmlAttr *next; /* next sibling link */ |
| 249 | struct _xmlAttr *prev; /* previous sibling link */ |
| 250 | struct _xmlDoc *doc; /* the containing document */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 251 | xmlNs *ns; /* pointer to the associated namespace */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 252 | xmlAttributeType atype; /* the attribute type if validating */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 253 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 254 | |
| 255 | /* |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame] | 256 | * An XML ID instance. |
| 257 | */ |
| 258 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 259 | typedef struct _xmlID xmlID; |
| 260 | typedef xmlID *xmlIDPtr; |
| 261 | struct _xmlID { |
| 262 | struct _xmlID *next; /* next ID */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 263 | const xmlChar *value; /* The ID name */ |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame] | 264 | xmlAttrPtr attr; /* The attribut holding it */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 265 | }; |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame] | 266 | |
| 267 | /* |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 268 | * An XML IDREF instance. |
| 269 | */ |
| 270 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 271 | typedef struct _xmlRef xmlRef; |
| 272 | typedef xmlRef *xmlRefPtr; |
| 273 | struct _xmlRef { |
| 274 | struct _xmlRef *next; /* next Ref */ |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 275 | const xmlChar *value; /* The Ref name */ |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 276 | xmlAttrPtr attr; /* The attribut holding it */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 277 | }; |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 278 | |
| 279 | /* |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 280 | * A buffer structure |
| 281 | */ |
| 282 | |
| 283 | typedef enum { |
| 284 | XML_BUFFER_ALLOC_DOUBLEIT, |
| 285 | XML_BUFFER_ALLOC_EXACT |
| 286 | } xmlBufferAllocationScheme; |
| 287 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 288 | typedef struct _xmlBuffer xmlBuffer; |
| 289 | typedef xmlBuffer *xmlBufferPtr; |
| 290 | struct _xmlBuffer { |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 291 | xmlChar *content; /* The buffer content UTF8 */ |
| 292 | unsigned int use; /* The buffer size used */ |
| 293 | unsigned int size; /* The buffer size */ |
| 294 | xmlBufferAllocationScheme alloc; /* The realloc method */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 295 | }; |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 296 | |
| 297 | /* |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 298 | * A node in an XML tree. |
| 299 | */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 300 | typedef struct _xmlNode xmlNode; |
| 301 | typedef xmlNode *xmlNodePtr; |
| 302 | struct _xmlNode { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 303 | #ifndef XML_WITHOUT_CORBA |
| 304 | void *_private; /* for Corba, must be first ! */ |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 305 | #endif |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 306 | xmlElementType type; /* type number, must be second ! */ |
| 307 | const xmlChar *name; /* the name of the node, or the entity */ |
| 308 | struct _xmlNode *children; /* parent->childs link */ |
| 309 | struct _xmlNode *last; /* last child link */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 310 | struct _xmlNode *parent; /* child->parent link */ |
| 311 | struct _xmlNode *next; /* next sibling link */ |
| 312 | struct _xmlNode *prev; /* previous sibling link */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 313 | struct _xmlDoc *doc; /* the containing document */ |
| 314 | xmlNs *ns; /* pointer to the associated namespace */ |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 315 | #ifndef XML_USE_BUFFER_CONTENT |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 316 | xmlChar *content; /* the content */ |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 317 | #else |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 318 | xmlBufferPtr content; /* the content in a buffer */ |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 319 | #endif |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 320 | |
| 321 | /* End of common part */ |
| 322 | struct _xmlAttr *properties;/* properties list */ |
| 323 | xmlNs *nsDef; /* namespace definitions on this node */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 324 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 325 | |
| 326 | /* |
| 327 | * An XML document. |
| 328 | */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 329 | typedef struct _xmlDoc xmlDoc; |
| 330 | typedef xmlDoc *xmlDocPtr; |
| 331 | struct _xmlDoc { |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 332 | #ifndef XML_WITHOUT_CORBA |
| 333 | void *_private; /* for Corba, must be first ! */ |
Daniel Veillard | 27fb075 | 1998-10-17 06:47:46 +0000 | [diff] [blame] | 334 | #endif |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 335 | xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 336 | char *name; /* name/filename/URI of the document */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 337 | struct _xmlNode *children; /* the document tree */ |
| 338 | struct _xmlNode *last; /* last child link */ |
| 339 | struct _xmlNode *parent; /* child->parent link */ |
| 340 | struct _xmlNode *next; /* next sibling link */ |
| 341 | struct _xmlNode *prev; /* previous sibling link */ |
| 342 | struct _xmlDoc *doc; /* autoreference to itself */ |
| 343 | |
| 344 | /* End of common part */ |
Daniel Veillard | 15a8df4 | 1998-09-24 19:15:06 +0000 | [diff] [blame] | 345 | int compression;/* level of zlib compression */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 346 | int standalone; /* standalone document (no external refs) */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 347 | struct _xmlDtd *intSubset; /* the document internal subset */ |
| 348 | struct _xmlDtd *extSubset; /* the document external subset */ |
| 349 | struct _xmlNs *oldNs; /* Global namespace, the old way */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 350 | const xmlChar *version; /* the XML version string */ |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 351 | const xmlChar *encoding; /* external initial encoding, if any */ |
Daniel Veillard | 991e63d | 1999-08-15 23:32:28 +0000 | [diff] [blame] | 352 | void *ids; /* Hash table for ID attributes if any */ |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 353 | void *refs; /* Hash table for IDREFs attributes if any */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 354 | const xmlChar *URL; /* The URI for that document */ |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 355 | int charset; /* encoding of the in-memory content |
| 356 | actually an xmlCharEncoding */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 357 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 358 | |
| 359 | /* |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 360 | * Compatibility naming layer with libxml1 |
| 361 | */ |
| 362 | #ifndef xmlChildrenNode |
| 363 | #define xmlChildrenNode children |
| 364 | #define xmlRootNode children |
| 365 | #endif |
| 366 | |
| 367 | /* |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 368 | * Variables. |
| 369 | */ |
| 370 | extern xmlNsPtr baseDTD; |
| 371 | extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ |
| 372 | extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 373 | extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ |
Daniel Veillard | e41f2b7 | 2000-01-30 20:00:07 +0000 | [diff] [blame] | 374 | extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 375 | |
| 376 | /* |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 377 | * Handling Buffers. |
| 378 | */ |
| 379 | |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 380 | xmlBufferPtr xmlBufferCreate (void); |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 381 | xmlBufferPtr xmlBufferCreateSize (size_t size); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 382 | void xmlBufferFree (xmlBufferPtr buf); |
| 383 | int xmlBufferDump (FILE *file, |
| 384 | xmlBufferPtr buf); |
| 385 | void xmlBufferAdd (xmlBufferPtr buf, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 386 | const xmlChar *str, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 387 | int len); |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 388 | void xmlBufferAddHead (xmlBufferPtr buf, |
| 389 | const xmlChar *str, |
| 390 | int len); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 391 | void xmlBufferCat (xmlBufferPtr buf, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 392 | const xmlChar *str); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 393 | void xmlBufferCCat (xmlBufferPtr buf, |
| 394 | const char *str); |
| 395 | int xmlBufferShrink (xmlBufferPtr buf, |
| 396 | int len); |
Daniel Veillard | 496a1cf | 2000-05-03 14:20:55 +0000 | [diff] [blame] | 397 | int xmlBufferGrow (xmlBufferPtr buf, |
| 398 | int len); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 399 | void xmlBufferEmpty (xmlBufferPtr buf); |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 400 | const xmlChar* xmlBufferContent (const xmlBufferPtr buf); |
| 401 | int xmlBufferUse (const xmlBufferPtr buf); |
| 402 | void xmlBufferSetAllocationScheme(xmlBufferPtr buf, |
| 403 | xmlBufferAllocationScheme scheme); |
| 404 | int xmlBufferLength (const xmlBufferPtr buf); |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 405 | |
| 406 | /* |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 407 | * Creating/freeing new structures |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 408 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 409 | xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 410 | const xmlChar *name, |
| 411 | const xmlChar *ExternalID, |
| 412 | const xmlChar *SystemID); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 413 | xmlDtdPtr xmlNewDtd (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 414 | const xmlChar *name, |
| 415 | const xmlChar *ExternalID, |
| 416 | const xmlChar *SystemID); |
Daniel Veillard | d83eb82 | 2000-06-30 18:39:56 +0000 | [diff] [blame] | 417 | xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 418 | void xmlFreeDtd (xmlDtdPtr cur); |
| 419 | xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 420 | const xmlChar *href, |
| 421 | const xmlChar *prefix); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 422 | xmlNsPtr xmlNewNs (xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 423 | const xmlChar *href, |
| 424 | const xmlChar *prefix); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 425 | void xmlFreeNs (xmlNsPtr cur); |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 426 | xmlDocPtr xmlNewDoc (const xmlChar *version); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 427 | void xmlFreeDoc (xmlDocPtr cur); |
| 428 | xmlAttrPtr xmlNewDocProp (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 429 | const xmlChar *name, |
| 430 | const xmlChar *value); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 431 | xmlAttrPtr xmlNewProp (xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 432 | const xmlChar *name, |
| 433 | const xmlChar *value); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 434 | xmlAttrPtr xmlNewNsProp (xmlNodePtr node, |
| 435 | xmlNsPtr ns, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 436 | const xmlChar *name, |
| 437 | const xmlChar *value); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 438 | void xmlFreePropList (xmlAttrPtr cur); |
| 439 | void xmlFreeProp (xmlAttrPtr cur); |
| 440 | xmlAttrPtr xmlCopyProp (xmlNodePtr target, |
| 441 | xmlAttrPtr cur); |
| 442 | xmlAttrPtr xmlCopyPropList (xmlNodePtr target, |
| 443 | xmlAttrPtr cur); |
| 444 | xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd); |
| 445 | xmlDocPtr xmlCopyDoc (xmlDocPtr doc, |
| 446 | int recursive); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 447 | |
| 448 | /* |
| 449 | * Creating new nodes |
| 450 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 451 | xmlNodePtr xmlNewDocNode (xmlDocPtr doc, |
| 452 | xmlNsPtr ns, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 453 | const xmlChar *name, |
| 454 | const xmlChar *content); |
Daniel Veillard | 11a48ec | 1999-11-23 10:40:46 +0000 | [diff] [blame] | 455 | xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc, |
| 456 | xmlNsPtr ns, |
| 457 | const xmlChar *name, |
| 458 | const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 459 | xmlNodePtr xmlNewNode (xmlNsPtr ns, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 460 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 461 | xmlNodePtr xmlNewChild (xmlNodePtr parent, |
| 462 | xmlNsPtr ns, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 463 | const xmlChar *name, |
| 464 | const xmlChar *content); |
Daniel Veillard | 11a48ec | 1999-11-23 10:40:46 +0000 | [diff] [blame] | 465 | xmlNodePtr xmlNewTextChild (xmlNodePtr parent, |
| 466 | xmlNsPtr ns, |
| 467 | const xmlChar *name, |
| 468 | const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 469 | xmlNodePtr xmlNewDocText (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 470 | const xmlChar *content); |
| 471 | xmlNodePtr xmlNewText (const xmlChar *content); |
| 472 | xmlNodePtr xmlNewPI (const xmlChar *name, |
| 473 | const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 474 | xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 475 | const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 476 | int len); |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 477 | xmlNodePtr xmlNewTextLen (const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 478 | int len); |
| 479 | xmlNodePtr xmlNewDocComment (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 480 | const xmlChar *content); |
| 481 | xmlNodePtr xmlNewComment (const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 482 | xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 483 | const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 484 | int len); |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 485 | xmlNodePtr xmlNewCharRef (xmlDocPtr doc, |
| 486 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 487 | xmlNodePtr xmlNewReference (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 488 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 489 | xmlNodePtr xmlCopyNode (xmlNodePtr node, |
| 490 | int recursive); |
| 491 | xmlNodePtr xmlCopyNodeList (xmlNodePtr node); |
Daniel Veillard | 2eac503 | 2000-01-09 21:08:56 +0000 | [diff] [blame] | 492 | xmlNodePtr xmlNewDocFragment (xmlDocPtr doc); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 493 | |
| 494 | /* |
| 495 | * Navigating |
| 496 | */ |
Daniel Veillard | 3dbfdca | 1999-12-15 19:08:23 +0000 | [diff] [blame] | 497 | xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 498 | xmlNodePtr xmlGetLastChild (xmlNodePtr parent); |
| 499 | int xmlNodeIsText (xmlNodePtr node); |
Daniel Veillard | 3e6d237 | 2000-03-04 11:39:43 +0000 | [diff] [blame] | 500 | int xmlIsBlankNode (xmlNodePtr node); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 501 | |
| 502 | /* |
| 503 | * Changing the structure |
| 504 | */ |
Daniel Veillard | 5cb5ab8 | 1999-12-21 15:35:29 +0000 | [diff] [blame] | 505 | xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc, |
| 506 | xmlNodePtr root); |
| 507 | void xmlNodeSetName (xmlNodePtr cur, |
| 508 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 509 | xmlNodePtr xmlAddChild (xmlNodePtr parent, |
| 510 | xmlNodePtr cur); |
Daniel Veillard | 87b9539 | 2000-08-12 21:12:04 +0000 | [diff] [blame^] | 511 | xmlNodePtr xmlAddChildList (xmlNodePtr parent, |
| 512 | xmlNodePtr cur); |
Daniel Veillard | 5cb5ab8 | 1999-12-21 15:35:29 +0000 | [diff] [blame] | 513 | xmlNodePtr xmlReplaceNode (xmlNodePtr old, |
| 514 | xmlNodePtr cur); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 515 | xmlNodePtr xmlAddSibling (xmlNodePtr cur, |
| 516 | xmlNodePtr elem); |
Daniel Veillard | 5cb5ab8 | 1999-12-21 15:35:29 +0000 | [diff] [blame] | 517 | xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur, |
| 518 | xmlNodePtr elem); |
| 519 | xmlNodePtr xmlAddNextSibling (xmlNodePtr cur, |
| 520 | xmlNodePtr elem); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 521 | void xmlUnlinkNode (xmlNodePtr cur); |
| 522 | xmlNodePtr xmlTextMerge (xmlNodePtr first, |
| 523 | xmlNodePtr second); |
| 524 | void xmlTextConcat (xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 525 | const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 526 | int len); |
| 527 | void xmlFreeNodeList (xmlNodePtr cur); |
| 528 | void xmlFreeNode (xmlNodePtr cur); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 529 | |
| 530 | /* |
| 531 | * Namespaces |
| 532 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 533 | xmlNsPtr xmlSearchNs (xmlDocPtr doc, |
| 534 | xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 535 | const xmlChar *nameSpace); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 536 | xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc, |
| 537 | xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 538 | const xmlChar *href); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 539 | xmlNsPtr * xmlGetNsList (xmlDocPtr doc, |
| 540 | xmlNodePtr node); |
| 541 | void xmlSetNs (xmlNodePtr node, |
| 542 | xmlNsPtr ns); |
| 543 | xmlNsPtr xmlCopyNamespace (xmlNsPtr cur); |
| 544 | xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 545 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 546 | /* |
| 547 | * Changing the content. |
| 548 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 549 | xmlAttrPtr xmlSetProp (xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 550 | const xmlChar *name, |
| 551 | const xmlChar *value); |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 552 | xmlChar * xmlGetProp (xmlNodePtr node, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 553 | const xmlChar *name); |
Daniel Veillard | 32bc74e | 2000-07-14 14:49:25 +0000 | [diff] [blame] | 554 | xmlAttrPtr xmlHasProp (xmlNodePtr node, |
| 555 | const xmlChar *name); |
Daniel Veillard | 10a2c65 | 1999-12-12 13:03:50 +0000 | [diff] [blame] | 556 | xmlChar * xmlGetNsProp (xmlNodePtr node, |
| 557 | const xmlChar *name, |
Ramiro Estrugo | bfce377 | 1999-12-15 04:32:07 +0000 | [diff] [blame] | 558 | const xmlChar *nameSpace); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 559 | xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 560 | const xmlChar *value); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 561 | xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 562 | const xmlChar *value, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 563 | int len); |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 564 | xmlChar * xmlNodeListGetString (xmlDocPtr doc, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 565 | xmlNodePtr list, |
| 566 | int inLine); |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 567 | xmlChar * xmlNodeListGetRawString (xmlDocPtr doc, |
| 568 | xmlNodePtr list, |
| 569 | int inLine); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 570 | void xmlNodeSetContent (xmlNodePtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 571 | const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 572 | void xmlNodeSetContentLen (xmlNodePtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 573 | const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 574 | int len); |
| 575 | void xmlNodeAddContent (xmlNodePtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 576 | const xmlChar *content); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 577 | void xmlNodeAddContentLen (xmlNodePtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 578 | const xmlChar *content, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 579 | int len); |
Daniel Veillard | 6077d03 | 1999-10-09 09:11:45 +0000 | [diff] [blame] | 580 | xmlChar * xmlNodeGetContent (xmlNodePtr cur); |
Daniel Veillard | a819dac | 1999-11-24 18:04:22 +0000 | [diff] [blame] | 581 | xmlChar * xmlNodeGetLang (xmlNodePtr cur); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 582 | void xmlNodeSetLang (xmlNodePtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 583 | const xmlChar *lang); |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 584 | int xmlNodeGetSpacePreserve (xmlNodePtr cur); |
Daniel Veillard | 10a2c65 | 1999-12-12 13:03:50 +0000 | [diff] [blame] | 585 | xmlChar * xmlNodeGetBase (xmlDocPtr doc, |
| 586 | xmlNodePtr cur); |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 587 | |
| 588 | /* |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 589 | * Removing content. |
| 590 | */ |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 591 | int xmlRemoveProp (xmlAttrPtr attr); |
Daniel Veillard | c08a2c6 | 1999-09-08 21:35:25 +0000 | [diff] [blame] | 592 | int xmlRemoveNode (xmlNodePtr node); /* TODO */ |
| 593 | |
| 594 | /* |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 595 | * Internal, don't use |
| 596 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 597 | void xmlBufferWriteCHAR (xmlBufferPtr buf, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 598 | const xmlChar *string); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 599 | void xmlBufferWriteChar (xmlBufferPtr buf, |
| 600 | const char *string); |
| 601 | void xmlBufferWriteQuotedString(xmlBufferPtr buf, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 602 | const xmlChar *string); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 603 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 604 | /* |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 605 | * Namespace handling |
| 606 | */ |
| 607 | int xmlReconciliateNs (xmlDocPtr doc, |
| 608 | xmlNodePtr tree); |
| 609 | |
| 610 | /* |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 611 | * Saving |
| 612 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 613 | void xmlDocDumpMemory (xmlDocPtr cur, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 614 | xmlChar**mem, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 615 | int *size); |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 616 | int xmlDocDump (FILE *f, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 617 | xmlDocPtr cur); |
Daniel Veillard | dbfd641 | 1999-12-28 16:35:14 +0000 | [diff] [blame] | 618 | void xmlElemDump (FILE *f, |
Daniel Veillard | 0604743 | 2000-04-24 11:33:38 +0000 | [diff] [blame] | 619 | xmlDocPtr doc, |
| 620 | xmlNodePtr cur); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 621 | int xmlSaveFile (const char *filename, |
| 622 | xmlDocPtr cur); |
Daniel Veillard | 151b1b0 | 1998-09-23 00:49:46 +0000 | [diff] [blame] | 623 | |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 624 | /* This one is exported from xmlIO.h |
| 625 | |
| 626 | int xmlSaveFileTo (xmlOutputBuffer *buf, |
| 627 | xmlDocPtr cur, |
| 628 | const char *encoding); |
| 629 | */ |
| 630 | |
| 631 | int xmlSaveFileEnc (const char *filename, |
| 632 | xmlDocPtr cur, |
| 633 | const char *encoding); |
| 634 | |
Daniel Veillard | 1625364 | 1998-10-28 22:58:05 +0000 | [diff] [blame] | 635 | /* |
| 636 | * Compression |
| 637 | */ |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 638 | int xmlGetDocCompressMode (xmlDocPtr doc); |
| 639 | void xmlSetDocCompressMode (xmlDocPtr doc, |
| 640 | int mode); |
| 641 | int xmlGetCompressMode (void); |
| 642 | void xmlSetCompressMode (int mode); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 643 | |
| 644 | #ifdef __cplusplus |
| 645 | } |
| 646 | #endif |
| 647 | |
| 648 | #endif /* __XML_TREE_H__ */ |
| 649 | |