blob: e046073a6bbb49e4e56980bbf4f756101503b199 [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
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
Daniel Veillard39a1f9a1999-01-17 19:11:59 +000018#include <stdio.h>
19
Daniel Veillard260a68f1998-08-13 03:39:55 +000020/*
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,
39 XML_HTML_DOCUMENT_NODE= 13
Daniel Veillardccb09631998-10-27 06:21:04 +000040} xmlElementType;
41
42/*
Daniel Veillard0ba4d531998-11-01 19:34:31 +000043 * Size of an internal character representation.
44 *
45 * Currently we use 8bit chars internal representation for memory efficiency,
46 * but the parser is not tied to that, just define UNICODE to switch to
47 * a 16 bits internal representation. Note that with 8 bits wide
Daniel Veillarddd6b3671999-09-23 22:19:22 +000048 * xmlChars one can still use UTF-8 to handle correctly non ISO-Latin
Daniel Veillard0ba4d531998-11-01 19:34:31 +000049 * input.
Daniel Veillard260a68f1998-08-13 03:39:55 +000050 */
Daniel Veillarddd6b3671999-09-23 22:19:22 +000051
Daniel Veillard260a68f1998-08-13 03:39:55 +000052#ifdef UNICODE
Daniel Veillarddd6b3671999-09-23 22:19:22 +000053typedef unsigned short xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000054#else
Daniel Veillarddd6b3671999-09-23 22:19:22 +000055typedef unsigned char xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000056#endif
57
Daniel Veillarddd6b3671999-09-23 22:19:22 +000058#ifndef WIN32
59#ifndef CHAR
60#define CHAR xmlChar
61#endif
62#endif
63
64#define BAD_CAST (xmlChar *)
Daniel Veillardb96e6431999-08-29 21:02:19 +000065
Daniel Veillard260a68f1998-08-13 03:39:55 +000066/*
67 * a DTD Notation definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000068 */
69
Daniel Veillard1e346af1999-02-22 10:33:01 +000070typedef struct xmlNotation {
Daniel Veillarddd6b3671999-09-23 22:19:22 +000071 const xmlChar *name; /* Notation name */
72 const xmlChar *PublicID; /* Public identifier, if any */
73 const xmlChar *SystemID; /* System identifier, if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +000074} xmlNotation;
75typedef xmlNotation *xmlNotationPtr;
76
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
101typedef struct xmlEnumeration {
102 struct xmlEnumeration *next; /* next one */
Daniel Veillard6077d031999-10-09 09:11:45 +0000103 const xmlChar *name; /* Enumeration name */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000104} xmlEnumeration;
105typedef xmlEnumeration *xmlEnumerationPtr;
106
107typedef struct xmlAttribute {
Daniel Veillard6077d031999-10-09 09:11:45 +0000108 const xmlChar *elem; /* Element holding the attribute */
109 const xmlChar *name; /* Attribute name */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000110 struct xmlAttribute *next; /* list of attributes of an element */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000111 xmlAttributeType type; /* The type */
112 xmlAttributeDefault def; /* the default */
Daniel Veillard6077d031999-10-09 09:11:45 +0000113 const xmlChar *defaultValue;/* or the default value */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000114 xmlEnumerationPtr tree; /* or the enumeration tree if any */
Daniel Veillard10a2c651999-12-12 13:03:50 +0000115 const xmlChar *prefix; /* the namespace prefix if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000116} xmlAttribute;
117typedef xmlAttribute *xmlAttributePtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000118
Daniel Veillard260a68f1998-08-13 03:39:55 +0000119/*
120 * a DTD Element definition.
121 */
Daniel Veillard1899e851999-02-01 12:18:54 +0000122typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000123 XML_ELEMENT_CONTENT_PCDATA = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000124 XML_ELEMENT_CONTENT_ELEMENT,
125 XML_ELEMENT_CONTENT_SEQ,
126 XML_ELEMENT_CONTENT_OR
127} xmlElementContentType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000128
Daniel Veillard1899e851999-02-01 12:18:54 +0000129typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000130 XML_ELEMENT_CONTENT_ONCE = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000131 XML_ELEMENT_CONTENT_OPT,
132 XML_ELEMENT_CONTENT_MULT,
133 XML_ELEMENT_CONTENT_PLUS
134} xmlElementContentOccur;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000135
136typedef struct xmlElementContent {
Daniel Veillard1899e851999-02-01 12:18:54 +0000137 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
138 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
Daniel Veillard6077d031999-10-09 09:11:45 +0000139 const xmlChar *name; /* Element name */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000140 struct xmlElementContent *c1; /* first child */
141 struct xmlElementContent *c2; /* second child */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000142} xmlElementContent;
143typedef xmlElementContent *xmlElementContentPtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000144
Daniel Veillard1899e851999-02-01 12:18:54 +0000145typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000146 XML_ELEMENT_TYPE_EMPTY = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000147 XML_ELEMENT_TYPE_ANY,
148 XML_ELEMENT_TYPE_MIXED,
149 XML_ELEMENT_TYPE_ELEMENT
150} xmlElementTypeVal;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000151
152typedef struct xmlElement {
Daniel Veillard6077d031999-10-09 09:11:45 +0000153 const xmlChar *name; /* Element name */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000154 xmlElementTypeVal type; /* The type */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000155 xmlElementContentPtr content; /* the allowed element content */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000156 xmlAttributePtr attributes; /* List of the declared attributes */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000157} xmlElement;
158typedef xmlElement *xmlElementPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000159
160/*
161 * An XML namespace.
162 * Note that prefix == NULL is valid, it defines the default namespace
163 * within the subtree (until overriden).
164 */
165
Daniel Veillard1899e851999-02-01 12:18:54 +0000166typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000167 XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */
Daniel Veillard1899e851999-02-01 12:18:54 +0000168 XML_LOCAL_NAMESPACE /* new style local scoping */
169} xmlNsType;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000170
171typedef struct xmlNs {
172 struct xmlNs *next; /* next Ns link for this node */
Daniel Veillard1899e851999-02-01 12:18:54 +0000173 xmlNsType type; /* global or local */
Daniel Veillard6077d031999-10-09 09:11:45 +0000174 const xmlChar *href; /* URL for the namespace */
175 const xmlChar *prefix; /* prefix for the namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000176} xmlNs;
177typedef xmlNs *xmlNsPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000178
179/*
180 * An XML DtD, as defined by <!DOCTYPE.
181 */
182typedef struct xmlDtd {
Daniel Veillard6077d031999-10-09 09:11:45 +0000183 const xmlChar *name; /* Name of the DTD */
184 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
185 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000186 void *notations; /* Hash table for notations if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000187 void *elements; /* Hash table for elements if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000188 void *attributes; /* Hash table for attributes if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000189 void *entities; /* Hash table for entities if any */
190 /* struct xmlDtd *next; * next link for this document */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000191} xmlDtd;
192typedef xmlDtd *xmlDtdPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000193
194/*
195 * A attribute of an XML node.
196 */
197typedef struct xmlAttr {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000198#ifndef XML_WITHOUT_CORBA
199 void *_private; /* for Corba, must be first ! */
200 void *vepv; /* for Corba, must be next ! */
201#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000202 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be third ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000203 struct xmlNode *node; /* attr->node link */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000204 struct xmlAttr *next; /* attribute list link */
Daniel Veillard6077d031999-10-09 09:11:45 +0000205 const xmlChar *name; /* the name of the property */
Daniel Veillardccb09631998-10-27 06:21:04 +0000206 struct xmlNode *val; /* the value of the property */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000207 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000208} xmlAttr;
209typedef xmlAttr *xmlAttrPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000210
211/*
Daniel Veillard991e63d1999-08-15 23:32:28 +0000212 * An XML ID instance.
213 */
214
215typedef struct xmlID {
216 struct xmlID *next; /* next ID */
Daniel Veillard6077d031999-10-09 09:11:45 +0000217 const xmlChar *value; /* The ID name */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000218 xmlAttrPtr attr; /* The attribut holding it */
219} xmlID;
220typedef xmlID *xmlIDPtr;
221
222/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000223 * An XML IDREF instance.
224 */
225
226typedef struct xmlRef {
227 struct xmlRef *next; /* next Ref */
Daniel Veillard6077d031999-10-09 09:11:45 +0000228 const xmlChar *value; /* The Ref name */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000229 xmlAttrPtr attr; /* The attribut holding it */
230} xmlRef;
231typedef xmlRef *xmlRefPtr;
232
233/*
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000234 * A buffer structure
235 */
236
237typedef enum {
238 XML_BUFFER_ALLOC_DOUBLEIT,
239 XML_BUFFER_ALLOC_EXACT
240} xmlBufferAllocationScheme;
241
242typedef struct xmlBuffer {
243 xmlChar *content; /* The buffer content UTF8 */
244 unsigned int use; /* The buffer size used */
245 unsigned int size; /* The buffer size */
246 xmlBufferAllocationScheme alloc; /* The realloc method */
247} _xmlBuffer;
248typedef _xmlBuffer xmlBuffer;
249typedef xmlBuffer *xmlBufferPtr;
250
251/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000252 * A node in an XML tree.
253 */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000254typedef struct xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000255#ifndef XML_WITHOUT_CORBA
256 void *_private; /* for Corba, must be first ! */
257 void *vepv; /* for Corba, must be next ! */
258#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000259 xmlElementType type; /* type number in the DTD, must be third ! */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000260 struct xmlDoc *doc; /* the containing document */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000261 struct xmlNode *parent; /* child->parent link */
262 struct xmlNode *next; /* next sibling link */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000263 struct xmlNode *prev; /* previous sibling link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000264 struct xmlNode *childs; /* parent->childs link */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000265 struct xmlNode *last; /* last child link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000266 struct xmlAttr *properties; /* properties list */
Daniel Veillard6077d031999-10-09 09:11:45 +0000267 const xmlChar *name; /* the name of the node, or the entity */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000268 xmlNs *ns; /* pointer to the associated namespace */
269 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000270#ifndef XML_USE_BUFFER_CONTENT
Daniel Veillard6077d031999-10-09 09:11:45 +0000271 xmlChar *content; /* the content */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000272#else
273 xmlBufferPtr content; /* the content in a buffer */
274#endif
Daniel Veillard1e346af1999-02-22 10:33:01 +0000275} _xmlNode;
276typedef _xmlNode xmlNode;
277typedef _xmlNode *xmlNodePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000278
279/*
280 * An XML document.
281 */
282typedef struct xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000283#ifndef XML_WITHOUT_CORBA
284 void *_private; /* for Corba, must be first ! */
285 void *vepv; /* for Corba, must be next ! */
286#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000287 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000288 char *name; /* name/filename/URI of the document */
Daniel Veillard6077d031999-10-09 09:11:45 +0000289 const xmlChar *version; /* the XML version string */
290 const xmlChar *encoding; /* encoding, if any */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000291 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000292 int standalone; /* standalone document (no external refs) */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000293 struct xmlDtd *intSubset; /* the document internal subset */
294 struct xmlDtd *extSubset; /* the document external subset */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000295 struct xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000296 struct xmlNode *root; /* the document tree */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000297 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000298 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000299} _xmlDoc;
300typedef _xmlDoc xmlDoc;
301typedef xmlDoc *xmlDocPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000302
303/*
304 * Variables.
305 */
306extern xmlNsPtr baseDTD;
307extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
308extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000309extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000310
311/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000312 * Handling Buffers.
313 */
314
Daniel Veillardb96e6431999-08-29 21:02:19 +0000315xmlBufferPtr xmlBufferCreate (void);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000316xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000317void xmlBufferFree (xmlBufferPtr buf);
318int xmlBufferDump (FILE *file,
319 xmlBufferPtr buf);
320void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000321 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000322 int len);
323void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000324 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000325void xmlBufferCCat (xmlBufferPtr buf,
326 const char *str);
327int xmlBufferShrink (xmlBufferPtr buf,
328 int len);
329void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000330const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
331int xmlBufferUse (const xmlBufferPtr buf);
332void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
333 xmlBufferAllocationScheme scheme);
334int xmlBufferLength (const xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000335
336/*
Daniel Veillard16253641998-10-28 22:58:05 +0000337 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000338 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000339xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000340 const xmlChar *name,
341 const xmlChar *ExternalID,
342 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000343xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000344 const xmlChar *name,
345 const xmlChar *ExternalID,
346 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000347void xmlFreeDtd (xmlDtdPtr cur);
348xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000349 const xmlChar *href,
350 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000351xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000352 const xmlChar *href,
353 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000354void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000355xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000356void xmlFreeDoc (xmlDocPtr cur);
357xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000358 const xmlChar *name,
359 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000360xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000361 const xmlChar *name,
362 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000363xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
364 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000365 const xmlChar *name,
366 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000367void xmlFreePropList (xmlAttrPtr cur);
368void xmlFreeProp (xmlAttrPtr cur);
369xmlAttrPtr xmlCopyProp (xmlNodePtr target,
370 xmlAttrPtr cur);
371xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
372 xmlAttrPtr cur);
373xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
374xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
375 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000376
377/*
378 * Creating new nodes
379 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000380xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
381 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000382 const xmlChar *name,
383 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000384xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
385 xmlNsPtr ns,
386 const xmlChar *name,
387 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000388xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000389 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000390xmlNodePtr xmlNewChild (xmlNodePtr parent,
391 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000392 const xmlChar *name,
393 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000394xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
395 xmlNsPtr ns,
396 const xmlChar *name,
397 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000398xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000399 const xmlChar *content);
400xmlNodePtr xmlNewText (const xmlChar *content);
401xmlNodePtr xmlNewPI (const xmlChar *name,
402 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000403xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000404 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000405 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000406xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000407 int len);
408xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000409 const xmlChar *content);
410xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000411xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000412 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000413 int len);
414xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000415 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000416xmlNodePtr xmlCopyNode (xmlNodePtr node,
417 int recursive);
418xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000419
420/*
421 * Navigating
422 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000423xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
424int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000425
426/*
427 * Changing the structure
428 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000429xmlNodePtr xmlAddChild (xmlNodePtr parent,
430 xmlNodePtr cur);
431xmlNodePtr xmlAddSibling (xmlNodePtr cur,
432 xmlNodePtr elem);
433void xmlUnlinkNode (xmlNodePtr cur);
434xmlNodePtr xmlTextMerge (xmlNodePtr first,
435 xmlNodePtr second);
436void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000437 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000438 int len);
439void xmlFreeNodeList (xmlNodePtr cur);
440void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000441
442/*
443 * Namespaces
444 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000445xmlNsPtr xmlSearchNs (xmlDocPtr doc,
446 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000447 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000448xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
449 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000450 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000451xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
452 xmlNodePtr node);
453void xmlSetNs (xmlNodePtr node,
454 xmlNsPtr ns);
455xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
456xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000457
Daniel Veillard16253641998-10-28 22:58:05 +0000458/*
459 * Changing the content.
460 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000461xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000462 const xmlChar *name,
463 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000464xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000465 const xmlChar *name);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000466xmlChar * xmlGetNsProp (xmlNodePtr node,
467 const xmlChar *name,
468 const xmlChar *namespace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000469xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000470 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000471xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000472 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000473 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000474xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000475 xmlNodePtr list,
476 int inLine);
477void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000478 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000479void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000480 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000481 int len);
482void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000483 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000484void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000485 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000486 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000487xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarda819dac1999-11-24 18:04:22 +0000488xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000489void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000490 const xmlChar *lang);
Daniel Veillard10a2c651999-12-12 13:03:50 +0000491xmlChar * xmlNodeGetBase (xmlDocPtr doc,
492 xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000493
494/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000495 * Removing content.
496 */
497int xmlRemoveProp (xmlAttrPtr attr); /* TODO */
498int xmlRemoveNode (xmlNodePtr node); /* TODO */
499
500/*
Daniel Veillard16253641998-10-28 22:58:05 +0000501 * Internal, don't use
502 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000503void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000504 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000505void xmlBufferWriteChar (xmlBufferPtr buf,
506 const char *string);
507void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000508 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000509
Daniel Veillard16253641998-10-28 22:58:05 +0000510/*
511 * Saving
512 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000513void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000514 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000515 int *size);
516void xmlDocDump (FILE *f,
517 xmlDocPtr cur);
518int xmlSaveFile (const char *filename,
519 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000520
Daniel Veillard16253641998-10-28 22:58:05 +0000521/*
522 * Compression
523 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000524int xmlGetDocCompressMode (xmlDocPtr doc);
525void xmlSetDocCompressMode (xmlDocPtr doc,
526 int mode);
527int xmlGetCompressMode (void);
528void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000529
530#ifdef __cplusplus
531}
532#endif
533
534#endif /* __XML_TREE_H__ */
535