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