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