blob: b6d030bcbfee93bec6e7e97a401ba16dee2ab8f5 [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 Veillard11a48ec1999-11-23 10:40:46 +0000366xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
367 xmlNsPtr ns,
368 const xmlChar *name,
369 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000370xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000371 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000372xmlNodePtr xmlNewChild (xmlNodePtr parent,
373 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000374 const xmlChar *name,
375 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000376xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
377 xmlNsPtr ns,
378 const xmlChar *name,
379 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000380xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000381 const xmlChar *content);
382xmlNodePtr xmlNewText (const xmlChar *content);
383xmlNodePtr xmlNewPI (const xmlChar *name,
384 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000385xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000386 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000387 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000388xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000389 int len);
390xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000391 const xmlChar *content);
392xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000393xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000394 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000395 int len);
396xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000397 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000398xmlNodePtr xmlCopyNode (xmlNodePtr node,
399 int recursive);
400xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000401
402/*
403 * Navigating
404 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000405xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
406int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000407
408/*
409 * Changing the structure
410 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000411xmlNodePtr xmlAddChild (xmlNodePtr parent,
412 xmlNodePtr cur);
413xmlNodePtr xmlAddSibling (xmlNodePtr cur,
414 xmlNodePtr elem);
415void xmlUnlinkNode (xmlNodePtr cur);
416xmlNodePtr xmlTextMerge (xmlNodePtr first,
417 xmlNodePtr second);
418void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000419 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000420 int len);
421void xmlFreeNodeList (xmlNodePtr cur);
422void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000423
424/*
425 * Namespaces
426 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000427xmlNsPtr xmlSearchNs (xmlDocPtr doc,
428 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000429 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000430xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
431 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000432 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000433xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
434 xmlNodePtr node);
435void xmlSetNs (xmlNodePtr node,
436 xmlNsPtr ns);
437xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
438xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000439
Daniel Veillard16253641998-10-28 22:58:05 +0000440/*
441 * Changing the content.
442 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000443xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000444 const xmlChar *name,
445 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000446xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000447 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000448xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000449 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000450xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000451 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000452 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000453xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000454 xmlNodePtr list,
455 int inLine);
456void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000457 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000458void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000459 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000460 int len);
461void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000462 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000463void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000464 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000465 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000466xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarda819dac1999-11-24 18:04:22 +0000467xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000468void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000469 const xmlChar *lang);
Daniel Veillard16253641998-10-28 22:58:05 +0000470
471/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000472 * Removing content.
473 */
474int xmlRemoveProp (xmlAttrPtr attr); /* TODO */
475int xmlRemoveNode (xmlNodePtr node); /* TODO */
476
477/*
Daniel Veillard16253641998-10-28 22:58:05 +0000478 * Internal, don't use
479 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000480void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000481 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000482void xmlBufferWriteChar (xmlBufferPtr buf,
483 const char *string);
484void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000485 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000486
Daniel Veillard16253641998-10-28 22:58:05 +0000487/*
488 * Saving
489 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000490void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000491 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000492 int *size);
493void xmlDocDump (FILE *f,
494 xmlDocPtr cur);
495int xmlSaveFile (const char *filename,
496 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000497
Daniel Veillard16253641998-10-28 22:58:05 +0000498/*
499 * Compression
500 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000501int xmlGetDocCompressMode (xmlDocPtr doc);
502void xmlSetDocCompressMode (xmlDocPtr doc,
503 int mode);
504int xmlGetCompressMode (void);
505void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000506
507#ifdef __cplusplus
508}
509#endif
510
511#endif /* __XML_TREE_H__ */
512