blob: 35ea52567903f8c8074350caf5cd8a8286c1151b [file] [log] [blame]
Daniel Veillard260a68f1998-08-13 03:39:55 +00001/*
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 Veillard39a1f9a1999-01-17 19:11:59 +00007 * Daniel.Veillard@w3.org
Daniel Veillard260a68f1998-08-13 03:39:55 +00008 */
9
10#ifndef __XML_TREE_H__
11#define __XML_TREE_H__
12
Daniel Veillard82c305b1999-12-15 19:08:23 +000013#include <stdio.h>
Daniel Veillard361d8452000-04-03 19:48:13 +000014#include <libxml/xmlversion.h>
Daniel Veillard82c305b1999-12-15 19:08:23 +000015
Daniel Veillard260a68f1998-08-13 03:39:55 +000016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
Daniel Veillardccb09631998-10-27 06:21:04 +000022 * The different element types carried by an XML tree
23 *
24 * NOTE: This is synchronized with DOM Level1 values
25 * See http://www.w3.org/TR/REC-DOM-Level-1/
26 */
27typedef enum {
28 XML_ELEMENT_NODE= 1,
29 XML_ATTRIBUTE_NODE= 2,
30 XML_TEXT_NODE= 3,
31 XML_CDATA_SECTION_NODE= 4,
32 XML_ENTITY_REF_NODE= 5,
33 XML_ENTITY_NODE= 6,
34 XML_PI_NODE= 7,
35 XML_COMMENT_NODE= 8,
36 XML_DOCUMENT_NODE= 9,
37 XML_DOCUMENT_TYPE_NODE= 10,
38 XML_DOCUMENT_FRAG_NODE= 11,
Daniel Veillard7c1206f1999-10-14 09:10:25 +000039 XML_NOTATION_NODE= 12,
Daniel Veillardcf461992000-03-14 18:30:20 +000040 XML_HTML_DOCUMENT_NODE= 13,
41 XML_DTD_NODE= 14,
42 XML_ELEMENT_DECL= 15,
43 XML_ATTRIBUTE_DECL= 16,
44 XML_ENTITY_DECL= 17
Daniel Veillardccb09631998-10-27 06:21:04 +000045} xmlElementType;
46
47/*
Daniel Veillard0ba4d531998-11-01 19:34:31 +000048 * Size of an internal character representation.
49 *
Daniel Veillardcf461992000-03-14 18:30:20 +000050 * We use 8bit chars internal representation for memory efficiency,
51 * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle
52 * correctly non ISO-Latin input.
Daniel Veillard260a68f1998-08-13 03:39:55 +000053 */
Daniel Veillarddd6b3671999-09-23 22:19:22 +000054
Daniel Veillarddd6b3671999-09-23 22:19:22 +000055typedef unsigned char xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000056
Daniel Veillarddd6b3671999-09-23 22:19:22 +000057#ifndef WIN32
58#ifndef CHAR
59#define CHAR xmlChar
60#endif
61#endif
62
63#define BAD_CAST (xmlChar *)
Daniel Veillardb96e6431999-08-29 21:02:19 +000064
Daniel Veillard260a68f1998-08-13 03:39:55 +000065/*
66 * a DTD Notation definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000067 */
68
Daniel Veillard71b656e2000-01-05 14:46:17 +000069typedef struct _xmlNotation xmlNotation;
70typedef xmlNotation *xmlNotationPtr;
71struct _xmlNotation {
Daniel Veillarddd6b3671999-09-23 22:19:22 +000072 const xmlChar *name; /* Notation name */
73 const xmlChar *PublicID; /* Public identifier, if any */
74 const xmlChar *SystemID; /* System identifier, if any */
Daniel Veillard71b656e2000-01-05 14:46:17 +000075};
Daniel Veillard1e346af1999-02-22 10:33:01 +000076
Daniel Veillard260a68f1998-08-13 03:39:55 +000077/*
78 * a DTD Attribute definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000079 */
80
Daniel Veillard1e346af1999-02-22 10:33:01 +000081typedef enum {
82 XML_ATTRIBUTE_CDATA = 1,
83 XML_ATTRIBUTE_ID,
84 XML_ATTRIBUTE_IDREF ,
85 XML_ATTRIBUTE_IDREFS,
86 XML_ATTRIBUTE_ENTITY,
87 XML_ATTRIBUTE_ENTITIES,
88 XML_ATTRIBUTE_NMTOKEN,
89 XML_ATTRIBUTE_NMTOKENS,
90 XML_ATTRIBUTE_ENUMERATION,
91 XML_ATTRIBUTE_NOTATION
92} xmlAttributeType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +000093
Daniel Veillard1e346af1999-02-22 10:33:01 +000094typedef enum {
95 XML_ATTRIBUTE_NONE = 1,
96 XML_ATTRIBUTE_REQUIRED,
97 XML_ATTRIBUTE_IMPLIED,
98 XML_ATTRIBUTE_FIXED
99} xmlAttributeDefault;
100
Daniel Veillard71b656e2000-01-05 14:46:17 +0000101typedef struct _xmlEnumeration xmlEnumeration;
Daniel Veillard1e346af1999-02-22 10:33:01 +0000102typedef xmlEnumeration *xmlEnumerationPtr;
Daniel Veillard71b656e2000-01-05 14:46:17 +0000103struct _xmlEnumeration {
104 struct _xmlEnumeration *next; /* next one */
105 const xmlChar *name; /* Enumeration name */
106};
Daniel Veillard1e346af1999-02-22 10:33:01 +0000107
Daniel Veillard71b656e2000-01-05 14:46:17 +0000108typedef struct _xmlAttribute xmlAttribute;
109typedef xmlAttribute *xmlAttributePtr;
110struct _xmlAttribute {
Daniel Veillardcf461992000-03-14 18:30:20 +0000111#ifndef XML_WITHOUT_CORBA
112 void *_private; /* for Corba, must be first ! */
113#endif
114 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
115 const xmlChar *name; /* Attribute name */
116 struct _xmlNode *children; /* NULL */
117 struct _xmlNode *last; /* NULL */
118 struct _xmlDtd *parent; /* -> DTD */
119 struct _xmlNode *next; /* next sibling link */
120 struct _xmlNode *prev; /* previous sibling link */
121 struct _xmlDoc *doc; /* the containing document */
122
123 struct _xmlAttribute *nexth; /* next in hash table */
124 xmlAttributeType atype; /* The attribute type */
125 xmlAttributeDefault def; /* the default */
126 const xmlChar *defaultValue; /* or the default value */
127 xmlEnumerationPtr tree; /* or the enumeration tree if any */
128 const xmlChar *prefix; /* the namespace prefix if any */
129 const xmlChar *elem; /* Element holding the attribute */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000130};
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000131
Daniel Veillard260a68f1998-08-13 03:39:55 +0000132/*
133 * a DTD Element definition.
134 */
Daniel Veillard1899e851999-02-01 12:18:54 +0000135typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000136 XML_ELEMENT_CONTENT_PCDATA = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000137 XML_ELEMENT_CONTENT_ELEMENT,
138 XML_ELEMENT_CONTENT_SEQ,
139 XML_ELEMENT_CONTENT_OR
140} xmlElementContentType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000141
Daniel Veillard1899e851999-02-01 12:18:54 +0000142typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000143 XML_ELEMENT_CONTENT_ONCE = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000144 XML_ELEMENT_CONTENT_OPT,
145 XML_ELEMENT_CONTENT_MULT,
146 XML_ELEMENT_CONTENT_PLUS
147} xmlElementContentOccur;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000148
Daniel Veillard71b656e2000-01-05 14:46:17 +0000149typedef struct _xmlElementContent xmlElementContent;
150typedef xmlElementContent *xmlElementContentPtr;
151struct _xmlElementContent {
Daniel Veillard1899e851999-02-01 12:18:54 +0000152 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
153 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
Daniel Veillard6077d031999-10-09 09:11:45 +0000154 const xmlChar *name; /* Element name */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000155 struct _xmlElementContent *c1; /* first child */
156 struct _xmlElementContent *c2; /* second child */
157};
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000158
Daniel Veillard1899e851999-02-01 12:18:54 +0000159typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000160 XML_ELEMENT_TYPE_EMPTY = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000161 XML_ELEMENT_TYPE_ANY,
162 XML_ELEMENT_TYPE_MIXED,
163 XML_ELEMENT_TYPE_ELEMENT
164} xmlElementTypeVal;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000165
Daniel Veillard71b656e2000-01-05 14:46:17 +0000166typedef struct _xmlElement xmlElement;
167typedef xmlElement *xmlElementPtr;
168struct _xmlElement {
Daniel Veillardcf461992000-03-14 18:30:20 +0000169#ifndef XML_WITHOUT_CORBA
170 void *_private; /* for Corba, must be first ! */
171#endif
172 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
Daniel Veillard6077d031999-10-09 09:11:45 +0000173 const xmlChar *name; /* Element name */
Daniel Veillardcf461992000-03-14 18:30:20 +0000174 struct _xmlNode *children; /* NULL */
175 struct _xmlNode *last; /* NULL */
176 struct _xmlDtd *parent; /* -> DTD */
177 struct _xmlNode *next; /* next sibling link */
178 struct _xmlNode *prev; /* previous sibling link */
179 struct _xmlDoc *doc; /* the containing document */
180
181 xmlElementTypeVal etype; /* The type */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000182 xmlElementContentPtr content; /* the allowed element content */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000183 xmlAttributePtr attributes; /* List of the declared attributes */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000184};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000185
186/*
187 * An XML namespace.
188 * Note that prefix == NULL is valid, it defines the default namespace
189 * within the subtree (until overriden).
190 */
191
Daniel Veillard1899e851999-02-01 12:18:54 +0000192typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000193 XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */
Daniel Veillard1899e851999-02-01 12:18:54 +0000194 XML_LOCAL_NAMESPACE /* new style local scoping */
195} xmlNsType;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000196
Daniel Veillard71b656e2000-01-05 14:46:17 +0000197typedef struct _xmlNs xmlNs;
198typedef xmlNs *xmlNsPtr;
199struct _xmlNs {
200 struct _xmlNs *next; /* next Ns link for this node */
Daniel Veillard1899e851999-02-01 12:18:54 +0000201 xmlNsType type; /* global or local */
Daniel Veillard6077d031999-10-09 09:11:45 +0000202 const xmlChar *href; /* URL for the namespace */
203 const xmlChar *prefix; /* prefix for the namespace */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000204};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000205
206/*
207 * An XML DtD, as defined by <!DOCTYPE.
208 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000209typedef struct _xmlDtd xmlDtd;
210typedef xmlDtd *xmlDtdPtr;
211struct _xmlDtd {
Daniel Veillardcf461992000-03-14 18:30:20 +0000212#ifndef XML_WITHOUT_CORBA
213 void *_private; /* for Corba, must be first ! */
214#endif
215 xmlElementType type; /* XML_DTD_NODE, must be second ! */
Daniel Veillard6077d031999-10-09 09:11:45 +0000216 const xmlChar *name; /* Name of the DTD */
Daniel Veillardcf461992000-03-14 18:30:20 +0000217 struct _xmlNode *children; /* the value of the property link */
218 struct _xmlNode *last; /* last child link */
219 struct _xmlDoc *parent; /* child->parent link */
220 struct _xmlNode *next; /* next sibling link */
221 struct _xmlNode *prev; /* previous sibling link */
222 struct _xmlDoc *doc; /* the containing document */
223
224 /* End of common part */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000225 void *notations; /* Hash table for notations if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000226 void *elements; /* Hash table for elements if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000227 void *attributes; /* Hash table for attributes if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000228 void *entities; /* Hash table for entities if any */
Daniel Veillardcf461992000-03-14 18:30:20 +0000229 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
230 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000231};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000232
233/*
234 * A attribute of an XML node.
235 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000236typedef struct _xmlAttr xmlAttr;
237typedef xmlAttr *xmlAttrPtr;
238struct _xmlAttr {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000239#ifndef XML_WITHOUT_CORBA
240 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000241#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000242 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000243 const xmlChar *name; /* the name of the property */
Daniel Veillardcf461992000-03-14 18:30:20 +0000244 struct _xmlNode *children; /* the value of the property */
245 struct _xmlNode *last; /* NULL */
246 struct _xmlNode *parent; /* child->parent link */
247 struct _xmlAttr *next; /* next sibling link */
248 struct _xmlAttr *prev; /* previous sibling link */
249 struct _xmlDoc *doc; /* the containing document */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000250 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillardcf461992000-03-14 18:30:20 +0000251 xmlAttributeType atype; /* the attribute type if validating */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000252};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000253
254/*
Daniel Veillard991e63d1999-08-15 23:32:28 +0000255 * An XML ID instance.
256 */
257
Daniel Veillard71b656e2000-01-05 14:46:17 +0000258typedef struct _xmlID xmlID;
259typedef xmlID *xmlIDPtr;
260struct _xmlID {
261 struct _xmlID *next; /* next ID */
Daniel Veillard6077d031999-10-09 09:11:45 +0000262 const xmlChar *value; /* The ID name */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000263 xmlAttrPtr attr; /* The attribut holding it */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000264};
Daniel Veillard991e63d1999-08-15 23:32:28 +0000265
266/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000267 * An XML IDREF instance.
268 */
269
Daniel Veillard71b656e2000-01-05 14:46:17 +0000270typedef struct _xmlRef xmlRef;
271typedef xmlRef *xmlRefPtr;
272struct _xmlRef {
273 struct _xmlRef *next; /* next Ref */
Daniel Veillard6077d031999-10-09 09:11:45 +0000274 const xmlChar *value; /* The Ref name */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000275 xmlAttrPtr attr; /* The attribut holding it */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000276};
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000277
278/*
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000279 * A buffer structure
280 */
281
282typedef enum {
283 XML_BUFFER_ALLOC_DOUBLEIT,
284 XML_BUFFER_ALLOC_EXACT
285} xmlBufferAllocationScheme;
286
Daniel Veillard71b656e2000-01-05 14:46:17 +0000287typedef struct _xmlBuffer xmlBuffer;
288typedef xmlBuffer *xmlBufferPtr;
289struct _xmlBuffer {
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000290 xmlChar *content; /* The buffer content UTF8 */
291 unsigned int use; /* The buffer size used */
292 unsigned int size; /* The buffer size */
293 xmlBufferAllocationScheme alloc; /* The realloc method */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000294};
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000295
296/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000297 * A node in an XML tree.
298 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000299typedef struct _xmlNode xmlNode;
300typedef xmlNode *xmlNodePtr;
301struct _xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000302#ifndef XML_WITHOUT_CORBA
303 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000304#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000305 xmlElementType type; /* type number, must be second ! */
306 const xmlChar *name; /* the name of the node, or the entity */
307 struct _xmlNode *children; /* parent->childs link */
308 struct _xmlNode *last; /* last child link */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000309 struct _xmlNode *parent; /* child->parent link */
310 struct _xmlNode *next; /* next sibling link */
311 struct _xmlNode *prev; /* previous sibling link */
Daniel Veillardcf461992000-03-14 18:30:20 +0000312 struct _xmlDoc *doc; /* the containing document */
313 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000314#ifndef XML_USE_BUFFER_CONTENT
Daniel Veillardcf461992000-03-14 18:30:20 +0000315 xmlChar *content; /* the content */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000316#else
Daniel Veillardcf461992000-03-14 18:30:20 +0000317 xmlBufferPtr content; /* the content in a buffer */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000318#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000319
320 /* End of common part */
321 struct _xmlAttr *properties;/* properties list */
322 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000323};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000324
325/*
326 * An XML document.
327 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000328typedef struct _xmlDoc xmlDoc;
329typedef xmlDoc *xmlDocPtr;
330struct _xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000331#ifndef XML_WITHOUT_CORBA
332 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000333#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000334 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000335 char *name; /* name/filename/URI of the document */
Daniel Veillardcf461992000-03-14 18:30:20 +0000336 struct _xmlNode *children; /* the document tree */
337 struct _xmlNode *last; /* last child link */
338 struct _xmlNode *parent; /* child->parent link */
339 struct _xmlNode *next; /* next sibling link */
340 struct _xmlNode *prev; /* previous sibling link */
341 struct _xmlDoc *doc; /* autoreference to itself */
342
343 /* End of common part */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000344 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000345 int standalone; /* standalone document (no external refs) */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000346 struct _xmlDtd *intSubset; /* the document internal subset */
347 struct _xmlDtd *extSubset; /* the document external subset */
348 struct _xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillardcf461992000-03-14 18:30:20 +0000349 const xmlChar *version; /* the XML version string */
350 const xmlChar *encoding; /* encoding, if any */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000351 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000352 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillardcf461992000-03-14 18:30:20 +0000353 const xmlChar *URL; /* The URI for that document */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000354};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000355
356/*
357 * Variables.
358 */
359extern xmlNsPtr baseDTD;
360extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
361extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000362extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillarde41f2b72000-01-30 20:00:07 +0000363extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000364
365/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000366 * Handling Buffers.
367 */
368
Daniel Veillardb96e6431999-08-29 21:02:19 +0000369xmlBufferPtr xmlBufferCreate (void);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000370xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000371void xmlBufferFree (xmlBufferPtr buf);
372int xmlBufferDump (FILE *file,
373 xmlBufferPtr buf);
374void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000375 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000376 int len);
377void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000378 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000379void xmlBufferCCat (xmlBufferPtr buf,
380 const char *str);
381int xmlBufferShrink (xmlBufferPtr buf,
382 int len);
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000383int xmlBufferGrow (xmlBufferPtr buf,
384 int len);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000385void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000386const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
387int xmlBufferUse (const xmlBufferPtr buf);
388void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
389 xmlBufferAllocationScheme scheme);
390int xmlBufferLength (const xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000391
392/*
Daniel Veillard16253641998-10-28 22:58:05 +0000393 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000394 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000395xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000396 const xmlChar *name,
397 const xmlChar *ExternalID,
398 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000399xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000400 const xmlChar *name,
401 const xmlChar *ExternalID,
402 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000403void xmlFreeDtd (xmlDtdPtr cur);
404xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000405 const xmlChar *href,
406 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000407xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000408 const xmlChar *href,
409 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000410void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000411xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000412void xmlFreeDoc (xmlDocPtr cur);
413xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000414 const xmlChar *name,
415 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000416xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000417 const xmlChar *name,
418 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000419xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
420 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000421 const xmlChar *name,
422 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000423void xmlFreePropList (xmlAttrPtr cur);
424void xmlFreeProp (xmlAttrPtr cur);
425xmlAttrPtr xmlCopyProp (xmlNodePtr target,
426 xmlAttrPtr cur);
427xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
428 xmlAttrPtr cur);
429xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
430xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
431 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000432
433/*
434 * Creating new nodes
435 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000436xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
437 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000438 const xmlChar *name,
439 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000440xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
441 xmlNsPtr ns,
442 const xmlChar *name,
443 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000444xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000445 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000446xmlNodePtr xmlNewChild (xmlNodePtr parent,
447 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000448 const xmlChar *name,
449 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000450xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
451 xmlNsPtr ns,
452 const xmlChar *name,
453 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000454xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000455 const xmlChar *content);
456xmlNodePtr xmlNewText (const xmlChar *content);
457xmlNodePtr xmlNewPI (const xmlChar *name,
458 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000459xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000460 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000461 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000462xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000463 int len);
464xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000465 const xmlChar *content);
466xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000467xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000468 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000469 int len);
Daniel Veillardcf461992000-03-14 18:30:20 +0000470xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
471 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000472xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000473 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000474xmlNodePtr xmlCopyNode (xmlNodePtr node,
475 int recursive);
476xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard2eac5032000-01-09 21:08:56 +0000477xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
Daniel Veillard16253641998-10-28 22:58:05 +0000478
479/*
480 * Navigating
481 */
Daniel Veillard3dbfdca1999-12-15 19:08:23 +0000482xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000483xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
484int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard3e6d2372000-03-04 11:39:43 +0000485int xmlIsBlankNode (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000486
487/*
488 * Changing the structure
489 */
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000490xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
491 xmlNodePtr root);
492void xmlNodeSetName (xmlNodePtr cur,
493 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000494xmlNodePtr xmlAddChild (xmlNodePtr parent,
495 xmlNodePtr cur);
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000496xmlNodePtr xmlReplaceNode (xmlNodePtr old,
497 xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000498xmlNodePtr xmlAddSibling (xmlNodePtr cur,
499 xmlNodePtr elem);
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000500xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
501 xmlNodePtr elem);
502xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
503 xmlNodePtr elem);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000504void xmlUnlinkNode (xmlNodePtr cur);
505xmlNodePtr xmlTextMerge (xmlNodePtr first,
506 xmlNodePtr second);
507void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000508 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000509 int len);
510void xmlFreeNodeList (xmlNodePtr cur);
511void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000512
513/*
514 * Namespaces
515 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000516xmlNsPtr xmlSearchNs (xmlDocPtr doc,
517 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000518 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000519xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
520 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000521 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000522xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
523 xmlNodePtr node);
524void xmlSetNs (xmlNodePtr node,
525 xmlNsPtr ns);
526xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
527xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000528
Daniel Veillard16253641998-10-28 22:58:05 +0000529/*
530 * Changing the content.
531 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000532xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000533 const xmlChar *name,
534 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000535xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000536 const xmlChar *name);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000537xmlChar * xmlGetNsProp (xmlNodePtr node,
538 const xmlChar *name,
Ramiro Estrugobfce3771999-12-15 04:32:07 +0000539 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000540xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000541 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000542xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000543 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000544 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000545xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000546 xmlNodePtr list,
547 int inLine);
548void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000549 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000550void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000551 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000552 int len);
553void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000554 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000555void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000556 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000557 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000558xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarda819dac1999-11-24 18:04:22 +0000559xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000560void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000561 const xmlChar *lang);
Daniel Veillardcf461992000-03-14 18:30:20 +0000562int xmlNodeGetSpacePreserve (xmlNodePtr cur);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000563xmlChar * xmlNodeGetBase (xmlDocPtr doc,
564 xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000565
566/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000567 * Removing content.
568 */
Daniel Veillardcf461992000-03-14 18:30:20 +0000569int xmlRemoveProp (xmlAttrPtr attr);
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000570int xmlRemoveNode (xmlNodePtr node); /* TODO */
571
572/*
Daniel Veillard16253641998-10-28 22:58:05 +0000573 * Internal, don't use
574 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000575void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000576 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000577void xmlBufferWriteChar (xmlBufferPtr buf,
578 const char *string);
579void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000580 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000581
Daniel Veillard16253641998-10-28 22:58:05 +0000582/*
Daniel Veillardcf461992000-03-14 18:30:20 +0000583 * Namespace handling
584 */
585int xmlReconciliateNs (xmlDocPtr doc,
586 xmlNodePtr tree);
587
588/*
Daniel Veillard16253641998-10-28 22:58:05 +0000589 * Saving
590 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000591void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000592 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000593 int *size);
594void xmlDocDump (FILE *f,
595 xmlDocPtr cur);
Daniel Veillarddbfd6411999-12-28 16:35:14 +0000596void xmlElemDump (FILE *f,
Daniel Veillard06047432000-04-24 11:33:38 +0000597 xmlDocPtr doc,
598 xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000599int xmlSaveFile (const char *filename,
600 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000601
Daniel Veillard16253641998-10-28 22:58:05 +0000602/*
603 * Compression
604 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000605int xmlGetDocCompressMode (xmlDocPtr doc);
606void xmlSetDocCompressMode (xmlDocPtr doc,
607 int mode);
608int xmlGetCompressMode (void);
609void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000610
611#ifdef __cplusplus
612}
613#endif
614
615#endif /* __XML_TREE_H__ */
616