blob: 5e09f64fc182bbc866845505c07d610b8b55fef2 [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#ifdef __cplusplus
17extern "C" {
18#endif
19
20/*
Daniel Veillardccb09631998-10-27 06:21:04 +000021 * The different element types carried by an XML tree
22 *
23 * NOTE: This is synchronized with DOM Level1 values
24 * See http://www.w3.org/TR/REC-DOM-Level-1/
25 */
26typedef enum {
27 XML_ELEMENT_NODE= 1,
28 XML_ATTRIBUTE_NODE= 2,
29 XML_TEXT_NODE= 3,
30 XML_CDATA_SECTION_NODE= 4,
31 XML_ENTITY_REF_NODE= 5,
32 XML_ENTITY_NODE= 6,
33 XML_PI_NODE= 7,
34 XML_COMMENT_NODE= 8,
35 XML_DOCUMENT_NODE= 9,
36 XML_DOCUMENT_TYPE_NODE= 10,
37 XML_DOCUMENT_FRAG_NODE= 11,
Daniel Veillard7c1206f1999-10-14 09:10:25 +000038 XML_NOTATION_NODE= 12,
Daniel Veillardcf461992000-03-14 18:30:20 +000039 XML_HTML_DOCUMENT_NODE= 13,
40 XML_DTD_NODE= 14,
41 XML_ELEMENT_DECL= 15,
42 XML_ATTRIBUTE_DECL= 16,
Daniel Veillard39c7d712000-09-10 16:14:55 +000043 XML_ENTITY_DECL= 17,
Daniel Veillard9e8bfae2000-11-06 16:43:11 +000044 XML_NAMESPACE_DECL= 18,
45 XML_XINCLUDE_START= 19,
46 XML_XINCLUDE_END= 20
Daniel Veillarda4964b72000-10-31 18:23:44 +000047#ifdef LIBXML_SGML_ENABLED
Daniel Veillard9e8bfae2000-11-06 16:43:11 +000048 ,XML_SGML_DOCUMENT_NODE= 21
Daniel Veillard39c7d712000-09-10 16:14:55 +000049#endif
Daniel Veillardccb09631998-10-27 06:21:04 +000050} xmlElementType;
51
52/*
Daniel Veillard0ba4d531998-11-01 19:34:31 +000053 * Size of an internal character representation.
54 *
Daniel Veillardcf461992000-03-14 18:30:20 +000055 * We use 8bit chars internal representation for memory efficiency,
56 * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle
57 * correctly non ISO-Latin input.
Daniel Veillard260a68f1998-08-13 03:39:55 +000058 */
Daniel Veillarddd6b3671999-09-23 22:19:22 +000059
Daniel Veillarddd6b3671999-09-23 22:19:22 +000060typedef unsigned char xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000061
Daniel Veillarddd6b3671999-09-23 22:19:22 +000062#ifndef WIN32
63#ifndef CHAR
64#define CHAR xmlChar
65#endif
66#endif
67
68#define BAD_CAST (xmlChar *)
Daniel Veillardb96e6431999-08-29 21:02:19 +000069
Daniel Veillard260a68f1998-08-13 03:39:55 +000070/*
71 * a DTD Notation definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000072 */
73
Daniel Veillard71b656e2000-01-05 14:46:17 +000074typedef struct _xmlNotation xmlNotation;
75typedef xmlNotation *xmlNotationPtr;
76struct _xmlNotation {
Daniel Veillarddd6b3671999-09-23 22:19:22 +000077 const xmlChar *name; /* Notation name */
78 const xmlChar *PublicID; /* Public identifier, if any */
79 const xmlChar *SystemID; /* System identifier, if any */
Daniel Veillard71b656e2000-01-05 14:46:17 +000080};
Daniel Veillard1e346af1999-02-22 10:33:01 +000081
Daniel Veillard260a68f1998-08-13 03:39:55 +000082/*
83 * a DTD Attribute definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000084 */
85
Daniel Veillard1e346af1999-02-22 10:33:01 +000086typedef enum {
87 XML_ATTRIBUTE_CDATA = 1,
88 XML_ATTRIBUTE_ID,
89 XML_ATTRIBUTE_IDREF ,
90 XML_ATTRIBUTE_IDREFS,
91 XML_ATTRIBUTE_ENTITY,
92 XML_ATTRIBUTE_ENTITIES,
93 XML_ATTRIBUTE_NMTOKEN,
94 XML_ATTRIBUTE_NMTOKENS,
95 XML_ATTRIBUTE_ENUMERATION,
96 XML_ATTRIBUTE_NOTATION
97} xmlAttributeType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +000098
Daniel Veillard1e346af1999-02-22 10:33:01 +000099typedef enum {
100 XML_ATTRIBUTE_NONE = 1,
101 XML_ATTRIBUTE_REQUIRED,
102 XML_ATTRIBUTE_IMPLIED,
103 XML_ATTRIBUTE_FIXED
104} xmlAttributeDefault;
105
Daniel Veillard71b656e2000-01-05 14:46:17 +0000106typedef struct _xmlEnumeration xmlEnumeration;
Daniel Veillard1e346af1999-02-22 10:33:01 +0000107typedef xmlEnumeration *xmlEnumerationPtr;
Daniel Veillard71b656e2000-01-05 14:46:17 +0000108struct _xmlEnumeration {
109 struct _xmlEnumeration *next; /* next one */
110 const xmlChar *name; /* Enumeration name */
111};
Daniel Veillard1e346af1999-02-22 10:33:01 +0000112
Daniel Veillard71b656e2000-01-05 14:46:17 +0000113typedef struct _xmlAttribute xmlAttribute;
114typedef xmlAttribute *xmlAttributePtr;
115struct _xmlAttribute {
Daniel Veillardcf461992000-03-14 18:30:20 +0000116#ifndef XML_WITHOUT_CORBA
117 void *_private; /* for Corba, must be first ! */
118#endif
119 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
120 const xmlChar *name; /* Attribute name */
121 struct _xmlNode *children; /* NULL */
122 struct _xmlNode *last; /* NULL */
123 struct _xmlDtd *parent; /* -> DTD */
124 struct _xmlNode *next; /* next sibling link */
125 struct _xmlNode *prev; /* previous sibling link */
126 struct _xmlDoc *doc; /* the containing document */
127
128 struct _xmlAttribute *nexth; /* next in hash table */
129 xmlAttributeType atype; /* The attribute type */
130 xmlAttributeDefault def; /* the default */
131 const xmlChar *defaultValue; /* or the default value */
132 xmlEnumerationPtr tree; /* or the enumeration tree if any */
133 const xmlChar *prefix; /* the namespace prefix if any */
134 const xmlChar *elem; /* Element holding the attribute */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000135};
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000136
Daniel Veillard260a68f1998-08-13 03:39:55 +0000137/*
138 * a DTD Element definition.
139 */
Daniel Veillard1899e851999-02-01 12:18:54 +0000140typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000141 XML_ELEMENT_CONTENT_PCDATA = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000142 XML_ELEMENT_CONTENT_ELEMENT,
143 XML_ELEMENT_CONTENT_SEQ,
144 XML_ELEMENT_CONTENT_OR
145} xmlElementContentType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000146
Daniel Veillard1899e851999-02-01 12:18:54 +0000147typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000148 XML_ELEMENT_CONTENT_ONCE = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000149 XML_ELEMENT_CONTENT_OPT,
150 XML_ELEMENT_CONTENT_MULT,
151 XML_ELEMENT_CONTENT_PLUS
152} xmlElementContentOccur;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000153
Daniel Veillard71b656e2000-01-05 14:46:17 +0000154typedef struct _xmlElementContent xmlElementContent;
155typedef xmlElementContent *xmlElementContentPtr;
156struct _xmlElementContent {
Daniel Veillard1899e851999-02-01 12:18:54 +0000157 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
158 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
Daniel Veillard6077d031999-10-09 09:11:45 +0000159 const xmlChar *name; /* Element name */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000160 struct _xmlElementContent *c1; /* first child */
161 struct _xmlElementContent *c2; /* second child */
162};
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000163
Daniel Veillard1899e851999-02-01 12:18:54 +0000164typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000165 XML_ELEMENT_TYPE_EMPTY = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000166 XML_ELEMENT_TYPE_ANY,
167 XML_ELEMENT_TYPE_MIXED,
168 XML_ELEMENT_TYPE_ELEMENT
169} xmlElementTypeVal;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000170
Daniel Veillard71b656e2000-01-05 14:46:17 +0000171typedef struct _xmlElement xmlElement;
172typedef xmlElement *xmlElementPtr;
173struct _xmlElement {
Daniel Veillardcf461992000-03-14 18:30:20 +0000174#ifndef XML_WITHOUT_CORBA
175 void *_private; /* for Corba, must be first ! */
176#endif
177 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
Daniel Veillard6077d031999-10-09 09:11:45 +0000178 const xmlChar *name; /* Element name */
Daniel Veillardcf461992000-03-14 18:30:20 +0000179 struct _xmlNode *children; /* NULL */
180 struct _xmlNode *last; /* NULL */
181 struct _xmlDtd *parent; /* -> DTD */
182 struct _xmlNode *next; /* next sibling link */
183 struct _xmlNode *prev; /* previous sibling link */
184 struct _xmlDoc *doc; /* the containing document */
185
186 xmlElementTypeVal etype; /* The type */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000187 xmlElementContentPtr content; /* the allowed element content */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000188 xmlAttributePtr attributes; /* List of the declared attributes */
Daniel Veillardbe803962000-06-28 23:40:59 +0000189 const xmlChar *prefix; /* the namespace prefix if any */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000190};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000191
192/*
193 * An XML namespace.
194 * Note that prefix == NULL is valid, it defines the default namespace
195 * within the subtree (until overriden).
Daniel Veillarda4964b72000-10-31 18:23:44 +0000196 *
197 * XML_GLOBAL_NAMESPACE is now deprecated for good
198 * xmlNsType is unified with xmlElementType
Daniel Veillard260a68f1998-08-13 03:39:55 +0000199 */
200
Daniel Veillarda4964b72000-10-31 18:23:44 +0000201#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
202typedef xmlElementType xmlNsType;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000203
Daniel Veillard71b656e2000-01-05 14:46:17 +0000204typedef struct _xmlNs xmlNs;
205typedef xmlNs *xmlNsPtr;
206struct _xmlNs {
207 struct _xmlNs *next; /* next Ns link for this node */
Daniel Veillard1899e851999-02-01 12:18:54 +0000208 xmlNsType type; /* global or local */
Daniel Veillard6077d031999-10-09 09:11:45 +0000209 const xmlChar *href; /* URL for the namespace */
210 const xmlChar *prefix; /* prefix for the namespace */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000211};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000212
213/*
214 * An XML DtD, as defined by <!DOCTYPE.
215 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000216typedef struct _xmlDtd xmlDtd;
217typedef xmlDtd *xmlDtdPtr;
218struct _xmlDtd {
Daniel Veillardcf461992000-03-14 18:30:20 +0000219#ifndef XML_WITHOUT_CORBA
220 void *_private; /* for Corba, must be first ! */
221#endif
222 xmlElementType type; /* XML_DTD_NODE, must be second ! */
Daniel Veillard6077d031999-10-09 09:11:45 +0000223 const xmlChar *name; /* Name of the DTD */
Daniel Veillardcf461992000-03-14 18:30:20 +0000224 struct _xmlNode *children; /* the value of the property link */
225 struct _xmlNode *last; /* last child link */
226 struct _xmlDoc *parent; /* child->parent link */
227 struct _xmlNode *next; /* next sibling link */
228 struct _xmlNode *prev; /* previous sibling link */
229 struct _xmlDoc *doc; /* the containing document */
230
231 /* End of common part */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000232 void *notations; /* Hash table for notations if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000233 void *elements; /* Hash table for elements if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000234 void *attributes; /* Hash table for attributes if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000235 void *entities; /* Hash table for entities if any */
Daniel Veillardcf461992000-03-14 18:30:20 +0000236 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
237 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
Daniel Veillard52afe802000-10-22 16:56:02 +0000238 void *pentities; /* Hash table for param entities if any */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000239};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000240
241/*
242 * A attribute of an XML node.
243 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000244typedef struct _xmlAttr xmlAttr;
245typedef xmlAttr *xmlAttrPtr;
246struct _xmlAttr {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000247#ifndef XML_WITHOUT_CORBA
248 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000249#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000250 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000251 const xmlChar *name; /* the name of the property */
Daniel Veillardcf461992000-03-14 18:30:20 +0000252 struct _xmlNode *children; /* the value of the property */
253 struct _xmlNode *last; /* NULL */
254 struct _xmlNode *parent; /* child->parent link */
255 struct _xmlAttr *next; /* next sibling link */
256 struct _xmlAttr *prev; /* previous sibling link */
257 struct _xmlDoc *doc; /* the containing document */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000258 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillardcf461992000-03-14 18:30:20 +0000259 xmlAttributeType atype; /* the attribute type if validating */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000260};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000261
262/*
Daniel Veillard991e63d1999-08-15 23:32:28 +0000263 * An XML ID instance.
264 */
265
Daniel Veillard71b656e2000-01-05 14:46:17 +0000266typedef struct _xmlID xmlID;
267typedef xmlID *xmlIDPtr;
268struct _xmlID {
269 struct _xmlID *next; /* next ID */
Daniel Veillard6077d031999-10-09 09:11:45 +0000270 const xmlChar *value; /* The ID name */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000271 xmlAttrPtr attr; /* The attribut holding it */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000272};
Daniel Veillard991e63d1999-08-15 23:32:28 +0000273
274/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000275 * An XML IDREF instance.
276 */
277
Daniel Veillard71b656e2000-01-05 14:46:17 +0000278typedef struct _xmlRef xmlRef;
279typedef xmlRef *xmlRefPtr;
280struct _xmlRef {
281 struct _xmlRef *next; /* next Ref */
Daniel Veillard6077d031999-10-09 09:11:45 +0000282 const xmlChar *value; /* The Ref name */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000283 xmlAttrPtr attr; /* The attribut holding it */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000284};
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000285
286/*
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000287 * A buffer structure
288 */
289
290typedef enum {
291 XML_BUFFER_ALLOC_DOUBLEIT,
292 XML_BUFFER_ALLOC_EXACT
293} xmlBufferAllocationScheme;
294
Daniel Veillard71b656e2000-01-05 14:46:17 +0000295typedef struct _xmlBuffer xmlBuffer;
296typedef xmlBuffer *xmlBufferPtr;
297struct _xmlBuffer {
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000298 xmlChar *content; /* The buffer content UTF8 */
299 unsigned int use; /* The buffer size used */
300 unsigned int size; /* The buffer size */
301 xmlBufferAllocationScheme alloc; /* The realloc method */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000302};
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000303
304/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000305 * A node in an XML tree.
306 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000307typedef struct _xmlNode xmlNode;
308typedef xmlNode *xmlNodePtr;
309struct _xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000310#ifndef XML_WITHOUT_CORBA
311 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000312#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000313 xmlElementType type; /* type number, must be second ! */
314 const xmlChar *name; /* the name of the node, or the entity */
315 struct _xmlNode *children; /* parent->childs link */
316 struct _xmlNode *last; /* last child link */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000317 struct _xmlNode *parent; /* child->parent link */
318 struct _xmlNode *next; /* next sibling link */
319 struct _xmlNode *prev; /* previous sibling link */
Daniel Veillardcf461992000-03-14 18:30:20 +0000320 struct _xmlDoc *doc; /* the containing document */
321 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000322#ifndef XML_USE_BUFFER_CONTENT
Daniel Veillardcf461992000-03-14 18:30:20 +0000323 xmlChar *content; /* the content */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000324#else
Daniel Veillardcf461992000-03-14 18:30:20 +0000325 xmlBufferPtr content; /* the content in a buffer */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000326#endif
Daniel Veillardcf461992000-03-14 18:30:20 +0000327
328 /* End of common part */
329 struct _xmlAttr *properties;/* properties list */
330 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000331};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000332
333/*
334 * An XML document.
335 */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000336typedef struct _xmlDoc xmlDoc;
337typedef xmlDoc *xmlDocPtr;
338struct _xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000339#ifndef XML_WITHOUT_CORBA
340 void *_private; /* for Corba, must be first ! */
Daniel Veillard27fb0751998-10-17 06:47:46 +0000341#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000342 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000343 char *name; /* name/filename/URI of the document */
Daniel Veillardcf461992000-03-14 18:30:20 +0000344 struct _xmlNode *children; /* the document tree */
345 struct _xmlNode *last; /* last child link */
346 struct _xmlNode *parent; /* child->parent link */
347 struct _xmlNode *next; /* next sibling link */
348 struct _xmlNode *prev; /* previous sibling link */
349 struct _xmlDoc *doc; /* autoreference to itself */
350
351 /* End of common part */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000352 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000353 int standalone; /* standalone document (no external refs) */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000354 struct _xmlDtd *intSubset; /* the document internal subset */
355 struct _xmlDtd *extSubset; /* the document external subset */
356 struct _xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillardcf461992000-03-14 18:30:20 +0000357 const xmlChar *version; /* the XML version string */
Daniel Veillardbe803962000-06-28 23:40:59 +0000358 const xmlChar *encoding; /* external initial encoding, if any */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000359 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000360 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillardcf461992000-03-14 18:30:20 +0000361 const xmlChar *URL; /* The URI for that document */
Daniel Veillardbe803962000-06-28 23:40:59 +0000362 int charset; /* encoding of the in-memory content
363 actually an xmlCharEncoding */
Daniel Veillard71b656e2000-01-05 14:46:17 +0000364};
Daniel Veillard260a68f1998-08-13 03:39:55 +0000365
366/*
Daniel Veillardbe803962000-06-28 23:40:59 +0000367 * Compatibility naming layer with libxml1
368 */
369#ifndef xmlChildrenNode
370#define xmlChildrenNode children
371#define xmlRootNode children
372#endif
373
374/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000375 * Variables.
376 */
Daniel Veillardc2def842000-11-07 14:21:01 +0000377LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
378LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
379LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
380LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
381LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000382
383/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000384 * Handling Buffers.
385 */
386
Daniel Veillardb96e6431999-08-29 21:02:19 +0000387xmlBufferPtr xmlBufferCreate (void);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000388xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000389void xmlBufferFree (xmlBufferPtr buf);
390int xmlBufferDump (FILE *file,
391 xmlBufferPtr buf);
392void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000393 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000394 int len);
Daniel Veillardbe803962000-06-28 23:40:59 +0000395void xmlBufferAddHead (xmlBufferPtr buf,
396 const xmlChar *str,
397 int len);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000398void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000399 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000400void xmlBufferCCat (xmlBufferPtr buf,
401 const char *str);
402int xmlBufferShrink (xmlBufferPtr buf,
Daniel Veillard4b0755c2000-09-25 14:26:28 +0000403 unsigned int len);
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000404int xmlBufferGrow (xmlBufferPtr buf,
Daniel Veillard4b0755c2000-09-25 14:26:28 +0000405 unsigned int len);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000406void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000407const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
408int xmlBufferUse (const xmlBufferPtr buf);
409void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
410 xmlBufferAllocationScheme scheme);
411int xmlBufferLength (const xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000412
413/*
Daniel Veillard16253641998-10-28 22:58:05 +0000414 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000415 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000416xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000417 const xmlChar *name,
418 const xmlChar *ExternalID,
419 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000420xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000421 const xmlChar *name,
422 const xmlChar *ExternalID,
423 const xmlChar *SystemID);
Daniel Veillardd83eb822000-06-30 18:39:56 +0000424xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000425void xmlFreeDtd (xmlDtdPtr cur);
426xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000427 const xmlChar *href,
428 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000429xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000430 const xmlChar *href,
431 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000432void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000433xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000434void xmlFreeDoc (xmlDocPtr cur);
435xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000436 const xmlChar *name,
437 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000438xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000439 const xmlChar *name,
440 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000441xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
442 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000443 const xmlChar *name,
444 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000445void xmlFreePropList (xmlAttrPtr cur);
446void xmlFreeProp (xmlAttrPtr cur);
447xmlAttrPtr xmlCopyProp (xmlNodePtr target,
448 xmlAttrPtr cur);
449xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
450 xmlAttrPtr cur);
451xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
452xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
453 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000454
455/*
456 * Creating new nodes
457 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000458xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
459 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000460 const xmlChar *name,
461 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000462xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
463 xmlNsPtr ns,
464 const xmlChar *name,
465 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000466xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000467 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000468xmlNodePtr xmlNewChild (xmlNodePtr parent,
469 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000470 const xmlChar *name,
471 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000472xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
473 xmlNsPtr ns,
474 const xmlChar *name,
475 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000476xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000477 const xmlChar *content);
478xmlNodePtr xmlNewText (const xmlChar *content);
479xmlNodePtr xmlNewPI (const xmlChar *name,
480 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000481xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000482 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000483 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000484xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000485 int len);
486xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000487 const xmlChar *content);
488xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000489xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000490 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000491 int len);
Daniel Veillardcf461992000-03-14 18:30:20 +0000492xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
493 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000494xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000495 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000496xmlNodePtr xmlCopyNode (xmlNodePtr node,
497 int recursive);
498xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard2eac5032000-01-09 21:08:56 +0000499xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
Daniel Veillard16253641998-10-28 22:58:05 +0000500
501/*
502 * Navigating
503 */
Daniel Veillard3dbfdca1999-12-15 19:08:23 +0000504xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000505xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
506int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard3e6d2372000-03-04 11:39:43 +0000507int xmlIsBlankNode (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000508
509/*
510 * Changing the structure
511 */
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000512xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
513 xmlNodePtr root);
514void xmlNodeSetName (xmlNodePtr cur,
515 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000516xmlNodePtr xmlAddChild (xmlNodePtr parent,
517 xmlNodePtr cur);
Daniel Veillard87b95392000-08-12 21:12:04 +0000518xmlNodePtr xmlAddChildList (xmlNodePtr parent,
519 xmlNodePtr cur);
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000520xmlNodePtr xmlReplaceNode (xmlNodePtr old,
521 xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000522xmlNodePtr xmlAddSibling (xmlNodePtr cur,
523 xmlNodePtr elem);
Daniel Veillard5cb5ab81999-12-21 15:35:29 +0000524xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
525 xmlNodePtr elem);
526xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
527 xmlNodePtr elem);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000528void xmlUnlinkNode (xmlNodePtr cur);
529xmlNodePtr xmlTextMerge (xmlNodePtr first,
530 xmlNodePtr second);
531void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000532 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000533 int len);
534void xmlFreeNodeList (xmlNodePtr cur);
535void xmlFreeNode (xmlNodePtr cur);
Daniel Veillardc2def842000-11-07 14:21:01 +0000536void xmlSetTreeDoc (xmlNodePtr tree,
537 xmlDocPtr doc);
538void xmlSetListDoc (xmlNodePtr list,
539 xmlDocPtr doc);
Daniel Veillard16253641998-10-28 22:58:05 +0000540
541/*
542 * Namespaces
543 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000544xmlNsPtr xmlSearchNs (xmlDocPtr doc,
545 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000546 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000547xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
548 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000549 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000550xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
551 xmlNodePtr node);
552void xmlSetNs (xmlNodePtr node,
553 xmlNsPtr ns);
554xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
555xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000556
Daniel Veillard16253641998-10-28 22:58:05 +0000557/*
558 * Changing the content.
559 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000560xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000561 const xmlChar *name,
562 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000563xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000564 const xmlChar *name);
Daniel Veillard32bc74e2000-07-14 14:49:25 +0000565xmlAttrPtr xmlHasProp (xmlNodePtr node,
566 const xmlChar *name);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000567xmlChar * xmlGetNsProp (xmlNodePtr node,
568 const xmlChar *name,
Ramiro Estrugobfce3771999-12-15 04:32:07 +0000569 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000570xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000571 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000572xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000573 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000574 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000575xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000576 xmlNodePtr list,
577 int inLine);
Daniel Veillardbe803962000-06-28 23:40:59 +0000578xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
579 xmlNodePtr list,
580 int inLine);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000581void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000582 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000583void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000584 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000585 int len);
586void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000587 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000588void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000589 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000590 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000591xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarda819dac1999-11-24 18:04:22 +0000592xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000593void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000594 const xmlChar *lang);
Daniel Veillardcf461992000-03-14 18:30:20 +0000595int xmlNodeGetSpacePreserve (xmlNodePtr cur);
Daniel Veillardbe9ec4b2000-10-25 11:01:53 +0000596void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
597 val);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000598xmlChar * xmlNodeGetBase (xmlDocPtr doc,
599 xmlNodePtr cur);
Daniel Veillardbe9ec4b2000-10-25 11:01:53 +0000600void xmlNodeSetBase (xmlNodePtr cur,
601 xmlChar *uri);
Daniel Veillard16253641998-10-28 22:58:05 +0000602
603/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000604 * Removing content.
605 */
Daniel Veillardcf461992000-03-14 18:30:20 +0000606int xmlRemoveProp (xmlAttrPtr attr);
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000607int xmlRemoveNode (xmlNodePtr node); /* TODO */
608
609/*
Daniel Veillard16253641998-10-28 22:58:05 +0000610 * Internal, don't use
611 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000612void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000613 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000614void xmlBufferWriteChar (xmlBufferPtr buf,
615 const char *string);
616void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000617 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000618
Daniel Veillard16253641998-10-28 22:58:05 +0000619/*
Daniel Veillardcf461992000-03-14 18:30:20 +0000620 * Namespace handling
621 */
622int xmlReconciliateNs (xmlDocPtr doc,
623 xmlNodePtr tree);
624
625/*
Daniel Veillard16253641998-10-28 22:58:05 +0000626 * Saving
627 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000628void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000629 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000630 int *size);
Daniel Veillard58770e72000-11-25 00:48:47 +0000631void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
632 xmlChar **doc_txt_ptr,
633 int * doc_txt_len,
634 const char *txt_encoding);
Daniel Veillardbe803962000-06-28 23:40:59 +0000635int xmlDocDump (FILE *f,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000636 xmlDocPtr cur);
Daniel Veillarddbfd6411999-12-28 16:35:14 +0000637void xmlElemDump (FILE *f,
Daniel Veillard06047432000-04-24 11:33:38 +0000638 xmlDocPtr doc,
639 xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000640int xmlSaveFile (const char *filename,
641 xmlDocPtr cur);
Daniel Veillardb656ebe2000-09-22 13:51:48 +0000642void xmlNodeDump (xmlBufferPtr buf,
643 xmlDocPtr doc,
644 xmlNodePtr cur,
645 int level,
646 int format);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000647
Daniel Veillardbe803962000-06-28 23:40:59 +0000648/* This one is exported from xmlIO.h
649
650int xmlSaveFileTo (xmlOutputBuffer *buf,
651 xmlDocPtr cur,
652 const char *encoding);
653 */
654
655int xmlSaveFileEnc (const char *filename,
656 xmlDocPtr cur,
657 const char *encoding);
658
Daniel Veillard16253641998-10-28 22:58:05 +0000659/*
660 * Compression
661 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000662int xmlGetDocCompressMode (xmlDocPtr doc);
663void xmlSetDocCompressMode (xmlDocPtr doc,
664 int mode);
665int xmlGetCompressMode (void);
666void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000667
668#ifdef __cplusplus
669}
670#endif
671
672#endif /* __XML_TREE_H__ */
673