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