blob: 463daaa4dd90ab161c81b8917ea13fd69bb47117 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +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 *
7 * Daniel.Veillard@w3.org
8 *
9 * 14 Nov 2000 ht - added redefinition of xmlBufferWriteChar for VMS
10 *
11 */
12
13#ifndef __XML_TREE_H__
14#define __XML_TREE_H__
15
16#include <stdio.h>
17#include <libxml/xmlversion.h>
Daniel Veillard67a21302001-04-11 14:39:16 +000018#include <libxml/xmlmemory.h>
Owen Taylor3473f882001-02-23 17:55:21 +000019
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define XML_XML_NAMESPACE \
25 (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
26
27/*
28 * The different element types carried by an XML tree
29 *
30 * NOTE: This is synchronized with DOM Level1 values
31 * See http://www.w3.org/TR/REC-DOM-Level-1/
32 *
33 * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
34 * be deprecated to use an XML_DTD_NODE.
35 */
36typedef enum {
37 XML_ELEMENT_NODE= 1,
38 XML_ATTRIBUTE_NODE= 2,
39 XML_TEXT_NODE= 3,
40 XML_CDATA_SECTION_NODE= 4,
41 XML_ENTITY_REF_NODE= 5,
42 XML_ENTITY_NODE= 6,
43 XML_PI_NODE= 7,
44 XML_COMMENT_NODE= 8,
45 XML_DOCUMENT_NODE= 9,
46 XML_DOCUMENT_TYPE_NODE= 10,
47 XML_DOCUMENT_FRAG_NODE= 11,
48 XML_NOTATION_NODE= 12,
49 XML_HTML_DOCUMENT_NODE= 13,
50 XML_DTD_NODE= 14,
51 XML_ELEMENT_DECL= 15,
52 XML_ATTRIBUTE_DECL= 16,
53 XML_ENTITY_DECL= 17,
54 XML_NAMESPACE_DECL= 18,
55 XML_XINCLUDE_START= 19,
56 XML_XINCLUDE_END= 20
Daniel Veillardeae522a2001-04-23 13:41:34 +000057#ifdef LIBXML_DOCB_ENABLED
58 ,XML_DOCB_DOCUMENT_NODE= 21
Owen Taylor3473f882001-02-23 17:55:21 +000059#endif
60} xmlElementType;
61
Daniel Veillardbed7b052001-05-19 14:59:49 +000062/**
63 * xmlChar:
Owen Taylor3473f882001-02-23 17:55:21 +000064 *
Daniel Veillardbed7b052001-05-19 14:59:49 +000065 * This is a basic byte in an UTF-8 encoded string.
66 * It's unsigned allowing to pinpoint case where char * are assigned
67 * to xmlChar * (possibly making serialization back impossible).
Owen Taylor3473f882001-02-23 17:55:21 +000068 */
69
70typedef unsigned char xmlChar;
71
Daniel Veillardbed7b052001-05-19 14:59:49 +000072/*
73 * Removed in 2.3.9 ... nobody should still use this
74 *
Owen Taylor3473f882001-02-23 17:55:21 +000075#ifndef WIN32
76#ifndef CHAR
77#define CHAR xmlChar
78#endif
79#endif
Daniel Veillardbed7b052001-05-19 14:59:49 +000080 */
Owen Taylor3473f882001-02-23 17:55:21 +000081
Daniel Veillardbed7b052001-05-19 14:59:49 +000082/**
83 * BAD_CAST:
84 *
85 * Macro to cast a string to an xmlChar * when one know its safe.
86 */
Owen Taylor3473f882001-02-23 17:55:21 +000087#define BAD_CAST (xmlChar *)
88
Daniel Veillardbed7b052001-05-19 14:59:49 +000089/**
90 * xmlNotation:
91 *
Owen Taylor3473f882001-02-23 17:55:21 +000092 * a DTD Notation definition
93 */
94
95typedef struct _xmlNotation xmlNotation;
96typedef xmlNotation *xmlNotationPtr;
97struct _xmlNotation {
Daniel Veillard9e7160d2001-03-18 23:17:47 +000098 const xmlChar *name; /* Notation name */
Owen Taylor3473f882001-02-23 17:55:21 +000099 const xmlChar *PublicID; /* Public identifier, if any */
100 const xmlChar *SystemID; /* System identifier, if any */
101};
102
Daniel Veillardbed7b052001-05-19 14:59:49 +0000103/**
104 * xmlAttributeType:
105 *
106 * a DTD Attribute type definition
Owen Taylor3473f882001-02-23 17:55:21 +0000107 */
108
109typedef enum {
110 XML_ATTRIBUTE_CDATA = 1,
111 XML_ATTRIBUTE_ID,
112 XML_ATTRIBUTE_IDREF ,
113 XML_ATTRIBUTE_IDREFS,
114 XML_ATTRIBUTE_ENTITY,
115 XML_ATTRIBUTE_ENTITIES,
116 XML_ATTRIBUTE_NMTOKEN,
117 XML_ATTRIBUTE_NMTOKENS,
118 XML_ATTRIBUTE_ENUMERATION,
119 XML_ATTRIBUTE_NOTATION
120} xmlAttributeType;
121
Daniel Veillardbed7b052001-05-19 14:59:49 +0000122/**
123 * xmlAttributeDefault:
124 *
125 * a DTD Attribute default definition
126 */
127
Owen Taylor3473f882001-02-23 17:55:21 +0000128typedef enum {
129 XML_ATTRIBUTE_NONE = 1,
130 XML_ATTRIBUTE_REQUIRED,
131 XML_ATTRIBUTE_IMPLIED,
132 XML_ATTRIBUTE_FIXED
133} xmlAttributeDefault;
134
Daniel Veillardbed7b052001-05-19 14:59:49 +0000135/**
136 * xmlEnumeration:
137 *
138 * list structure used when there is an enumeration in DTDs
139 */
140
Owen Taylor3473f882001-02-23 17:55:21 +0000141typedef struct _xmlEnumeration xmlEnumeration;
142typedef xmlEnumeration *xmlEnumerationPtr;
143struct _xmlEnumeration {
144 struct _xmlEnumeration *next; /* next one */
145 const xmlChar *name; /* Enumeration name */
146};
147
Daniel Veillardbed7b052001-05-19 14:59:49 +0000148/**
149 * xmlAttribute:
150 *
151 * an Attribute declaration in a DTD
152 */
153
Owen Taylor3473f882001-02-23 17:55:21 +0000154typedef struct _xmlAttribute xmlAttribute;
155typedef xmlAttribute *xmlAttributePtr;
156struct _xmlAttribute {
157#ifndef XML_WITHOUT_CORBA
158 void *_private; /* for Corba, must be first ! */
159#endif
160 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
161 const xmlChar *name; /* Attribute name */
162 struct _xmlNode *children; /* NULL */
163 struct _xmlNode *last; /* NULL */
164 struct _xmlDtd *parent; /* -> DTD */
165 struct _xmlNode *next; /* next sibling link */
166 struct _xmlNode *prev; /* previous sibling link */
167 struct _xmlDoc *doc; /* the containing document */
168
169 struct _xmlAttribute *nexth; /* next in hash table */
170 xmlAttributeType atype; /* The attribute type */
171 xmlAttributeDefault def; /* the default */
172 const xmlChar *defaultValue; /* or the default value */
173 xmlEnumerationPtr tree; /* or the enumeration tree if any */
174 const xmlChar *prefix; /* the namespace prefix if any */
175 const xmlChar *elem; /* Element holding the attribute */
176};
177
Daniel Veillardbed7b052001-05-19 14:59:49 +0000178/**
179 * xmlElementContentType:
180 *
181 * Possible definitions of element content types
Owen Taylor3473f882001-02-23 17:55:21 +0000182 */
183typedef enum {
184 XML_ELEMENT_CONTENT_PCDATA = 1,
185 XML_ELEMENT_CONTENT_ELEMENT,
186 XML_ELEMENT_CONTENT_SEQ,
187 XML_ELEMENT_CONTENT_OR
188} xmlElementContentType;
189
Daniel Veillardbed7b052001-05-19 14:59:49 +0000190/**
191 * xmlElementContentOccur:
192 *
193 * Possible definitions of element content occurences
194 */
Owen Taylor3473f882001-02-23 17:55:21 +0000195typedef enum {
196 XML_ELEMENT_CONTENT_ONCE = 1,
197 XML_ELEMENT_CONTENT_OPT,
198 XML_ELEMENT_CONTENT_MULT,
199 XML_ELEMENT_CONTENT_PLUS
200} xmlElementContentOccur;
201
Daniel Veillardbed7b052001-05-19 14:59:49 +0000202/**
203 * xmlElementContent:
204 *
205 * an XML Element content as stored after parsing an element definition
206 * in a DTD.
207 */
208
Owen Taylor3473f882001-02-23 17:55:21 +0000209typedef struct _xmlElementContent xmlElementContent;
210typedef xmlElementContent *xmlElementContentPtr;
211struct _xmlElementContent {
212 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
213 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
214 const xmlChar *name; /* Element name */
215 struct _xmlElementContent *c1; /* first child */
216 struct _xmlElementContent *c2; /* second child */
Daniel Veillarddab4cb32001-04-20 13:03:48 +0000217 struct _xmlElementContent *parent; /* parent */
Owen Taylor3473f882001-02-23 17:55:21 +0000218};
219
Daniel Veillardbed7b052001-05-19 14:59:49 +0000220/**
221 * xmlElementTypeVal:
222 *
223 * the differnt possibility for an element content type
224 */
225
Owen Taylor3473f882001-02-23 17:55:21 +0000226typedef enum {
Daniel Veillarda10efa82001-04-18 13:09:01 +0000227 XML_ELEMENT_TYPE_UNDEFINED = 0,
Owen Taylor3473f882001-02-23 17:55:21 +0000228 XML_ELEMENT_TYPE_EMPTY = 1,
229 XML_ELEMENT_TYPE_ANY,
230 XML_ELEMENT_TYPE_MIXED,
231 XML_ELEMENT_TYPE_ELEMENT
232} xmlElementTypeVal;
233
Daniel Veillardbed7b052001-05-19 14:59:49 +0000234/**
235 * xmlElement:
236 *
237 * an XML Element declaration from a DTD
238 */
239
Owen Taylor3473f882001-02-23 17:55:21 +0000240typedef struct _xmlElement xmlElement;
241typedef xmlElement *xmlElementPtr;
242struct _xmlElement {
243#ifndef XML_WITHOUT_CORBA
244 void *_private; /* for Corba, must be first ! */
245#endif
246 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
247 const xmlChar *name; /* Element name */
248 struct _xmlNode *children; /* NULL */
249 struct _xmlNode *last; /* NULL */
250 struct _xmlDtd *parent; /* -> DTD */
251 struct _xmlNode *next; /* next sibling link */
252 struct _xmlNode *prev; /* previous sibling link */
253 struct _xmlDoc *doc; /* the containing document */
254
255 xmlElementTypeVal etype; /* The type */
256 xmlElementContentPtr content; /* the allowed element content */
257 xmlAttributePtr attributes; /* List of the declared attributes */
258 const xmlChar *prefix; /* the namespace prefix if any */
259};
260
Daniel Veillardbed7b052001-05-19 14:59:49 +0000261
262#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
263typedef xmlElementType xmlNsType;
264
265/**
266 * xmlNs:
267 *
Owen Taylor3473f882001-02-23 17:55:21 +0000268 * An XML namespace.
269 * Note that prefix == NULL is valid, it defines the default namespace
270 * within the subtree (until overriden).
271 *
272 * XML_GLOBAL_NAMESPACE is now deprecated for good
273 * xmlNsType is unified with xmlElementType
274 */
275
Owen Taylor3473f882001-02-23 17:55:21 +0000276typedef struct _xmlNs xmlNs;
277typedef xmlNs *xmlNsPtr;
278struct _xmlNs {
279 struct _xmlNs *next; /* next Ns link for this node */
280 xmlNsType type; /* global or local */
281 const xmlChar *href; /* URL for the namespace */
282 const xmlChar *prefix; /* prefix for the namespace */
283};
284
Daniel Veillardbed7b052001-05-19 14:59:49 +0000285/**
286 * xmlDtd:
287 *
288 * An XML DtD, as defined by <!DOCTYPE ... There is actually one for
289 * the internal subset and for the external subset
Owen Taylor3473f882001-02-23 17:55:21 +0000290 */
291typedef struct _xmlDtd xmlDtd;
292typedef xmlDtd *xmlDtdPtr;
293struct _xmlDtd {
294#ifndef XML_WITHOUT_CORBA
295 void *_private; /* for Corba, must be first ! */
296#endif
297 xmlElementType type; /* XML_DTD_NODE, must be second ! */
298 const xmlChar *name; /* Name of the DTD */
299 struct _xmlNode *children; /* the value of the property link */
300 struct _xmlNode *last; /* last child link */
301 struct _xmlDoc *parent; /* child->parent link */
302 struct _xmlNode *next; /* next sibling link */
303 struct _xmlNode *prev; /* previous sibling link */
304 struct _xmlDoc *doc; /* the containing document */
305
306 /* End of common part */
307 void *notations; /* Hash table for notations if any */
308 void *elements; /* Hash table for elements if any */
309 void *attributes; /* Hash table for attributes if any */
310 void *entities; /* Hash table for entities if any */
311 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
312 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
313 void *pentities; /* Hash table for param entities if any */
314};
315
Daniel Veillardbed7b052001-05-19 14:59:49 +0000316/**
317 * xmlAttr:
318 *
319 * A attribute on an XML node.
Owen Taylor3473f882001-02-23 17:55:21 +0000320 */
321typedef struct _xmlAttr xmlAttr;
322typedef xmlAttr *xmlAttrPtr;
323struct _xmlAttr {
324#ifndef XML_WITHOUT_CORBA
325 void *_private; /* for Corba, must be first ! */
326#endif
327 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
328 const xmlChar *name; /* the name of the property */
329 struct _xmlNode *children; /* the value of the property */
330 struct _xmlNode *last; /* NULL */
331 struct _xmlNode *parent; /* child->parent link */
332 struct _xmlAttr *next; /* next sibling link */
333 struct _xmlAttr *prev; /* previous sibling link */
334 struct _xmlDoc *doc; /* the containing document */
335 xmlNs *ns; /* pointer to the associated namespace */
336 xmlAttributeType atype; /* the attribute type if validating */
337};
338
Daniel Veillardbed7b052001-05-19 14:59:49 +0000339/**
340 * xmlID:
341 *
Owen Taylor3473f882001-02-23 17:55:21 +0000342 * An XML ID instance.
343 */
344
345typedef struct _xmlID xmlID;
346typedef xmlID *xmlIDPtr;
347struct _xmlID {
348 struct _xmlID *next; /* next ID */
349 const xmlChar *value; /* The ID name */
350 xmlAttrPtr attr; /* The attribut holding it */
351};
352
Daniel Veillardbed7b052001-05-19 14:59:49 +0000353/**
354 * xmlRef:
355 *
Owen Taylor3473f882001-02-23 17:55:21 +0000356 * An XML IDREF instance.
357 */
358
359typedef struct _xmlRef xmlRef;
360typedef xmlRef *xmlRefPtr;
361struct _xmlRef {
362 struct _xmlRef *next; /* next Ref */
363 const xmlChar *value; /* The Ref name */
364 xmlAttrPtr attr; /* The attribut holding it */
365};
366
Daniel Veillardbed7b052001-05-19 14:59:49 +0000367/**
368 * xmlBufferAllocationScheme:
369 *
370 * A buffer allocation scheme can be defined to either match exactly the
371 * need or double it's allocated size each time it is found too small
Owen Taylor3473f882001-02-23 17:55:21 +0000372 */
373
374typedef enum {
375 XML_BUFFER_ALLOC_DOUBLEIT,
376 XML_BUFFER_ALLOC_EXACT
377} xmlBufferAllocationScheme;
378
Daniel Veillardbed7b052001-05-19 14:59:49 +0000379/**
380 * xmlBuffer:
381 *
382 * A buffer structure
383 */
Owen Taylor3473f882001-02-23 17:55:21 +0000384typedef struct _xmlBuffer xmlBuffer;
385typedef xmlBuffer *xmlBufferPtr;
386struct _xmlBuffer {
387 xmlChar *content; /* The buffer content UTF8 */
388 unsigned int use; /* The buffer size used */
389 unsigned int size; /* The buffer size */
390 xmlBufferAllocationScheme alloc; /* The realloc method */
391};
392
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000393/**
394 * xmlNode:
395 *
Owen Taylor3473f882001-02-23 17:55:21 +0000396 * A node in an XML tree.
397 */
398typedef struct _xmlNode xmlNode;
399typedef xmlNode *xmlNodePtr;
400struct _xmlNode {
401#ifndef XML_WITHOUT_CORBA
402 void *_private; /* for Corba, must be first ! */
403#endif
404 xmlElementType type; /* type number, must be second ! */
405 const xmlChar *name; /* the name of the node, or the entity */
406 struct _xmlNode *children; /* parent->childs link */
407 struct _xmlNode *last; /* last child link */
408 struct _xmlNode *parent; /* child->parent link */
409 struct _xmlNode *next; /* next sibling link */
410 struct _xmlNode *prev; /* previous sibling link */
411 struct _xmlDoc *doc; /* the containing document */
412 xmlNs *ns; /* pointer to the associated namespace */
413#ifndef XML_USE_BUFFER_CONTENT
414 xmlChar *content; /* the content */
415#else
416 xmlBufferPtr content; /* the content in a buffer */
417#endif
418
419 /* End of common part */
420 struct _xmlAttr *properties;/* properties list */
421 xmlNs *nsDef; /* namespace definitions on this node */
422};
423
Daniel Veillardbed7b052001-05-19 14:59:49 +0000424/**
425 * xmlDoc:
426 *
Owen Taylor3473f882001-02-23 17:55:21 +0000427 * An XML document.
428 */
429typedef struct _xmlDoc xmlDoc;
430typedef xmlDoc *xmlDocPtr;
431struct _xmlDoc {
432#ifndef XML_WITHOUT_CORBA
433 void *_private; /* for Corba, must be first ! */
434#endif
435 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
436 char *name; /* name/filename/URI of the document */
437 struct _xmlNode *children; /* the document tree */
438 struct _xmlNode *last; /* last child link */
439 struct _xmlNode *parent; /* child->parent link */
440 struct _xmlNode *next; /* next sibling link */
441 struct _xmlNode *prev; /* previous sibling link */
442 struct _xmlDoc *doc; /* autoreference to itself */
443
444 /* End of common part */
445 int compression;/* level of zlib compression */
446 int standalone; /* standalone document (no external refs) */
447 struct _xmlDtd *intSubset; /* the document internal subset */
448 struct _xmlDtd *extSubset; /* the document external subset */
449 struct _xmlNs *oldNs; /* Global namespace, the old way */
450 const xmlChar *version; /* the XML version string */
451 const xmlChar *encoding; /* external initial encoding, if any */
452 void *ids; /* Hash table for ID attributes if any */
453 void *refs; /* Hash table for IDREFs attributes if any */
454 const xmlChar *URL; /* The URI for that document */
455 int charset; /* encoding of the in-memory content
456 actually an xmlCharEncoding */
457};
458
Daniel Veillardbed7b052001-05-19 14:59:49 +0000459/**
460 * xmlChildrenNode:
461 *
462 * Macro for compatibility naming layer with libxml1
Owen Taylor3473f882001-02-23 17:55:21 +0000463 */
464#ifndef xmlChildrenNode
465#define xmlChildrenNode children
Daniel Veillardbed7b052001-05-19 14:59:49 +0000466#endif
467
468/**
469 * xmlRootNode:
470 *
471 * Macro for compatibility naming layer with libxml1
472 */
473#ifndef xmlRootNode
Owen Taylor3473f882001-02-23 17:55:21 +0000474#define xmlRootNode children
475#endif
476
477/*
478 * Variables.
479 */
480LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
481LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
482LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
483LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillarde356c282001-03-10 12:32:04 +0000484LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
485LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
Owen Taylor3473f882001-02-23 17:55:21 +0000486
487/*
488 * Handling Buffers.
489 */
490
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000491void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
492xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
493
Owen Taylor3473f882001-02-23 17:55:21 +0000494xmlBufferPtr xmlBufferCreate (void);
495xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000496int xmlBufferResize (xmlBufferPtr buf,
497 unsigned int size);
Owen Taylor3473f882001-02-23 17:55:21 +0000498void xmlBufferFree (xmlBufferPtr buf);
499int xmlBufferDump (FILE *file,
500 xmlBufferPtr buf);
501void xmlBufferAdd (xmlBufferPtr buf,
502 const xmlChar *str,
503 int len);
504void xmlBufferAddHead (xmlBufferPtr buf,
505 const xmlChar *str,
506 int len);
507void xmlBufferCat (xmlBufferPtr buf,
508 const xmlChar *str);
509void xmlBufferCCat (xmlBufferPtr buf,
510 const char *str);
511int xmlBufferShrink (xmlBufferPtr buf,
512 unsigned int len);
513int xmlBufferGrow (xmlBufferPtr buf,
514 unsigned int len);
515void xmlBufferEmpty (xmlBufferPtr buf);
516const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
517int xmlBufferUse (const xmlBufferPtr buf);
518void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
519 xmlBufferAllocationScheme scheme);
520int xmlBufferLength (const xmlBufferPtr buf);
521
522/*
523 * Creating/freeing new structures
524 */
525xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
526 const xmlChar *name,
527 const xmlChar *ExternalID,
528 const xmlChar *SystemID);
529xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
530 const xmlChar *name,
531 const xmlChar *ExternalID,
532 const xmlChar *SystemID);
533xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
534void xmlFreeDtd (xmlDtdPtr cur);
535xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
536 const xmlChar *href,
537 const xmlChar *prefix);
538xmlNsPtr xmlNewNs (xmlNodePtr node,
539 const xmlChar *href,
540 const xmlChar *prefix);
541void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000542void xmlFreeNsList (xmlNsPtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000543xmlDocPtr xmlNewDoc (const xmlChar *version);
544void xmlFreeDoc (xmlDocPtr cur);
545xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
546 const xmlChar *name,
547 const xmlChar *value);
548xmlAttrPtr xmlNewProp (xmlNodePtr node,
549 const xmlChar *name,
550 const xmlChar *value);
551xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
552 xmlNsPtr ns,
553 const xmlChar *name,
554 const xmlChar *value);
555void xmlFreePropList (xmlAttrPtr cur);
556void xmlFreeProp (xmlAttrPtr cur);
557xmlAttrPtr xmlCopyProp (xmlNodePtr target,
558 xmlAttrPtr cur);
559xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
560 xmlAttrPtr cur);
561xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
562xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
563 int recursive);
564
565/*
566 * Creating new nodes
567 */
568xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
569 xmlNsPtr ns,
570 const xmlChar *name,
571 const xmlChar *content);
572xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
573 xmlNsPtr ns,
574 const xmlChar *name,
575 const xmlChar *content);
576xmlNodePtr xmlNewNode (xmlNsPtr ns,
577 const xmlChar *name);
578xmlNodePtr xmlNewChild (xmlNodePtr parent,
579 xmlNsPtr ns,
580 const xmlChar *name,
581 const xmlChar *content);
582xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
583 xmlNsPtr ns,
584 const xmlChar *name,
585 const xmlChar *content);
586xmlNodePtr xmlNewDocText (xmlDocPtr doc,
587 const xmlChar *content);
588xmlNodePtr xmlNewText (const xmlChar *content);
589xmlNodePtr xmlNewPI (const xmlChar *name,
590 const xmlChar *content);
591xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
592 const xmlChar *content,
593 int len);
594xmlNodePtr xmlNewTextLen (const xmlChar *content,
595 int len);
596xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
597 const xmlChar *content);
598xmlNodePtr xmlNewComment (const xmlChar *content);
599xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
600 const xmlChar *content,
601 int len);
602xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
603 const xmlChar *name);
604xmlNodePtr xmlNewReference (xmlDocPtr doc,
605 const xmlChar *name);
606xmlNodePtr xmlCopyNode (xmlNodePtr node,
607 int recursive);
Daniel Veillard82daa812001-04-12 08:55:36 +0000608xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
609 xmlDocPtr doc,
610 int recursive);
Owen Taylor3473f882001-02-23 17:55:21 +0000611xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
612xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
613
614/*
615 * Navigating
616 */
617xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
618xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
619int xmlNodeIsText (xmlNodePtr node);
620int xmlIsBlankNode (xmlNodePtr node);
621
622/*
623 * Changing the structure
624 */
625xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
626 xmlNodePtr root);
627void xmlNodeSetName (xmlNodePtr cur,
628 const xmlChar *name);
629xmlNodePtr xmlAddChild (xmlNodePtr parent,
630 xmlNodePtr cur);
631xmlNodePtr xmlAddChildList (xmlNodePtr parent,
632 xmlNodePtr cur);
633xmlNodePtr xmlReplaceNode (xmlNodePtr old,
634 xmlNodePtr cur);
635xmlNodePtr xmlAddSibling (xmlNodePtr cur,
636 xmlNodePtr elem);
637xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
638 xmlNodePtr elem);
639xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
640 xmlNodePtr elem);
641void xmlUnlinkNode (xmlNodePtr cur);
642xmlNodePtr xmlTextMerge (xmlNodePtr first,
643 xmlNodePtr second);
644void xmlTextConcat (xmlNodePtr node,
645 const xmlChar *content,
646 int len);
647void xmlFreeNodeList (xmlNodePtr cur);
648void xmlFreeNode (xmlNodePtr cur);
649void xmlSetTreeDoc (xmlNodePtr tree,
650 xmlDocPtr doc);
651void xmlSetListDoc (xmlNodePtr list,
652 xmlDocPtr doc);
653
654/*
655 * Namespaces
656 */
657xmlNsPtr xmlSearchNs (xmlDocPtr doc,
658 xmlNodePtr node,
659 const xmlChar *nameSpace);
660xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
661 xmlNodePtr node,
662 const xmlChar *href);
663xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
664 xmlNodePtr node);
665void xmlSetNs (xmlNodePtr node,
666 xmlNsPtr ns);
667xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
668xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
669
670/*
671 * Changing the content.
672 */
673xmlAttrPtr xmlSetProp (xmlNodePtr node,
674 const xmlChar *name,
675 const xmlChar *value);
676xmlChar * xmlGetProp (xmlNodePtr node,
677 const xmlChar *name);
Daniel Veillard75bea542001-05-11 17:41:21 +0000678int xmlUnsetProp (xmlNodePtr node,
679 const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000680xmlAttrPtr xmlHasProp (xmlNodePtr node,
681 const xmlChar *name);
682xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
683 xmlNsPtr ns,
684 const xmlChar *name,
685 const xmlChar *value);
686xmlChar * xmlGetNsProp (xmlNodePtr node,
687 const xmlChar *name,
688 const xmlChar *nameSpace);
Daniel Veillard75bea542001-05-11 17:41:21 +0000689int xmlUnsetNsProp (xmlNodePtr node,
690 xmlNsPtr ns,
691 const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000692xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
693 const xmlChar *value);
694xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
695 const xmlChar *value,
696 int len);
697xmlChar * xmlNodeListGetString (xmlDocPtr doc,
698 xmlNodePtr list,
699 int inLine);
700xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
701 xmlNodePtr list,
702 int inLine);
703void xmlNodeSetContent (xmlNodePtr cur,
704 const xmlChar *content);
705void xmlNodeSetContentLen (xmlNodePtr cur,
706 const xmlChar *content,
707 int len);
708void xmlNodeAddContent (xmlNodePtr cur,
709 const xmlChar *content);
710void xmlNodeAddContentLen (xmlNodePtr cur,
711 const xmlChar *content,
712 int len);
713xmlChar * xmlNodeGetContent (xmlNodePtr cur);
714xmlChar * xmlNodeGetLang (xmlNodePtr cur);
715void xmlNodeSetLang (xmlNodePtr cur,
716 const xmlChar *lang);
717int xmlNodeGetSpacePreserve (xmlNodePtr cur);
718void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
719 val);
720xmlChar * xmlNodeGetBase (xmlDocPtr doc,
721 xmlNodePtr cur);
722void xmlNodeSetBase (xmlNodePtr cur,
723 xmlChar *uri);
724
725/*
726 * Removing content.
727 */
728int xmlRemoveProp (xmlAttrPtr attr);
729int xmlRemoveNode (xmlNodePtr node); /* TODO */
730
731/*
732 * Internal, don't use
733 */
734#ifdef VMS
735void xmlBufferWriteXmlCHAR (xmlBufferPtr buf,
736 const xmlChar *string);
737#define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR
738#else
739void xmlBufferWriteCHAR (xmlBufferPtr buf,
740 const xmlChar *string);
741#endif
742void xmlBufferWriteChar (xmlBufferPtr buf,
743 const char *string);
744void xmlBufferWriteQuotedString(xmlBufferPtr buf,
745 const xmlChar *string);
746
747/*
748 * Namespace handling
749 */
750int xmlReconciliateNs (xmlDocPtr doc,
751 xmlNodePtr tree);
752
753/*
754 * Saving
755 */
756void xmlDocDumpFormatMemory (xmlDocPtr cur,
757 xmlChar**mem,
758 int *size,
759 int format);
760void xmlDocDumpMemory (xmlDocPtr cur,
761 xmlChar**mem,
762 int *size);
763void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
764 xmlChar **doc_txt_ptr,
765 int * doc_txt_len,
766 const char *txt_encoding);
767void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
768 xmlChar **doc_txt_ptr,
769 int * doc_txt_len,
770 const char *txt_encoding,
771 int format);
772int xmlDocDump (FILE *f,
773 xmlDocPtr cur);
774void xmlElemDump (FILE *f,
775 xmlDocPtr doc,
776 xmlNodePtr cur);
777int xmlSaveFile (const char *filename,
778 xmlDocPtr cur);
Daniel Veillard67fee942001-04-26 18:59:03 +0000779int xmlSaveFormatFile (const char *filename,
780 xmlDocPtr cur,
781 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000782void xmlNodeDump (xmlBufferPtr buf,
783 xmlDocPtr doc,
784 xmlNodePtr cur,
785 int level,
786 int format);
787
Daniel Veillardeefd4492001-04-28 16:55:50 +0000788/* These are exported from xmlIO.h
Owen Taylor3473f882001-02-23 17:55:21 +0000789
790int xmlSaveFileTo (xmlOutputBuffer *buf,
791 xmlDocPtr cur,
792 const char *encoding);
Daniel Veillardeefd4492001-04-28 16:55:50 +0000793int xmlSaveFormatFileTo (xmlOutputBuffer *buf,
794 xmlDocPtr cur,
795 const char *encoding,
796 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000797 */
798
799int xmlSaveFileEnc (const char *filename,
800 xmlDocPtr cur,
801 const char *encoding);
802
803/*
804 * Compression
805 */
806int xmlGetDocCompressMode (xmlDocPtr doc);
807void xmlSetDocCompressMode (xmlDocPtr doc,
808 int mode);
809int xmlGetCompressMode (void);
810void xmlSetCompressMode (int mode);
811
812#ifdef __cplusplus
813}
814#endif
815
816#endif /* __XML_TREE_H__ */
817