blob: 20a64dfaf6a90eb053c3da50ef2102f23d0ec319 [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 Veillardf5c2c871999-12-01 09:51:45 +0000233 * A buffer structure
234 */
235
236typedef enum {
237 XML_BUFFER_ALLOC_DOUBLEIT,
238 XML_BUFFER_ALLOC_EXACT
239} xmlBufferAllocationScheme;
240
241typedef struct xmlBuffer {
242 xmlChar *content; /* The buffer content UTF8 */
243 unsigned int use; /* The buffer size used */
244 unsigned int size; /* The buffer size */
245 xmlBufferAllocationScheme alloc; /* The realloc method */
246} _xmlBuffer;
247typedef _xmlBuffer xmlBuffer;
248typedef xmlBuffer *xmlBufferPtr;
249
250/*
Daniel Veillard260a68f1998-08-13 03:39:55 +0000251 * A node in an XML tree.
252 */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000253typedef struct xmlNode {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000254#ifndef XML_WITHOUT_CORBA
255 void *_private; /* for Corba, must be first ! */
256 void *vepv; /* for Corba, must be next ! */
257#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000258 xmlElementType type; /* type number in the DTD, must be third ! */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000259 struct xmlDoc *doc; /* the containing document */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000260 struct xmlNode *parent; /* child->parent link */
261 struct xmlNode *next; /* next sibling link */
Daniel Veillard0bef1311998-10-14 02:36:47 +0000262 struct xmlNode *prev; /* previous sibling link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000263 struct xmlNode *childs; /* parent->childs link */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000264 struct xmlNode *last; /* last child link */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000265 struct xmlAttr *properties; /* properties list */
Daniel Veillard6077d031999-10-09 09:11:45 +0000266 const xmlChar *name; /* the name of the node, or the entity */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000267 xmlNs *ns; /* pointer to the associated namespace */
268 xmlNs *nsDef; /* namespace definitions on this node */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000269#ifndef XML_USE_BUFFER_CONTENT
Daniel Veillard6077d031999-10-09 09:11:45 +0000270 xmlChar *content; /* the content */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000271#else
272 xmlBufferPtr content; /* the content in a buffer */
273#endif
Daniel Veillard1e346af1999-02-22 10:33:01 +0000274} _xmlNode;
275typedef _xmlNode xmlNode;
276typedef _xmlNode *xmlNodePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000277
278/*
279 * An XML document.
280 */
281typedef struct xmlDoc {
Daniel Veillard27fb0751998-10-17 06:47:46 +0000282#ifndef XML_WITHOUT_CORBA
283 void *_private; /* for Corba, must be first ! */
284 void *vepv; /* for Corba, must be next ! */
285#endif
Daniel Veillardccb09631998-10-27 06:21:04 +0000286 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000287 char *name; /* name/filename/URI of the document */
Daniel Veillard6077d031999-10-09 09:11:45 +0000288 const xmlChar *version; /* the XML version string */
289 const xmlChar *encoding; /* encoding, if any */
Daniel Veillard15a8df41998-09-24 19:15:06 +0000290 int compression;/* level of zlib compression */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000291 int standalone; /* standalone document (no external refs) */
Daniel Veillard39a1f9a1999-01-17 19:11:59 +0000292 struct xmlDtd *intSubset; /* the document internal subset */
293 struct xmlDtd *extSubset; /* the document external subset */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000294 struct xmlNs *oldNs; /* Global namespace, the old way */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000295 struct xmlNode *root; /* the document tree */
Daniel Veillard991e63d1999-08-15 23:32:28 +0000296 void *ids; /* Hash table for ID attributes if any */
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000297 void *refs; /* Hash table for IDREFs attributes if any */
Daniel Veillard1e346af1999-02-22 10:33:01 +0000298} _xmlDoc;
299typedef _xmlDoc xmlDoc;
300typedef xmlDoc *xmlDocPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +0000301
302/*
303 * Variables.
304 */
305extern xmlNsPtr baseDTD;
306extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
307extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000308extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillard260a68f1998-08-13 03:39:55 +0000309
310/*
Daniel Veillard5099ae81999-04-21 20:12:07 +0000311 * Handling Buffers.
312 */
313
Daniel Veillardb96e6431999-08-29 21:02:19 +0000314xmlBufferPtr xmlBufferCreate (void);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000315xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000316void xmlBufferFree (xmlBufferPtr buf);
317int xmlBufferDump (FILE *file,
318 xmlBufferPtr buf);
319void xmlBufferAdd (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000320 const xmlChar *str,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000321 int len);
322void xmlBufferCat (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000323 const xmlChar *str);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000324void xmlBufferCCat (xmlBufferPtr buf,
325 const char *str);
326int xmlBufferShrink (xmlBufferPtr buf,
327 int len);
328void xmlBufferEmpty (xmlBufferPtr buf);
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000329const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
330int xmlBufferUse (const xmlBufferPtr buf);
331void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
332 xmlBufferAllocationScheme scheme);
333int xmlBufferLength (const xmlBufferPtr buf);
Daniel Veillard5099ae81999-04-21 20:12:07 +0000334
335/*
Daniel Veillard16253641998-10-28 22:58:05 +0000336 * Creating/freeing new structures
Daniel Veillard260a68f1998-08-13 03:39:55 +0000337 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000338xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000339 const xmlChar *name,
340 const xmlChar *ExternalID,
341 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000342xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000343 const xmlChar *name,
344 const xmlChar *ExternalID,
345 const xmlChar *SystemID);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000346void xmlFreeDtd (xmlDtdPtr cur);
347xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000348 const xmlChar *href,
349 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000350xmlNsPtr xmlNewNs (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000351 const xmlChar *href,
352 const xmlChar *prefix);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000353void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard6077d031999-10-09 09:11:45 +0000354xmlDocPtr xmlNewDoc (const xmlChar *version);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000355void xmlFreeDoc (xmlDocPtr cur);
356xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000357 const xmlChar *name,
358 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000359xmlAttrPtr xmlNewProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000360 const xmlChar *name,
361 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000362xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
363 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000364 const xmlChar *name,
365 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000366void xmlFreePropList (xmlAttrPtr cur);
367void xmlFreeProp (xmlAttrPtr cur);
368xmlAttrPtr xmlCopyProp (xmlNodePtr target,
369 xmlAttrPtr cur);
370xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
371 xmlAttrPtr cur);
372xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
373xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
374 int recursive);
Daniel Veillard16253641998-10-28 22:58:05 +0000375
376/*
377 * Creating new nodes
378 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000379xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
380 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000381 const xmlChar *name,
382 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000383xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
384 xmlNsPtr ns,
385 const xmlChar *name,
386 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000387xmlNodePtr xmlNewNode (xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000388 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000389xmlNodePtr xmlNewChild (xmlNodePtr parent,
390 xmlNsPtr ns,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000391 const xmlChar *name,
392 const xmlChar *content);
Daniel Veillard11a48ec1999-11-23 10:40:46 +0000393xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
394 xmlNsPtr ns,
395 const xmlChar *name,
396 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000397xmlNodePtr xmlNewDocText (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000398 const xmlChar *content);
399xmlNodePtr xmlNewText (const xmlChar *content);
400xmlNodePtr xmlNewPI (const xmlChar *name,
401 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000402xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000403 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000404 int len);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000405xmlNodePtr xmlNewTextLen (const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000406 int len);
407xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000408 const xmlChar *content);
409xmlNodePtr xmlNewComment (const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000410xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000411 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000412 int len);
413xmlNodePtr xmlNewReference (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000414 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000415xmlNodePtr xmlCopyNode (xmlNodePtr node,
416 int recursive);
417xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000418
419/*
420 * Navigating
421 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000422xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
423int xmlNodeIsText (xmlNodePtr node);
Daniel Veillard16253641998-10-28 22:58:05 +0000424
425/*
426 * Changing the structure
427 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000428xmlNodePtr xmlAddChild (xmlNodePtr parent,
429 xmlNodePtr cur);
430xmlNodePtr xmlAddSibling (xmlNodePtr cur,
431 xmlNodePtr elem);
432void xmlUnlinkNode (xmlNodePtr cur);
433xmlNodePtr xmlTextMerge (xmlNodePtr first,
434 xmlNodePtr second);
435void xmlTextConcat (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000436 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000437 int len);
438void xmlFreeNodeList (xmlNodePtr cur);
439void xmlFreeNode (xmlNodePtr cur);
Daniel Veillard16253641998-10-28 22:58:05 +0000440
441/*
442 * Namespaces
443 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000444xmlNsPtr xmlSearchNs (xmlDocPtr doc,
445 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000446 const xmlChar *nameSpace);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000447xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
448 xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000449 const xmlChar *href);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000450xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
451 xmlNodePtr node);
452void xmlSetNs (xmlNodePtr node,
453 xmlNsPtr ns);
454xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
455xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000456
Daniel Veillard16253641998-10-28 22:58:05 +0000457/*
458 * Changing the content.
459 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000460xmlAttrPtr xmlSetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000461 const xmlChar *name,
462 const xmlChar *value);
Daniel Veillard6077d031999-10-09 09:11:45 +0000463xmlChar * xmlGetProp (xmlNodePtr node,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000464 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000465xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000466 const xmlChar *value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000467xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000468 const xmlChar *value,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000469 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000470xmlChar * xmlNodeListGetString (xmlDocPtr doc,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000471 xmlNodePtr list,
472 int inLine);
473void xmlNodeSetContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000474 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000475void xmlNodeSetContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000476 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000477 int len);
478void xmlNodeAddContent (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000479 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000480void xmlNodeAddContentLen (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000481 const xmlChar *content,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000482 int len);
Daniel Veillard6077d031999-10-09 09:11:45 +0000483xmlChar * xmlNodeGetContent (xmlNodePtr cur);
Daniel Veillarda819dac1999-11-24 18:04:22 +0000484xmlChar * xmlNodeGetLang (xmlNodePtr cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000485void xmlNodeSetLang (xmlNodePtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000486 const xmlChar *lang);
Daniel Veillard16253641998-10-28 22:58:05 +0000487
488/*
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000489 * Removing content.
490 */
491int xmlRemoveProp (xmlAttrPtr attr); /* TODO */
492int xmlRemoveNode (xmlNodePtr node); /* TODO */
493
494/*
Daniel Veillard16253641998-10-28 22:58:05 +0000495 * Internal, don't use
496 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000497void xmlBufferWriteCHAR (xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000498 const xmlChar *string);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000499void xmlBufferWriteChar (xmlBufferPtr buf,
500 const char *string);
501void xmlBufferWriteQuotedString(xmlBufferPtr buf,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000502 const xmlChar *string);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000503
Daniel Veillard16253641998-10-28 22:58:05 +0000504/*
505 * Saving
506 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000507void xmlDocDumpMemory (xmlDocPtr cur,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000508 xmlChar**mem,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000509 int *size);
510void xmlDocDump (FILE *f,
511 xmlDocPtr cur);
512int xmlSaveFile (const char *filename,
513 xmlDocPtr cur);
Daniel Veillard151b1b01998-09-23 00:49:46 +0000514
Daniel Veillard16253641998-10-28 22:58:05 +0000515/*
516 * Compression
517 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000518int xmlGetDocCompressMode (xmlDocPtr doc);
519void xmlSetDocCompressMode (xmlDocPtr doc,
520 int mode);
521int xmlGetCompressMode (void);
522void xmlSetCompressMode (int mode);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000523
524#ifdef __cplusplus
525}
526#endif
527
528#endif /* __XML_TREE_H__ */
529