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