blob: 51a0a7d637c4ad267809935e3df65ec485b5adcf [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 * BAD_CAST:
74 *
75 * Macro to cast a string to an xmlChar * when one know its safe.
76 */
Owen Taylor3473f882001-02-23 17:55:21 +000077#define BAD_CAST (xmlChar *)
78
Daniel Veillardbed7b052001-05-19 14:59:49 +000079/**
80 * xmlNotation:
81 *
Owen Taylor3473f882001-02-23 17:55:21 +000082 * a DTD Notation definition
83 */
84
85typedef struct _xmlNotation xmlNotation;
86typedef xmlNotation *xmlNotationPtr;
87struct _xmlNotation {
Daniel Veillard9e7160d2001-03-18 23:17:47 +000088 const xmlChar *name; /* Notation name */
Owen Taylor3473f882001-02-23 17:55:21 +000089 const xmlChar *PublicID; /* Public identifier, if any */
90 const xmlChar *SystemID; /* System identifier, if any */
91};
92
Daniel Veillardbed7b052001-05-19 14:59:49 +000093/**
94 * xmlAttributeType:
95 *
96 * a DTD Attribute type definition
Owen Taylor3473f882001-02-23 17:55:21 +000097 */
98
99typedef enum {
100 XML_ATTRIBUTE_CDATA = 1,
101 XML_ATTRIBUTE_ID,
102 XML_ATTRIBUTE_IDREF ,
103 XML_ATTRIBUTE_IDREFS,
104 XML_ATTRIBUTE_ENTITY,
105 XML_ATTRIBUTE_ENTITIES,
106 XML_ATTRIBUTE_NMTOKEN,
107 XML_ATTRIBUTE_NMTOKENS,
108 XML_ATTRIBUTE_ENUMERATION,
109 XML_ATTRIBUTE_NOTATION
110} xmlAttributeType;
111
Daniel Veillardbed7b052001-05-19 14:59:49 +0000112/**
113 * xmlAttributeDefault:
114 *
115 * a DTD Attribute default definition
116 */
117
Owen Taylor3473f882001-02-23 17:55:21 +0000118typedef enum {
119 XML_ATTRIBUTE_NONE = 1,
120 XML_ATTRIBUTE_REQUIRED,
121 XML_ATTRIBUTE_IMPLIED,
122 XML_ATTRIBUTE_FIXED
123} xmlAttributeDefault;
124
Daniel Veillardbed7b052001-05-19 14:59:49 +0000125/**
126 * xmlEnumeration:
127 *
128 * list structure used when there is an enumeration in DTDs
129 */
130
Owen Taylor3473f882001-02-23 17:55:21 +0000131typedef struct _xmlEnumeration xmlEnumeration;
132typedef xmlEnumeration *xmlEnumerationPtr;
133struct _xmlEnumeration {
134 struct _xmlEnumeration *next; /* next one */
135 const xmlChar *name; /* Enumeration name */
136};
137
Daniel Veillardbed7b052001-05-19 14:59:49 +0000138/**
139 * xmlAttribute:
140 *
141 * an Attribute declaration in a DTD
142 */
143
Owen Taylor3473f882001-02-23 17:55:21 +0000144typedef struct _xmlAttribute xmlAttribute;
145typedef xmlAttribute *xmlAttributePtr;
146struct _xmlAttribute {
147#ifndef XML_WITHOUT_CORBA
148 void *_private; /* for Corba, must be first ! */
149#endif
150 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
151 const xmlChar *name; /* Attribute name */
152 struct _xmlNode *children; /* NULL */
153 struct _xmlNode *last; /* NULL */
154 struct _xmlDtd *parent; /* -> DTD */
155 struct _xmlNode *next; /* next sibling link */
156 struct _xmlNode *prev; /* previous sibling link */
157 struct _xmlDoc *doc; /* the containing document */
158
159 struct _xmlAttribute *nexth; /* next in hash table */
160 xmlAttributeType atype; /* The attribute type */
161 xmlAttributeDefault def; /* the default */
162 const xmlChar *defaultValue; /* or the default value */
163 xmlEnumerationPtr tree; /* or the enumeration tree if any */
164 const xmlChar *prefix; /* the namespace prefix if any */
165 const xmlChar *elem; /* Element holding the attribute */
166};
167
Daniel Veillardbed7b052001-05-19 14:59:49 +0000168/**
169 * xmlElementContentType:
170 *
171 * Possible definitions of element content types
Owen Taylor3473f882001-02-23 17:55:21 +0000172 */
173typedef enum {
174 XML_ELEMENT_CONTENT_PCDATA = 1,
175 XML_ELEMENT_CONTENT_ELEMENT,
176 XML_ELEMENT_CONTENT_SEQ,
177 XML_ELEMENT_CONTENT_OR
178} xmlElementContentType;
179
Daniel Veillardbed7b052001-05-19 14:59:49 +0000180/**
181 * xmlElementContentOccur:
182 *
183 * Possible definitions of element content occurences
184 */
Owen Taylor3473f882001-02-23 17:55:21 +0000185typedef enum {
186 XML_ELEMENT_CONTENT_ONCE = 1,
187 XML_ELEMENT_CONTENT_OPT,
188 XML_ELEMENT_CONTENT_MULT,
189 XML_ELEMENT_CONTENT_PLUS
190} xmlElementContentOccur;
191
Daniel Veillardbed7b052001-05-19 14:59:49 +0000192/**
193 * xmlElementContent:
194 *
195 * an XML Element content as stored after parsing an element definition
196 * in a DTD.
197 */
198
Owen Taylor3473f882001-02-23 17:55:21 +0000199typedef struct _xmlElementContent xmlElementContent;
200typedef xmlElementContent *xmlElementContentPtr;
201struct _xmlElementContent {
202 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
203 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
204 const xmlChar *name; /* Element name */
205 struct _xmlElementContent *c1; /* first child */
206 struct _xmlElementContent *c2; /* second child */
Daniel Veillarddab4cb32001-04-20 13:03:48 +0000207 struct _xmlElementContent *parent; /* parent */
Owen Taylor3473f882001-02-23 17:55:21 +0000208};
209
Daniel Veillardbed7b052001-05-19 14:59:49 +0000210/**
211 * xmlElementTypeVal:
212 *
213 * the differnt possibility for an element content type
214 */
215
Owen Taylor3473f882001-02-23 17:55:21 +0000216typedef enum {
Daniel Veillarda10efa82001-04-18 13:09:01 +0000217 XML_ELEMENT_TYPE_UNDEFINED = 0,
Owen Taylor3473f882001-02-23 17:55:21 +0000218 XML_ELEMENT_TYPE_EMPTY = 1,
219 XML_ELEMENT_TYPE_ANY,
220 XML_ELEMENT_TYPE_MIXED,
221 XML_ELEMENT_TYPE_ELEMENT
222} xmlElementTypeVal;
223
Daniel Veillardbed7b052001-05-19 14:59:49 +0000224/**
225 * xmlElement:
226 *
227 * an XML Element declaration from a DTD
228 */
229
Owen Taylor3473f882001-02-23 17:55:21 +0000230typedef struct _xmlElement xmlElement;
231typedef xmlElement *xmlElementPtr;
232struct _xmlElement {
233#ifndef XML_WITHOUT_CORBA
234 void *_private; /* for Corba, must be first ! */
235#endif
236 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
237 const xmlChar *name; /* Element name */
238 struct _xmlNode *children; /* NULL */
239 struct _xmlNode *last; /* NULL */
240 struct _xmlDtd *parent; /* -> DTD */
241 struct _xmlNode *next; /* next sibling link */
242 struct _xmlNode *prev; /* previous sibling link */
243 struct _xmlDoc *doc; /* the containing document */
244
245 xmlElementTypeVal etype; /* The type */
246 xmlElementContentPtr content; /* the allowed element content */
247 xmlAttributePtr attributes; /* List of the declared attributes */
248 const xmlChar *prefix; /* the namespace prefix if any */
249};
250
Daniel Veillardbed7b052001-05-19 14:59:49 +0000251
252#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
253typedef xmlElementType xmlNsType;
254
255/**
256 * xmlNs:
257 *
Owen Taylor3473f882001-02-23 17:55:21 +0000258 * An XML namespace.
259 * Note that prefix == NULL is valid, it defines the default namespace
260 * within the subtree (until overriden).
261 *
262 * XML_GLOBAL_NAMESPACE is now deprecated for good
263 * xmlNsType is unified with xmlElementType
264 */
265
Owen Taylor3473f882001-02-23 17:55:21 +0000266typedef struct _xmlNs xmlNs;
267typedef xmlNs *xmlNsPtr;
268struct _xmlNs {
269 struct _xmlNs *next; /* next Ns link for this node */
270 xmlNsType type; /* global or local */
271 const xmlChar *href; /* URL for the namespace */
272 const xmlChar *prefix; /* prefix for the namespace */
273};
274
Daniel Veillardbed7b052001-05-19 14:59:49 +0000275/**
276 * xmlDtd:
277 *
278 * An XML DtD, as defined by <!DOCTYPE ... There is actually one for
279 * the internal subset and for the external subset
Owen Taylor3473f882001-02-23 17:55:21 +0000280 */
281typedef struct _xmlDtd xmlDtd;
282typedef xmlDtd *xmlDtdPtr;
283struct _xmlDtd {
284#ifndef XML_WITHOUT_CORBA
285 void *_private; /* for Corba, must be first ! */
286#endif
287 xmlElementType type; /* XML_DTD_NODE, must be second ! */
288 const xmlChar *name; /* Name of the DTD */
289 struct _xmlNode *children; /* the value of the property link */
290 struct _xmlNode *last; /* last child link */
291 struct _xmlDoc *parent; /* child->parent link */
292 struct _xmlNode *next; /* next sibling link */
293 struct _xmlNode *prev; /* previous sibling link */
294 struct _xmlDoc *doc; /* the containing document */
295
296 /* End of common part */
297 void *notations; /* Hash table for notations if any */
298 void *elements; /* Hash table for elements if any */
299 void *attributes; /* Hash table for attributes if any */
300 void *entities; /* Hash table for entities if any */
301 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
302 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
303 void *pentities; /* Hash table for param entities if any */
304};
305
Daniel Veillardbed7b052001-05-19 14:59:49 +0000306/**
307 * xmlAttr:
308 *
309 * A attribute on an XML node.
Owen Taylor3473f882001-02-23 17:55:21 +0000310 */
311typedef struct _xmlAttr xmlAttr;
312typedef xmlAttr *xmlAttrPtr;
313struct _xmlAttr {
314#ifndef XML_WITHOUT_CORBA
315 void *_private; /* for Corba, must be first ! */
316#endif
317 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
318 const xmlChar *name; /* the name of the property */
319 struct _xmlNode *children; /* the value of the property */
320 struct _xmlNode *last; /* NULL */
321 struct _xmlNode *parent; /* child->parent link */
322 struct _xmlAttr *next; /* next sibling link */
323 struct _xmlAttr *prev; /* previous sibling link */
324 struct _xmlDoc *doc; /* the containing document */
325 xmlNs *ns; /* pointer to the associated namespace */
326 xmlAttributeType atype; /* the attribute type if validating */
327};
328
Daniel Veillardbed7b052001-05-19 14:59:49 +0000329/**
330 * xmlID:
331 *
Owen Taylor3473f882001-02-23 17:55:21 +0000332 * An XML ID instance.
333 */
334
335typedef struct _xmlID xmlID;
336typedef xmlID *xmlIDPtr;
337struct _xmlID {
338 struct _xmlID *next; /* next ID */
339 const xmlChar *value; /* The ID name */
340 xmlAttrPtr attr; /* The attribut holding it */
341};
342
Daniel Veillardbed7b052001-05-19 14:59:49 +0000343/**
344 * xmlRef:
345 *
Owen Taylor3473f882001-02-23 17:55:21 +0000346 * An XML IDREF instance.
347 */
348
349typedef struct _xmlRef xmlRef;
350typedef xmlRef *xmlRefPtr;
351struct _xmlRef {
352 struct _xmlRef *next; /* next Ref */
353 const xmlChar *value; /* The Ref name */
354 xmlAttrPtr attr; /* The attribut holding it */
355};
356
Daniel Veillardbed7b052001-05-19 14:59:49 +0000357/**
358 * xmlBufferAllocationScheme:
359 *
360 * A buffer allocation scheme can be defined to either match exactly the
361 * need or double it's allocated size each time it is found too small
Owen Taylor3473f882001-02-23 17:55:21 +0000362 */
363
364typedef enum {
365 XML_BUFFER_ALLOC_DOUBLEIT,
366 XML_BUFFER_ALLOC_EXACT
367} xmlBufferAllocationScheme;
368
Daniel Veillardbed7b052001-05-19 14:59:49 +0000369/**
370 * xmlBuffer:
371 *
372 * A buffer structure
373 */
Owen Taylor3473f882001-02-23 17:55:21 +0000374typedef struct _xmlBuffer xmlBuffer;
375typedef xmlBuffer *xmlBufferPtr;
376struct _xmlBuffer {
377 xmlChar *content; /* The buffer content UTF8 */
378 unsigned int use; /* The buffer size used */
379 unsigned int size; /* The buffer size */
380 xmlBufferAllocationScheme alloc; /* The realloc method */
381};
382
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000383/**
384 * xmlNode:
385 *
Owen Taylor3473f882001-02-23 17:55:21 +0000386 * A node in an XML tree.
387 */
388typedef struct _xmlNode xmlNode;
389typedef xmlNode *xmlNodePtr;
390struct _xmlNode {
391#ifndef XML_WITHOUT_CORBA
392 void *_private; /* for Corba, must be first ! */
393#endif
394 xmlElementType type; /* type number, must be second ! */
395 const xmlChar *name; /* the name of the node, or the entity */
396 struct _xmlNode *children; /* parent->childs link */
397 struct _xmlNode *last; /* last child link */
398 struct _xmlNode *parent; /* child->parent link */
399 struct _xmlNode *next; /* next sibling link */
400 struct _xmlNode *prev; /* previous sibling link */
401 struct _xmlDoc *doc; /* the containing document */
402 xmlNs *ns; /* pointer to the associated namespace */
403#ifndef XML_USE_BUFFER_CONTENT
404 xmlChar *content; /* the content */
405#else
406 xmlBufferPtr content; /* the content in a buffer */
407#endif
408
409 /* End of common part */
410 struct _xmlAttr *properties;/* properties list */
411 xmlNs *nsDef; /* namespace definitions on this node */
412};
413
Daniel Veillardbed7b052001-05-19 14:59:49 +0000414/**
415 * xmlDoc:
416 *
Owen Taylor3473f882001-02-23 17:55:21 +0000417 * An XML document.
418 */
419typedef struct _xmlDoc xmlDoc;
420typedef xmlDoc *xmlDocPtr;
421struct _xmlDoc {
422#ifndef XML_WITHOUT_CORBA
423 void *_private; /* for Corba, must be first ! */
424#endif
425 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
426 char *name; /* name/filename/URI of the document */
427 struct _xmlNode *children; /* the document tree */
428 struct _xmlNode *last; /* last child link */
429 struct _xmlNode *parent; /* child->parent link */
430 struct _xmlNode *next; /* next sibling link */
431 struct _xmlNode *prev; /* previous sibling link */
432 struct _xmlDoc *doc; /* autoreference to itself */
433
434 /* End of common part */
435 int compression;/* level of zlib compression */
436 int standalone; /* standalone document (no external refs) */
437 struct _xmlDtd *intSubset; /* the document internal subset */
438 struct _xmlDtd *extSubset; /* the document external subset */
439 struct _xmlNs *oldNs; /* Global namespace, the old way */
440 const xmlChar *version; /* the XML version string */
441 const xmlChar *encoding; /* external initial encoding, if any */
442 void *ids; /* Hash table for ID attributes if any */
443 void *refs; /* Hash table for IDREFs attributes if any */
444 const xmlChar *URL; /* The URI for that document */
445 int charset; /* encoding of the in-memory content
446 actually an xmlCharEncoding */
447};
448
Daniel Veillardbed7b052001-05-19 14:59:49 +0000449/**
450 * xmlChildrenNode:
451 *
452 * Macro for compatibility naming layer with libxml1
Owen Taylor3473f882001-02-23 17:55:21 +0000453 */
454#ifndef xmlChildrenNode
455#define xmlChildrenNode children
Daniel Veillardbed7b052001-05-19 14:59:49 +0000456#endif
457
458/**
459 * xmlRootNode:
460 *
461 * Macro for compatibility naming layer with libxml1
462 */
463#ifndef xmlRootNode
Owen Taylor3473f882001-02-23 17:55:21 +0000464#define xmlRootNode children
465#endif
466
467/*
468 * Variables.
469 */
470LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
471LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
472LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
473LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillarde356c282001-03-10 12:32:04 +0000474LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
475LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
Owen Taylor3473f882001-02-23 17:55:21 +0000476
477/*
478 * Handling Buffers.
479 */
480
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000481void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
482xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
483
Owen Taylor3473f882001-02-23 17:55:21 +0000484xmlBufferPtr xmlBufferCreate (void);
485xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000486int xmlBufferResize (xmlBufferPtr buf,
487 unsigned int size);
Owen Taylor3473f882001-02-23 17:55:21 +0000488void xmlBufferFree (xmlBufferPtr buf);
489int xmlBufferDump (FILE *file,
490 xmlBufferPtr buf);
491void xmlBufferAdd (xmlBufferPtr buf,
492 const xmlChar *str,
493 int len);
494void xmlBufferAddHead (xmlBufferPtr buf,
495 const xmlChar *str,
496 int len);
497void xmlBufferCat (xmlBufferPtr buf,
498 const xmlChar *str);
499void xmlBufferCCat (xmlBufferPtr buf,
500 const char *str);
501int xmlBufferShrink (xmlBufferPtr buf,
502 unsigned int len);
503int xmlBufferGrow (xmlBufferPtr buf,
504 unsigned int len);
505void xmlBufferEmpty (xmlBufferPtr buf);
506const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
507int xmlBufferUse (const xmlBufferPtr buf);
508void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
509 xmlBufferAllocationScheme scheme);
510int xmlBufferLength (const xmlBufferPtr buf);
511
512/*
513 * Creating/freeing new structures
514 */
515xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
516 const xmlChar *name,
517 const xmlChar *ExternalID,
518 const xmlChar *SystemID);
519xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
520 const xmlChar *name,
521 const xmlChar *ExternalID,
522 const xmlChar *SystemID);
523xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
524void xmlFreeDtd (xmlDtdPtr cur);
525xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
526 const xmlChar *href,
527 const xmlChar *prefix);
528xmlNsPtr xmlNewNs (xmlNodePtr node,
529 const xmlChar *href,
530 const xmlChar *prefix);
531void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000532void xmlFreeNsList (xmlNsPtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000533xmlDocPtr xmlNewDoc (const xmlChar *version);
534void xmlFreeDoc (xmlDocPtr cur);
535xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
536 const xmlChar *name,
537 const xmlChar *value);
538xmlAttrPtr xmlNewProp (xmlNodePtr node,
539 const xmlChar *name,
540 const xmlChar *value);
541xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
542 xmlNsPtr ns,
543 const xmlChar *name,
544 const xmlChar *value);
545void xmlFreePropList (xmlAttrPtr cur);
546void xmlFreeProp (xmlAttrPtr cur);
547xmlAttrPtr xmlCopyProp (xmlNodePtr target,
548 xmlAttrPtr cur);
549xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
550 xmlAttrPtr cur);
551xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
552xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
553 int recursive);
554
555/*
556 * Creating new nodes
557 */
558xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
559 xmlNsPtr ns,
560 const xmlChar *name,
561 const xmlChar *content);
562xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
563 xmlNsPtr ns,
564 const xmlChar *name,
565 const xmlChar *content);
566xmlNodePtr xmlNewNode (xmlNsPtr ns,
567 const xmlChar *name);
568xmlNodePtr xmlNewChild (xmlNodePtr parent,
569 xmlNsPtr ns,
570 const xmlChar *name,
571 const xmlChar *content);
572xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
573 xmlNsPtr ns,
574 const xmlChar *name,
575 const xmlChar *content);
576xmlNodePtr xmlNewDocText (xmlDocPtr doc,
577 const xmlChar *content);
578xmlNodePtr xmlNewText (const xmlChar *content);
579xmlNodePtr xmlNewPI (const xmlChar *name,
580 const xmlChar *content);
581xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
582 const xmlChar *content,
583 int len);
584xmlNodePtr xmlNewTextLen (const xmlChar *content,
585 int len);
586xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
587 const xmlChar *content);
588xmlNodePtr xmlNewComment (const xmlChar *content);
589xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
590 const xmlChar *content,
591 int len);
592xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
593 const xmlChar *name);
594xmlNodePtr xmlNewReference (xmlDocPtr doc,
595 const xmlChar *name);
596xmlNodePtr xmlCopyNode (xmlNodePtr node,
597 int recursive);
Daniel Veillard82daa812001-04-12 08:55:36 +0000598xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
599 xmlDocPtr doc,
600 int recursive);
Owen Taylor3473f882001-02-23 17:55:21 +0000601xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
602xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
603
604/*
605 * Navigating
606 */
607xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
608xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
609int xmlNodeIsText (xmlNodePtr node);
610int xmlIsBlankNode (xmlNodePtr node);
611
612/*
613 * Changing the structure
614 */
615xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
616 xmlNodePtr root);
617void xmlNodeSetName (xmlNodePtr cur,
618 const xmlChar *name);
619xmlNodePtr xmlAddChild (xmlNodePtr parent,
620 xmlNodePtr cur);
621xmlNodePtr xmlAddChildList (xmlNodePtr parent,
622 xmlNodePtr cur);
623xmlNodePtr xmlReplaceNode (xmlNodePtr old,
624 xmlNodePtr cur);
625xmlNodePtr xmlAddSibling (xmlNodePtr cur,
626 xmlNodePtr elem);
627xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
628 xmlNodePtr elem);
629xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
630 xmlNodePtr elem);
631void xmlUnlinkNode (xmlNodePtr cur);
632xmlNodePtr xmlTextMerge (xmlNodePtr first,
633 xmlNodePtr second);
634void xmlTextConcat (xmlNodePtr node,
635 const xmlChar *content,
636 int len);
637void xmlFreeNodeList (xmlNodePtr cur);
638void xmlFreeNode (xmlNodePtr cur);
639void xmlSetTreeDoc (xmlNodePtr tree,
640 xmlDocPtr doc);
641void xmlSetListDoc (xmlNodePtr list,
642 xmlDocPtr doc);
643
644/*
645 * Namespaces
646 */
647xmlNsPtr xmlSearchNs (xmlDocPtr doc,
648 xmlNodePtr node,
649 const xmlChar *nameSpace);
650xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
651 xmlNodePtr node,
652 const xmlChar *href);
653xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
654 xmlNodePtr node);
655void xmlSetNs (xmlNodePtr node,
656 xmlNsPtr ns);
657xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
658xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
659
660/*
661 * Changing the content.
662 */
663xmlAttrPtr xmlSetProp (xmlNodePtr node,
664 const xmlChar *name,
665 const xmlChar *value);
666xmlChar * xmlGetProp (xmlNodePtr node,
667 const xmlChar *name);
668xmlAttrPtr xmlHasProp (xmlNodePtr node,
669 const xmlChar *name);
Daniel Veillarde95e2392001-06-06 10:46:28 +0000670xmlAttrPtr xmlHasNsProp (xmlNodePtr node,
671 const xmlChar *name,
Daniel Veillardca2366a2001-06-11 12:09:01 +0000672 const xmlChar *nameSpace);
Owen Taylor3473f882001-02-23 17:55:21 +0000673xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
674 xmlNsPtr ns,
675 const xmlChar *name,
676 const xmlChar *value);
677xmlChar * xmlGetNsProp (xmlNodePtr node,
678 const xmlChar *name,
679 const xmlChar *nameSpace);
680xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
681 const xmlChar *value);
682xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
683 const xmlChar *value,
684 int len);
685xmlChar * xmlNodeListGetString (xmlDocPtr doc,
686 xmlNodePtr list,
687 int inLine);
688xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
689 xmlNodePtr list,
690 int inLine);
691void xmlNodeSetContent (xmlNodePtr cur,
692 const xmlChar *content);
693void xmlNodeSetContentLen (xmlNodePtr cur,
694 const xmlChar *content,
695 int len);
696void xmlNodeAddContent (xmlNodePtr cur,
697 const xmlChar *content);
698void xmlNodeAddContentLen (xmlNodePtr cur,
699 const xmlChar *content,
700 int len);
701xmlChar * xmlNodeGetContent (xmlNodePtr cur);
702xmlChar * xmlNodeGetLang (xmlNodePtr cur);
703void xmlNodeSetLang (xmlNodePtr cur,
704 const xmlChar *lang);
705int xmlNodeGetSpacePreserve (xmlNodePtr cur);
706void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
707 val);
708xmlChar * xmlNodeGetBase (xmlDocPtr doc,
709 xmlNodePtr cur);
710void xmlNodeSetBase (xmlNodePtr cur,
711 xmlChar *uri);
712
713/*
714 * Removing content.
715 */
716int xmlRemoveProp (xmlAttrPtr attr);
717int xmlRemoveNode (xmlNodePtr node); /* TODO */
Daniel Veillard9403a042001-05-28 11:00:53 +0000718int xmlUnsetProp (xmlNodePtr node,
719 const xmlChar *name);
720int xmlUnsetNsProp (xmlNodePtr node,
721 xmlNsPtr ns,
722 const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000723
724/*
725 * Internal, don't use
726 */
727#ifdef VMS
728void xmlBufferWriteXmlCHAR (xmlBufferPtr buf,
729 const xmlChar *string);
730#define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR
731#else
732void xmlBufferWriteCHAR (xmlBufferPtr buf,
733 const xmlChar *string);
734#endif
735void xmlBufferWriteChar (xmlBufferPtr buf,
736 const char *string);
737void xmlBufferWriteQuotedString(xmlBufferPtr buf,
738 const xmlChar *string);
739
740/*
741 * Namespace handling
742 */
743int xmlReconciliateNs (xmlDocPtr doc,
744 xmlNodePtr tree);
745
746/*
747 * Saving
748 */
749void xmlDocDumpFormatMemory (xmlDocPtr cur,
750 xmlChar**mem,
751 int *size,
752 int format);
753void xmlDocDumpMemory (xmlDocPtr cur,
754 xmlChar**mem,
755 int *size);
756void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
757 xmlChar **doc_txt_ptr,
758 int * doc_txt_len,
759 const char *txt_encoding);
760void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
761 xmlChar **doc_txt_ptr,
762 int * doc_txt_len,
763 const char *txt_encoding,
764 int format);
765int xmlDocDump (FILE *f,
766 xmlDocPtr cur);
767void xmlElemDump (FILE *f,
768 xmlDocPtr doc,
769 xmlNodePtr cur);
770int xmlSaveFile (const char *filename,
771 xmlDocPtr cur);
Daniel Veillard67fee942001-04-26 18:59:03 +0000772int xmlSaveFormatFile (const char *filename,
773 xmlDocPtr cur,
774 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000775void xmlNodeDump (xmlBufferPtr buf,
776 xmlDocPtr doc,
777 xmlNodePtr cur,
778 int level,
779 int format);
780
Daniel Veillardeefd4492001-04-28 16:55:50 +0000781/* These are exported from xmlIO.h
Owen Taylor3473f882001-02-23 17:55:21 +0000782
783int xmlSaveFileTo (xmlOutputBuffer *buf,
784 xmlDocPtr cur,
785 const char *encoding);
Daniel Veillardeefd4492001-04-28 16:55:50 +0000786int xmlSaveFormatFileTo (xmlOutputBuffer *buf,
787 xmlDocPtr cur,
788 const char *encoding,
789 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000790 */
791
792int xmlSaveFileEnc (const char *filename,
793 xmlDocPtr cur,
794 const char *encoding);
795
796/*
797 * Compression
798 */
799int xmlGetDocCompressMode (xmlDocPtr doc);
800void xmlSetDocCompressMode (xmlDocPtr doc,
801 int mode);
802int xmlGetCompressMode (void);
803void xmlSetCompressMode (int mode);
804
805#ifdef __cplusplus
806}
807#endif
808
809#endif /* __XML_TREE_H__ */
810