blob: 6c8ab1021eb462487f65e21dfaa17a4dc51a8e28 [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 */
115} xmlAttribute;
116typedef xmlAttribute *xmlAttributePtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000117
Daniel Veillard260a68f1998-08-13 03:39:55 +0000118/*
119 * a DTD Element definition.
120 */
Daniel Veillard1899e851999-02-01 12:18:54 +0000121typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000122 XML_ELEMENT_CONTENT_PCDATA = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000123 XML_ELEMENT_CONTENT_ELEMENT,
124 XML_ELEMENT_CONTENT_SEQ,
125 XML_ELEMENT_CONTENT_OR
126} xmlElementContentType;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000127
Daniel Veillard1899e851999-02-01 12:18:54 +0000128typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000129 XML_ELEMENT_CONTENT_ONCE = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000130 XML_ELEMENT_CONTENT_OPT,
131 XML_ELEMENT_CONTENT_MULT,
132 XML_ELEMENT_CONTENT_PLUS
133} xmlElementContentOccur;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000134
135typedef struct xmlElementContent {
Daniel Veillard1899e851999-02-01 12:18:54 +0000136 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
137 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
Daniel Veillard6077d031999-10-09 09:11:45 +0000138 const xmlChar *name; /* Element name */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000139 struct xmlElementContent *c1; /* first child */
140 struct xmlElementContent *c2; /* second child */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000141} xmlElementContent;
142typedef xmlElementContent *xmlElementContentPtr;
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000143
Daniel Veillard1899e851999-02-01 12:18:54 +0000144typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000145 XML_ELEMENT_TYPE_EMPTY = 1,
Daniel Veillard1899e851999-02-01 12:18:54 +0000146 XML_ELEMENT_TYPE_ANY,
147 XML_ELEMENT_TYPE_MIXED,
148 XML_ELEMENT_TYPE_ELEMENT
149} xmlElementTypeVal;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000150
151typedef struct xmlElement {
Daniel Veillard6077d031999-10-09 09:11:45 +0000152 const xmlChar *name; /* Element name */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000153 xmlElementTypeVal type; /* The type */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000154 xmlElementContentPtr content; /* the allowed element content */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000155 xmlAttributePtr attributes; /* List of the declared attributes */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000156} xmlElement;
157typedef xmlElement *xmlElementPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000158
159/*
160 * An XML namespace.
161 * Note that prefix == NULL is valid, it defines the default namespace
162 * within the subtree (until overriden).
163 */
164
Daniel Veillard1899e851999-02-01 12:18:54 +0000165typedef enum {
Daniel Veillard1e346af1999-02-22 10:33:01 +0000166 XML_GLOBAL_NAMESPACE = 1, /* old style global namespace */
Daniel Veillard1899e851999-02-01 12:18:54 +0000167 XML_LOCAL_NAMESPACE /* new style local scoping */
168} xmlNsType;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000169
170typedef struct xmlNs {
171 struct xmlNs *next; /* next Ns link for this node */
Daniel Veillard1899e851999-02-01 12:18:54 +0000172 xmlNsType type; /* global or local */
Daniel Veillard6077d031999-10-09 09:11:45 +0000173 const xmlChar *href; /* URL for the namespace */
174 const xmlChar *prefix; /* prefix for the namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000175} xmlNs;
176typedef xmlNs *xmlNsPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000177
178/*
179 * An XML DtD, as defined by <!DOCTYPE.
180 */
181typedef struct xmlDtd {
Daniel Veillard6077d031999-10-09 09:11:45 +0000182 const xmlChar *name; /* Name of the DTD */
183 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
184 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000185 void *notations; /* Hash table for notations if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000186 void *elements; /* Hash table for elements if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000187 void *attributes; /* Hash table for attributes if any */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000188 void *entities; /* Hash table for entities if any */
189 /* struct xmlDtd *next; * next link for this document */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000190} xmlDtd;
191typedef xmlDtd *xmlDtdPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000192
193/*
194 * A attribute of an XML node.
195 */
196typedef struct xmlAttr {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000197#ifndef XML_WITHOUT_CORBA
198 void *_private; /* for Corba, must be first ! */
199 void *vepv; /* for Corba, must be next ! */
200#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000201 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be third ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000202 struct xmlNode *node; /* attr->node link */
Daniel Veillardb05deb71999-08-10 19:04:08 +0000203 struct xmlAttr *next; /* attribute list link */
Daniel Veillard6077d031999-10-09 09:11:45 +0000204 const xmlChar *name; /* the name of the property */
Daniel Veillardccb09631998-10-27 06:21:04 +0000205 struct xmlNode *val; /* the value of the property */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000206 xmlNs *ns; /* pointer to the associated namespace */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000207} xmlAttr;
208typedef xmlAttr *xmlAttrPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000209
210/*
Daniel Veillard991e63d1999-08-15 23:32:28 +0000211 * An XML ID instance.
212 */
213
214typedef struct xmlID {
215 struct xmlID *next; /* next ID */
Daniel Veillard6077d031999-10-09 09:11:45 +0000216 const xmlChar *value; /* The ID name */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000217 xmlAttrPtr attr; /* The attribut holding it */
218} xmlID;
219typedef xmlID *xmlIDPtr;
220
221/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000222 * An XML IDREF instance.
223 */
224
225typedef struct xmlRef {
226 struct xmlRef *next; /* next Ref */
Daniel Veillard6077d031999-10-09 09:11:45 +0000227 const xmlChar *value; /* The Ref name */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000228 xmlAttrPtr attr; /* The attribut holding it */
229} xmlRef;
230typedef xmlRef *xmlRefPtr;
231
232/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000233 * A node in an XML tree.
234 */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000235typedef struct xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000236#ifndef XML_WITHOUT_CORBA
237 void *_private; /* for Corba, must be first ! */
238 void *vepv; /* for Corba, must be next ! */
239#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000240 xmlElementType type; /* type number in the DTD, must be third ! */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000241 struct xmlDoc *doc; /* the containing document */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000242 struct xmlNode *parent; /* child->parent link */
243 struct xmlNode *next; /* next sibling link */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000244 struct xmlNode *prev; /* previous sibling link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000245 struct xmlNode *childs; /* parent->childs link */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000246 struct xmlNode *last; /* last child link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000247 struct xmlAttr *properties; /* properties list */
Daniel Veillard6077d031999-10-09 09:11:45 +0000248 const xmlChar *name; /* the name of the node, or the entity */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000249 xmlNs *ns; /* pointer to the associated namespace */
250 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillard6077d031999-10-09 09:11:45 +0000251 xmlChar *content; /* the content */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000252} _xmlNode;
253typedef _xmlNode xmlNode;
254typedef _xmlNode *xmlNodePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000255
256/*
257 * An XML document.
258 */
259typedef struct xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000260#ifndef XML_WITHOUT_CORBA
261 void *_private; /* for Corba, must be first ! */
262 void *vepv; /* for Corba, must be next ! */
263#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000264 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000265 char *name; /* name/filename/URI of the document */
Daniel Veillard6077d031999-10-09 09:11:45 +0000266 const xmlChar *version; /* the XML version string */
267 const xmlChar *encoding; /* encoding, if any */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000268 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000269 int standalone; /* standalone document (no external refs) */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000270 struct xmlDtd *intSubset; /* the document internal subset */
271 struct xmlDtd *extSubset; /* the document external subset */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000272 struct xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000273 struct xmlNode *root; /* the document tree */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000274 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000275 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000276} _xmlDoc;
277typedef _xmlDoc xmlDoc;
278typedef xmlDoc *xmlDocPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000279
280/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000281 * A buffer structure
282 */
283
284typedef struct xmlBuffer {
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000285 xmlChar *content; /* The buffer content UTF8 */
Daniel Veillard5099ae81999-04-21 20:12:07 +0000286 unsigned int use; /* The buffer size used */
287 unsigned int size; /* The buffer size */
288} _xmlBuffer;
289typedef _xmlBuffer xmlBuffer;
290typedef xmlBuffer *xmlBufferPtr;
291
292/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000293 * Variables.
294 */
295extern xmlNsPtr baseDTD;
296extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
297extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
298
299/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000300 * Handling Buffers.
301 */
302
Daniel Veillardb96e6431999-08-29 21:02:19 +0000303xmlBufferPtr xmlBufferCreate (void);
304void xmlBufferFree (xmlBufferPtr buf);
305int xmlBufferDump (FILE *file,
306 xmlBufferPtr buf);
307void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000308 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000309 int len);
310void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000311 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000312void xmlBufferCCat (xmlBufferPtr buf,
313 const char *str);
314int xmlBufferShrink (xmlBufferPtr buf,
315 int len);
316void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000317
318/*
Daniel Veillard16253641998-10-28 22:58:05 +0000319 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000320 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000321xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000322 const xmlChar *name,
323 const xmlChar *ExternalID,
324 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000325xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000326 const xmlChar *name,
327 const xmlChar *ExternalID,
328 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000329void xmlFreeDtd (xmlDtdPtr cur);
330xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000331 const xmlChar *href,
332 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000333xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000334 const xmlChar *href,
335 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000336void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000337xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000338void xmlFreeDoc (xmlDocPtr cur);
339xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000340 const xmlChar *name,
341 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000342xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000343 const xmlChar *name,
344 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000345xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
346 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000347 const xmlChar *name,
348 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000349void xmlFreePropList (xmlAttrPtr cur);
350void xmlFreeProp (xmlAttrPtr cur);
351xmlAttrPtr xmlCopyProp (xmlNodePtr target,
352 xmlAttrPtr cur);
353xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
354 xmlAttrPtr cur);
355xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
356xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
357 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000358
359/*
360 * Creating new nodes
361 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000362xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
363 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000364 const xmlChar *name,
365 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000366xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000367 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000368xmlNodePtr xmlNewChild (xmlNodePtr parent,
369 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000370 const xmlChar *name,
371 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000372xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000373 const xmlChar *content);
374xmlNodePtr xmlNewText (const xmlChar *content);
375xmlNodePtr xmlNewPI (const xmlChar *name,
376 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000377xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000378 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000379 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000380xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000381 int len);
382xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000383 const xmlChar *content);
384xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000385xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000386 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000387 int len);
388xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000389 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000390xmlNodePtr xmlCopyNode (xmlNodePtr node,
391 int recursive);
392xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000393
394/*
395 * Navigating
396 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000397xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
398int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000399
400/*
401 * Changing the structure
402 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000403xmlNodePtr xmlAddChild (xmlNodePtr parent,
404 xmlNodePtr cur);
405xmlNodePtr xmlAddSibling (xmlNodePtr cur,
406 xmlNodePtr elem);
407void xmlUnlinkNode (xmlNodePtr cur);
408xmlNodePtr xmlTextMerge (xmlNodePtr first,
409 xmlNodePtr second);
410void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000411 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000412 int len);
413void xmlFreeNodeList (xmlNodePtr cur);
414void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000415
416/*
417 * Namespaces
418 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000419xmlNsPtr xmlSearchNs (xmlDocPtr doc,
420 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000421 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000422xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
423 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000424 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000425xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
426 xmlNodePtr node);
427void xmlSetNs (xmlNodePtr node,
428 xmlNsPtr ns);
429xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
430xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000431
Daniel Veillard16253641998-10-28 22:58:05 +0000432/*
433 * Changing the content.
434 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000435xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000436 const xmlChar *name,
437 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000438xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000439 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000440xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000441 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000442xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000443 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000444 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000445xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000446 xmlNodePtr list,
447 int inLine);
448void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000449 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000450void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000451 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000452 int len);
453void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000454 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000455void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000456 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000457 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000458xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000459const xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000460void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000461 const xmlChar *lang);
Daniel Veillard16253641998-10-28 22:58:05 +0000462
463/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000464 * Removing content.
465 */
466int xmlRemoveProp (xmlAttrPtr attr); /* TODO */
467int xmlRemoveNode (xmlNodePtr node); /* TODO */
468
469/*
Daniel Veillard16253641998-10-28 22:58:05 +0000470 * Internal, don't use
471 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000472void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000473 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000474void xmlBufferWriteChar (xmlBufferPtr buf,
475 const char *string);
476void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000477 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000478
Daniel Veillard16253641998-10-28 22:58:05 +0000479/*
480 * Saving
481 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000482void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000483 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000484 int *size);
485void xmlDocDump (FILE *f,
486 xmlDocPtr cur);
487int xmlSaveFile (const char *filename,
488 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000489
Daniel Veillard16253641998-10-28 22:58:05 +0000490/*
491 * Compression
492 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000493int xmlGetDocCompressMode (xmlDocPtr doc);
494void xmlSetDocCompressMode (xmlDocPtr doc,
495 int mode);
496int xmlGetCompressMode (void);
497void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000498
499#ifdef __cplusplus
500}
501#endif
502
503#endif /* __XML_TREE_H__ */
504