blob: 6c7e795a8113168cc20fe5e228b516fd8d744407 [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,
38 XML_NOTATION_NODE= 12
39} xmlElementType;
40
41/*
Daniel Veillard0ba4d531998-11-01 19:34:31 +000042 * Size of an internal character representation.
43 *
44 * Currently we use 8bit chars internal representation for memory efficiency,
45 * but the parser is not tied to that, just define UNICODE to switch to
46 * a 16 bits internal representation. Note that with 8 bits wide
Daniel Veillarddd6b3671999-09-23 22:19:22 +000047 * xmlChars one can still use UTF-8 to handle correctly non ISO-Latin
Daniel Veillard0ba4d531998-11-01 19:34:31 +000048 * input.
Daniel Veillard260a68f1998-08-13 03:39:55 +000049 */
Daniel Veillarddd6b3671999-09-23 22:19:22 +000050
Daniel Veillard260a68f1998-08-13 03:39:55 +000051#ifdef UNICODE
Daniel Veillarddd6b3671999-09-23 22:19:22 +000052typedef unsigned short xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000053#else
Daniel Veillarddd6b3671999-09-23 22:19:22 +000054typedef unsigned char xmlChar;
Daniel Veillard260a68f1998-08-13 03:39:55 +000055#endif
56
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 Veillard1e346af1999-02-22 10:33:01 +000069typedef struct xmlNotation {
Daniel Veillarddd6b3671999-09-23 22:19:22 +000070 const xmlChar *name; /* Notation name */
71 const xmlChar *PublicID; /* Public identifier, if any */
72 const xmlChar *SystemID; /* System identifier, if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +000073} xmlNotation;
74typedef xmlNotation *xmlNotationPtr;
75
Daniel Veillard260a68f1998-08-13 03:39:55 +000076/*
77 * a DTD Attribute definition
Daniel Veillard260a68f1998-08-13 03:39:55 +000078 */
79
Daniel Veillard1e346af1999-02-22 10:33:01 +000080typedef enum {
81 XML_ATTRIBUTE_CDATA = 1,
82 XML_ATTRIBUTE_ID,
83 XML_ATTRIBUTE_IDREF ,
84 XML_ATTRIBUTE_IDREFS,
85 XML_ATTRIBUTE_ENTITY,
86 XML_ATTRIBUTE_ENTITIES,
87 XML_ATTRIBUTE_NMTOKEN,
88 XML_ATTRIBUTE_NMTOKENS,
89 XML_ATTRIBUTE_ENUMERATION,
90 XML_ATTRIBUTE_NOTATION
91} xmlAttributeType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +000092
Daniel Veillard1e346af1999-02-22 10:33:01 +000093typedef enum {
94 XML_ATTRIBUTE_NONE = 1,
95 XML_ATTRIBUTE_REQUIRED,
96 XML_ATTRIBUTE_IMPLIED,
97 XML_ATTRIBUTE_FIXED
98} xmlAttributeDefault;
99
100typedef struct xmlEnumeration {
101 struct xmlEnumeration *next; /* next one */
Daniel Veillard6077d031999-10-09 09:11:45 +0000102 const xmlChar *name; /* Enumeration name */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000103} xmlEnumeration;
104typedef xmlEnumeration *xmlEnumerationPtr;
105
106typedef struct xmlAttribute {
Daniel Veillard6077d031999-10-09 09:11:45 +0000107 const xmlChar *elem; /* Element holding the attribute */
108 const xmlChar *name; /* Attribute name */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000109 struct xmlAttribute *next; /* list of attributes of an element */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000110 xmlAttributeType type; /* The type */
111 xmlAttributeDefault def; /* the default */
Daniel Veillard6077d031999-10-09 09:11:45 +0000112 const xmlChar *defaultValue;/* or the default value */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000113 xmlEnumerationPtr tree; /* or the enumeration tree if any */
114} xmlAttribute;
115typedef xmlAttribute *xmlAttributePtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000116
Daniel Veillard260a68f1998-08-13 03:39:55 +0000117/*
118 * a DTD Element definition.
119 */
Daniel Veillard1899e851999-02-01 12:18:54 +0000120typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000121 XML_ELEMENT_CONTENT_PCDATA = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000122 XML_ELEMENT_CONTENT_ELEMENT,
123 XML_ELEMENT_CONTENT_SEQ,
124 XML_ELEMENT_CONTENT_OR
125} xmlElementContentType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000126
Daniel Veillard1899e851999-02-01 12:18:54 +0000127typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000128 XML_ELEMENT_CONTENT_ONCE = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000129 XML_ELEMENT_CONTENT_OPT,
130 XML_ELEMENT_CONTENT_MULT,
131 XML_ELEMENT_CONTENT_PLUS
132} xmlElementContentOccur;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000133
134typedef struct xmlElementContent {
Daniel Veillard1899e851999-02-01 12:18:54 +0000135 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
136 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
Daniel Veillard6077d031999-10-09 09:11:45 +0000137 const xmlChar *name; /* Element name */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000138 struct xmlElementContent *c1; /* first child */
139 struct xmlElementContent *c2; /* second child */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000140} xmlElementContent;
141typedef xmlElementContent *xmlElementContentPtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000142
Daniel Veillard1899e851999-02-01 12:18:54 +0000143typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000144 XML_ELEMENT_TYPE_EMPTY = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000145 XML_ELEMENT_TYPE_ANY,
146 XML_ELEMENT_TYPE_MIXED,
147 XML_ELEMENT_TYPE_ELEMENT
148} xmlElementTypeVal;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000149
150typedef struct xmlElement {
Daniel Veillard6077d031999-10-09 09:11:45 +0000151 const xmlChar *name; /* Element name */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000152 xmlElementTypeVal type; /* The type */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000153 xmlElementContentPtr content; /* the allowed element content */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000154 xmlAttributePtr attributes; /* List of the declared attributes */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000155} xmlElement;
156typedef xmlElement *xmlElementPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000157
158/*
159 * An XML namespace.
160 * Note that prefix == NULL is valid, it defines the default namespace
161 * within the subtree (until overriden).
162 */
163
Daniel Veillard1899e851999-02-01 12:18:54 +0000164typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000165 XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */
Daniel Veillard1899e851999-02-01 12:18:54 +0000166 XML_LOCAL_NAMESPACE /* new style local scoping */
167} xmlNsType;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000168
169typedef struct xmlNs {
170 struct xmlNs *next; /* next Ns link for this node */
Daniel Veillard1899e851999-02-01 12:18:54 +0000171 xmlNsType type; /* global or local */
Daniel Veillard6077d031999-10-09 09:11:45 +0000172 const xmlChar *href; /* URL for the namespace */
173 const xmlChar *prefix; /* prefix for the namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000174} xmlNs;
175typedef xmlNs *xmlNsPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000176
177/*
178 * An XML DtD, as defined by <!DOCTYPE.
179 */
180typedef struct xmlDtd {
Daniel Veillard6077d031999-10-09 09:11:45 +0000181 const xmlChar *name; /* Name of the DTD */
182 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
183 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000184 void *notations; /* Hash table for notations if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000185 void *elements; /* Hash table for elements if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000186 void *attributes; /* Hash table for attributes if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000187 void *entities; /* Hash table for entities if any */
188 /* struct xmlDtd *next; * next link for this document */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000189} xmlDtd;
190typedef xmlDtd *xmlDtdPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000191
192/*
193 * A attribute of an XML node.
194 */
195typedef struct xmlAttr {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000196#ifndef XML_WITHOUT_CORBA
197 void *_private; /* for Corba, must be first ! */
198 void *vepv; /* for Corba, must be next ! */
199#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000200 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be third ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000201 struct xmlNode *node; /* attr->node link */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000202 struct xmlAttr *next; /* attribute list link */
Daniel Veillard6077d031999-10-09 09:11:45 +0000203 const xmlChar *name; /* the name of the property */
Daniel Veillardccb09631998-10-27 06:21:04 +0000204 struct xmlNode *val; /* the value of the property */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000205 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000206} xmlAttr;
207typedef xmlAttr *xmlAttrPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000208
209/*
Daniel Veillard991e63d1999-08-15 23:32:28 +0000210 * An XML ID instance.
211 */
212
213typedef struct xmlID {
214 struct xmlID *next; /* next ID */
Daniel Veillard6077d031999-10-09 09:11:45 +0000215 const xmlChar *value; /* The ID name */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000216 xmlAttrPtr attr; /* The attribut holding it */
217} xmlID;
218typedef xmlID *xmlIDPtr;
219
220/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000221 * An XML IDREF instance.
222 */
223
224typedef struct xmlRef {
225 struct xmlRef *next; /* next Ref */
Daniel Veillard6077d031999-10-09 09:11:45 +0000226 const xmlChar *value; /* The Ref name */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000227 xmlAttrPtr attr; /* The attribut holding it */
228} xmlRef;
229typedef xmlRef *xmlRefPtr;
230
231/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000232 * A node in an XML tree.
233 */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000234typedef struct xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000235#ifndef XML_WITHOUT_CORBA
236 void *_private; /* for Corba, must be first ! */
237 void *vepv; /* for Corba, must be next ! */
238#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000239 xmlElementType type; /* type number in the DTD, must be third ! */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000240 struct xmlDoc *doc; /* the containing document */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000241 struct xmlNode *parent; /* child->parent link */
242 struct xmlNode *next; /* next sibling link */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000243 struct xmlNode *prev; /* previous sibling link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000244 struct xmlNode *childs; /* parent->childs link */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000245 struct xmlNode *last; /* last child link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000246 struct xmlAttr *properties; /* properties list */
Daniel Veillard6077d031999-10-09 09:11:45 +0000247 const xmlChar *name; /* the name of the node, or the entity */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000248 xmlNs *ns; /* pointer to the associated namespace */
249 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillard6077d031999-10-09 09:11:45 +0000250 xmlChar *content; /* the content */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000251} _xmlNode;
252typedef _xmlNode xmlNode;
253typedef _xmlNode *xmlNodePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000254
255/*
256 * An XML document.
257 */
258typedef struct xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000259#ifndef XML_WITHOUT_CORBA
260 void *_private; /* for Corba, must be first ! */
261 void *vepv; /* for Corba, must be next ! */
262#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000263 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000264 char *name; /* name/filename/URI of the document */
Daniel Veillard6077d031999-10-09 09:11:45 +0000265 const xmlChar *version; /* the XML version string */
266 const xmlChar *encoding; /* encoding, if any */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000267 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000268 int standalone; /* standalone document (no external refs) */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000269 struct xmlDtd *intSubset; /* the document internal subset */
270 struct xmlDtd *extSubset; /* the document external subset */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000271 struct xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000272 struct xmlNode *root; /* the document tree */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000273 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000274 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000275} _xmlDoc;
276typedef _xmlDoc xmlDoc;
277typedef xmlDoc *xmlDocPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000278
279/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000280 * A buffer structure
281 */
282
283typedef struct xmlBuffer {
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000284 xmlChar *content; /* The buffer content UTF8 */
Daniel Veillard5099ae81999-04-21 20:12:07 +0000285 unsigned int use; /* The buffer size used */
286 unsigned int size; /* The buffer size */
287} _xmlBuffer;
288typedef _xmlBuffer xmlBuffer;
289typedef xmlBuffer *xmlBufferPtr;
290
291/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000292 * Variables.
293 */
294extern xmlNsPtr baseDTD;
295extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
296extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
297
298/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000299 * Handling Buffers.
300 */
301
Daniel Veillardb96e6431999-08-29 21:02:19 +0000302xmlBufferPtr xmlBufferCreate (void);
303void xmlBufferFree (xmlBufferPtr buf);
304int xmlBufferDump (FILE *file,
305 xmlBufferPtr buf);
306void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000307 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000308 int len);
309void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000310 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000311void xmlBufferCCat (xmlBufferPtr buf,
312 const char *str);
313int xmlBufferShrink (xmlBufferPtr buf,
314 int len);
315void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000316
317/*
Daniel Veillard16253641998-10-28 22:58:05 +0000318 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000319 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000320xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000321 const xmlChar *name,
322 const xmlChar *ExternalID,
323 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000324xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000325 const xmlChar *name,
326 const xmlChar *ExternalID,
327 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000328void xmlFreeDtd (xmlDtdPtr cur);
329xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000330 const xmlChar *href,
331 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000332xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000333 const xmlChar *href,
334 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000335void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000336xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000337void xmlFreeDoc (xmlDocPtr cur);
338xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000339 const xmlChar *name,
340 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000341xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000342 const xmlChar *name,
343 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000344xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
345 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000346 const xmlChar *name,
347 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000348void xmlFreePropList (xmlAttrPtr cur);
349void xmlFreeProp (xmlAttrPtr cur);
350xmlAttrPtr xmlCopyProp (xmlNodePtr target,
351 xmlAttrPtr cur);
352xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
353 xmlAttrPtr cur);
354xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
355xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
356 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000357
358/*
359 * Creating new nodes
360 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000361xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
362 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000363 const xmlChar *name,
364 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000365xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000366 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000367xmlNodePtr xmlNewChild (xmlNodePtr parent,
368 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000369 const xmlChar *name,
370 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000371xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000372 const xmlChar *content);
373xmlNodePtr xmlNewText (const xmlChar *content);
374xmlNodePtr xmlNewPI (const xmlChar *name,
375 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000376xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000377 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000378 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000379xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000380 int len);
381xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000382 const xmlChar *content);
383xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000384xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000385 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000386 int len);
387xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000388 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000389xmlNodePtr xmlCopyNode (xmlNodePtr node,
390 int recursive);
391xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000392
393/*
394 * Navigating
395 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000396xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
397int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000398
399/*
400 * Changing the structure
401 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000402xmlNodePtr xmlAddChild (xmlNodePtr parent,
403 xmlNodePtr cur);
404xmlNodePtr xmlAddSibling (xmlNodePtr cur,
405 xmlNodePtr elem);
406void xmlUnlinkNode (xmlNodePtr cur);
407xmlNodePtr xmlTextMerge (xmlNodePtr first,
408 xmlNodePtr second);
409void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000410 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000411 int len);
412void xmlFreeNodeList (xmlNodePtr cur);
413void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000414
415/*
416 * Namespaces
417 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000418xmlNsPtr xmlSearchNs (xmlDocPtr doc,
419 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000420 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000421xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
422 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000423 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000424xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
425 xmlNodePtr node);
426void xmlSetNs (xmlNodePtr node,
427 xmlNsPtr ns);
428xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
429xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000430
Daniel Veillard16253641998-10-28 22:58:05 +0000431/*
432 * Changing the content.
433 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000434xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000435 const xmlChar *name,
436 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000437xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000438 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000439xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000440 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000441xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000442 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000443 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000444xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000445 xmlNodePtr list,
446 int inLine);
447void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000448 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000449void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000450 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000451 int len);
452void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000453 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000454void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000455 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000456 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000457xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000458const xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000459void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000460 const xmlChar *lang);
Daniel Veillard16253641998-10-28 22:58:05 +0000461
462/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000463 * Removing content.
464 */
465int xmlRemoveProp (xmlAttrPtr attr); /* TODO */
466int xmlRemoveNode (xmlNodePtr node); /* TODO */
467
468/*
Daniel Veillard16253641998-10-28 22:58:05 +0000469 * Internal, don't use
470 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000471void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000472 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000473void xmlBufferWriteChar (xmlBufferPtr buf,
474 const char *string);
475void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000476 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000477
Daniel Veillard16253641998-10-28 22:58:05 +0000478/*
479 * Saving
480 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000481void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000482 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000483 int *size);
484void xmlDocDump (FILE *f,
485 xmlDocPtr cur);
486int xmlSaveFile (const char *filename,
487 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000488
Daniel Veillard16253641998-10-28 22:58:05 +0000489/*
490 * Compression
491 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000492int xmlGetDocCompressMode (xmlDocPtr doc);
493void xmlSetDocCompressMode (xmlDocPtr doc,
494 int mode);
495int xmlGetCompressMode (void);
496void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000497
498#ifdef __cplusplus
499}
500#endif
501
502#endif /* __XML_TREE_H__ */
503