• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Summary: interfaces for tree manipulation
3  * Description: this module describes the structures found in an tree resulting
4  *              from an XML or HTML parsing, as well as the API provided for
5  *              various processing on that tree
6  *
7  * Copy: See Copyright for the status of this software.
8  *
9  * Author: Daniel Veillard
10  */
11 
12 #ifndef __XML_TREE_H__
13 #define __XML_TREE_H__
14 
15 #include <stdio.h>
16 #include <limits.h>
17 #include <libxml/xmlversion.h>
18 #include <libxml/xmlstring.h>
19 #include <libxml/xmlmemory.h>
20 #include <libxml/xmlregexp.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /*
27  * Some of the basic types pointer to structures:
28  */
29 /* xmlIO.h */
30 typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
31 typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
32 
33 typedef struct _xmlOutputBuffer xmlOutputBuffer;
34 typedef xmlOutputBuffer *xmlOutputBufferPtr;
35 
36 /* parser.h */
37 typedef struct _xmlParserInput xmlParserInput;
38 typedef xmlParserInput *xmlParserInputPtr;
39 
40 typedef struct _xmlParserCtxt xmlParserCtxt;
41 typedef xmlParserCtxt *xmlParserCtxtPtr;
42 
43 typedef struct _xmlSAXLocator xmlSAXLocator;
44 typedef xmlSAXLocator *xmlSAXLocatorPtr;
45 
46 typedef struct _xmlSAXHandler xmlSAXHandler;
47 typedef xmlSAXHandler *xmlSAXHandlerPtr;
48 
49 /* entities.h */
50 typedef struct _xmlEntity xmlEntity;
51 typedef xmlEntity *xmlEntityPtr;
52 
53 /**
54  * BASE_BUFFER_SIZE:
55  *
56  * default buffer size 4000.
57  */
58 #define BASE_BUFFER_SIZE 4096
59 
60 /**
61  * LIBXML_NAMESPACE_DICT:
62  *
63  * Defines experimental behaviour:
64  * 1) xmlNs gets an additional field @context (a xmlDoc)
65  * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
66  */
67 /* #define LIBXML_NAMESPACE_DICT */
68 
69 /**
70  * xmlBufferAllocationScheme:
71  *
72  * A buffer allocation scheme can be defined to either match exactly the
73  * need or double it's allocated size each time it is found too small.
74  */
75 
76 typedef enum {
77     XML_BUFFER_ALLOC_DOUBLEIT,	/* double each time one need to grow */
78     XML_BUFFER_ALLOC_EXACT,	/* grow only to the minimal size */
79     XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer, deprecated */
80     XML_BUFFER_ALLOC_IO,	/* special allocation scheme used for I/O */
81     XML_BUFFER_ALLOC_HYBRID,	/* exact up to a threshold, and doubleit thereafter */
82     XML_BUFFER_ALLOC_BOUNDED	/* limit the upper size of the buffer */
83 } xmlBufferAllocationScheme;
84 
85 /**
86  * xmlBuffer:
87  *
88  * A buffer structure, this old construct is limited to 2GB and
89  * is being deprecated, use API with xmlBuf instead
90  */
91 typedef struct _xmlBuffer xmlBuffer;
92 typedef xmlBuffer *xmlBufferPtr;
93 struct _xmlBuffer {
94     /* The buffer content UTF8 */
95     xmlChar *content XML_DEPRECATED_MEMBER;
96     /* The buffer size used */
97     unsigned int use XML_DEPRECATED_MEMBER;
98     /* The buffer size */
99     unsigned int size XML_DEPRECATED_MEMBER;
100     /* The realloc method */
101     xmlBufferAllocationScheme alloc XML_DEPRECATED_MEMBER;
102     /* in IO mode we may have a different base */
103     xmlChar *contentIO XML_DEPRECATED_MEMBER;
104 };
105 
106 /**
107  * xmlBuf:
108  *
109  * A buffer structure, new one, the actual structure internals are not public
110  */
111 
112 typedef struct _xmlBuf xmlBuf;
113 
114 /**
115  * xmlBufPtr:
116  *
117  * A pointer to a buffer structure, the actual structure internals are not
118  * public
119  */
120 
121 typedef xmlBuf *xmlBufPtr;
122 
123 /*
124  * A few public routines for xmlBuf. As those are expected to be used
125  * mostly internally the bulk of the routines are internal in buf.h
126  */
127 XMLPUBFUN xmlChar*       xmlBufContent	(const xmlBuf* buf);
128 XMLPUBFUN xmlChar*       xmlBufEnd      (xmlBufPtr buf);
129 XMLPUBFUN size_t         xmlBufUse      (const xmlBufPtr buf);
130 XMLPUBFUN size_t         xmlBufShrink	(xmlBufPtr buf, size_t len);
131 
132 /*
133  * LIBXML2_NEW_BUFFER:
134  *
135  * Macro used to express that the API use the new buffers for
136  * xmlParserInputBuffer and xmlOutputBuffer. The change was
137  * introduced in 2.9.0.
138  */
139 #define LIBXML2_NEW_BUFFER
140 
141 /**
142  * XML_XML_NAMESPACE:
143  *
144  * This is the namespace for the special xml: prefix predefined in the
145  * XML Namespace specification.
146  */
147 #define XML_XML_NAMESPACE \
148     (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
149 
150 /**
151  * XML_XML_ID:
152  *
153  * This is the name for the special xml:id attribute
154  */
155 #define XML_XML_ID (const xmlChar *) "xml:id"
156 
157 /*
158  * The different element types carried by an XML tree.
159  *
160  * NOTE: This is synchronized with DOM Level1 values
161  *       See http://www.w3.org/TR/REC-DOM-Level-1/
162  *
163  * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
164  * be deprecated to use an XML_DTD_NODE.
165  */
166 typedef enum {
167     XML_ELEMENT_NODE=		1,
168     XML_ATTRIBUTE_NODE=		2,
169     XML_TEXT_NODE=		3,
170     XML_CDATA_SECTION_NODE=	4,
171     XML_ENTITY_REF_NODE=	5,
172     XML_ENTITY_NODE=		6,  /* unused */
173     XML_PI_NODE=		7,
174     XML_COMMENT_NODE=		8,
175     XML_DOCUMENT_NODE=		9,
176     XML_DOCUMENT_TYPE_NODE=	10, /* unused */
177     XML_DOCUMENT_FRAG_NODE=	11,
178     XML_NOTATION_NODE=		12, /* unused */
179     XML_HTML_DOCUMENT_NODE=	13,
180     XML_DTD_NODE=		14,
181     XML_ELEMENT_DECL=		15,
182     XML_ATTRIBUTE_DECL=		16,
183     XML_ENTITY_DECL=		17,
184     XML_NAMESPACE_DECL=		18,
185     XML_XINCLUDE_START=		19,
186     XML_XINCLUDE_END=		20
187     /* XML_DOCB_DOCUMENT_NODE=	21 */ /* removed */
188 } xmlElementType;
189 
190 /** DOC_DISABLE */
191 /* For backward compatibility */
192 #define XML_DOCB_DOCUMENT_NODE 21
193 /** DOC_ENABLE */
194 
195 /**
196  * xmlNotation:
197  *
198  * A DTD Notation definition.
199  */
200 
201 typedef struct _xmlNotation xmlNotation;
202 typedef xmlNotation *xmlNotationPtr;
203 struct _xmlNotation {
204     const xmlChar               *name;	        /* Notation name */
205     const xmlChar               *PublicID;	/* Public identifier, if any */
206     const xmlChar               *SystemID;	/* System identifier, if any */
207 };
208 
209 /**
210  * xmlAttributeType:
211  *
212  * A DTD Attribute type definition.
213  */
214 
215 typedef enum {
216     XML_ATTRIBUTE_CDATA = 1,
217     XML_ATTRIBUTE_ID,
218     XML_ATTRIBUTE_IDREF	,
219     XML_ATTRIBUTE_IDREFS,
220     XML_ATTRIBUTE_ENTITY,
221     XML_ATTRIBUTE_ENTITIES,
222     XML_ATTRIBUTE_NMTOKEN,
223     XML_ATTRIBUTE_NMTOKENS,
224     XML_ATTRIBUTE_ENUMERATION,
225     XML_ATTRIBUTE_NOTATION
226 } xmlAttributeType;
227 
228 /**
229  * xmlAttributeDefault:
230  *
231  * A DTD Attribute default definition.
232  */
233 
234 typedef enum {
235     XML_ATTRIBUTE_NONE = 1,
236     XML_ATTRIBUTE_REQUIRED,
237     XML_ATTRIBUTE_IMPLIED,
238     XML_ATTRIBUTE_FIXED
239 } xmlAttributeDefault;
240 
241 /**
242  * xmlEnumeration:
243  *
244  * List structure used when there is an enumeration in DTDs.
245  */
246 
247 typedef struct _xmlEnumeration xmlEnumeration;
248 typedef xmlEnumeration *xmlEnumerationPtr;
249 struct _xmlEnumeration {
250     struct _xmlEnumeration    *next;	/* next one */
251     const xmlChar            *name;	/* Enumeration name */
252 };
253 
254 /**
255  * xmlAttribute:
256  *
257  * An Attribute declaration in a DTD.
258  */
259 
260 typedef struct _xmlAttribute xmlAttribute;
261 typedef xmlAttribute *xmlAttributePtr;
262 struct _xmlAttribute {
263     void           *_private;	        /* application data */
264     xmlElementType          type;       /* XML_ATTRIBUTE_DECL, must be second ! */
265     const xmlChar          *name;	/* Attribute name */
266     struct _xmlNode    *children;	/* NULL */
267     struct _xmlNode        *last;	/* NULL */
268     struct _xmlDtd       *parent;	/* -> DTD */
269     struct _xmlNode        *next;	/* next sibling link  */
270     struct _xmlNode        *prev;	/* previous sibling link  */
271     struct _xmlDoc          *doc;       /* the containing document */
272 
273     struct _xmlAttribute  *nexth;	/* next in hash table */
274     xmlAttributeType       atype;	/* The attribute type */
275     xmlAttributeDefault      def;	/* the default */
276     const xmlChar  *defaultValue;	/* or the default value */
277     xmlEnumerationPtr       tree;       /* or the enumeration tree if any */
278     const xmlChar        *prefix;	/* the namespace prefix if any */
279     const xmlChar          *elem;	/* Element holding the attribute */
280 };
281 
282 /**
283  * xmlElementContentType:
284  *
285  * Possible definitions of element content types.
286  */
287 typedef enum {
288     XML_ELEMENT_CONTENT_PCDATA = 1,
289     XML_ELEMENT_CONTENT_ELEMENT,
290     XML_ELEMENT_CONTENT_SEQ,
291     XML_ELEMENT_CONTENT_OR
292 } xmlElementContentType;
293 
294 /**
295  * xmlElementContentOccur:
296  *
297  * Possible definitions of element content occurrences.
298  */
299 typedef enum {
300     XML_ELEMENT_CONTENT_ONCE = 1,
301     XML_ELEMENT_CONTENT_OPT,
302     XML_ELEMENT_CONTENT_MULT,
303     XML_ELEMENT_CONTENT_PLUS
304 } xmlElementContentOccur;
305 
306 /**
307  * xmlElementContent:
308  *
309  * An XML Element content as stored after parsing an element definition
310  * in a DTD.
311  */
312 
313 typedef struct _xmlElementContent xmlElementContent;
314 typedef xmlElementContent *xmlElementContentPtr;
315 struct _xmlElementContent {
316     xmlElementContentType     type;	/* PCDATA, ELEMENT, SEQ or OR */
317     xmlElementContentOccur    ocur;	/* ONCE, OPT, MULT or PLUS */
318     const xmlChar             *name;	/* Element name */
319     struct _xmlElementContent *c1;	/* first child */
320     struct _xmlElementContent *c2;	/* second child */
321     struct _xmlElementContent *parent;	/* parent */
322     const xmlChar             *prefix;	/* Namespace prefix */
323 };
324 
325 /**
326  * xmlElementTypeVal:
327  *
328  * The different possibilities for an element content type.
329  */
330 
331 typedef enum {
332     XML_ELEMENT_TYPE_UNDEFINED = 0,
333     XML_ELEMENT_TYPE_EMPTY = 1,
334     XML_ELEMENT_TYPE_ANY,
335     XML_ELEMENT_TYPE_MIXED,
336     XML_ELEMENT_TYPE_ELEMENT
337 } xmlElementTypeVal;
338 
339 /**
340  * xmlElement:
341  *
342  * An XML Element declaration from a DTD.
343  */
344 
345 typedef struct _xmlElement xmlElement;
346 typedef xmlElement *xmlElementPtr;
347 struct _xmlElement {
348     void           *_private;	        /* application data */
349     xmlElementType          type;       /* XML_ELEMENT_DECL, must be second ! */
350     const xmlChar          *name;	/* Element name */
351     struct _xmlNode    *children;	/* NULL */
352     struct _xmlNode        *last;	/* NULL */
353     struct _xmlDtd       *parent;	/* -> DTD */
354     struct _xmlNode        *next;	/* next sibling link  */
355     struct _xmlNode        *prev;	/* previous sibling link  */
356     struct _xmlDoc          *doc;       /* the containing document */
357 
358     xmlElementTypeVal      etype;	/* The type */
359     xmlElementContentPtr content;	/* the allowed element content */
360     xmlAttributePtr   attributes;	/* List of the declared attributes */
361     const xmlChar        *prefix;	/* the namespace prefix if any */
362 #ifdef LIBXML_REGEXP_ENABLED
363     xmlRegexpPtr       contModel;	/* the validating regexp */
364 #else
365     void	      *contModel;
366 #endif
367 };
368 
369 
370 /**
371  * XML_LOCAL_NAMESPACE:
372  *
373  * A namespace declaration node.
374  */
375 #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
376 typedef xmlElementType xmlNsType;
377 
378 /**
379  * xmlNs:
380  *
381  * An XML namespace.
382  * Note that prefix == NULL is valid, it defines the default namespace
383  * within the subtree (until overridden).
384  *
385  * xmlNsType is unified with xmlElementType.
386  */
387 
388 typedef struct _xmlNs xmlNs;
389 typedef xmlNs *xmlNsPtr;
390 struct _xmlNs {
391     struct _xmlNs  *next;	/* next Ns link for this node  */
392     xmlNsType      type;	/* global or local */
393     const xmlChar *href;	/* URL for the namespace */
394     const xmlChar *prefix;	/* prefix for the namespace */
395     void           *_private;   /* application data */
396     struct _xmlDoc *context;		/* normally an xmlDoc */
397 };
398 
399 /**
400  * xmlDtd:
401  *
402  * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
403  * the internal subset and for the external subset.
404  */
405 typedef struct _xmlDtd xmlDtd;
406 typedef xmlDtd *xmlDtdPtr;
407 struct _xmlDtd {
408     void           *_private;	/* application data */
409     xmlElementType  type;       /* XML_DTD_NODE, must be second ! */
410     const xmlChar *name;	/* Name of the DTD */
411     struct _xmlNode *children;	/* the value of the property link */
412     struct _xmlNode *last;	/* last child link */
413     struct _xmlDoc  *parent;	/* child->parent link */
414     struct _xmlNode *next;	/* next sibling link  */
415     struct _xmlNode *prev;	/* previous sibling link  */
416     struct _xmlDoc  *doc;	/* the containing document */
417 
418     /* End of common part */
419     void          *notations;   /* Hash table for notations if any */
420     void          *elements;    /* Hash table for elements if any */
421     void          *attributes;  /* Hash table for attributes if any */
422     void          *entities;    /* Hash table for entities if any */
423     const xmlChar *ExternalID;	/* External identifier for PUBLIC DTD */
424     const xmlChar *SystemID;	/* URI for a SYSTEM or PUBLIC DTD */
425     void          *pentities;   /* Hash table for param entities if any */
426 };
427 
428 /**
429  * xmlAttr:
430  *
431  * An attribute on an XML node.
432  */
433 typedef struct _xmlAttr xmlAttr;
434 typedef xmlAttr *xmlAttrPtr;
435 struct _xmlAttr {
436     void           *_private;	/* application data */
437     xmlElementType   type;      /* XML_ATTRIBUTE_NODE, must be second ! */
438     const xmlChar   *name;      /* the name of the property */
439     struct _xmlNode *children;	/* the value of the property */
440     struct _xmlNode *last;	/* NULL */
441     struct _xmlNode *parent;	/* child->parent link */
442     struct _xmlAttr *next;	/* next sibling link  */
443     struct _xmlAttr *prev;	/* previous sibling link  */
444     struct _xmlDoc  *doc;	/* the containing document */
445     xmlNs           *ns;        /* pointer to the associated namespace */
446     xmlAttributeType atype;     /* the attribute type if validating */
447     void            *psvi;	/* for type/PSVI information */
448     struct _xmlID   *id;        /* the ID struct */
449 };
450 
451 /**
452  * xmlID:
453  *
454  * An XML ID instance.
455  */
456 
457 typedef struct _xmlID xmlID;
458 typedef xmlID *xmlIDPtr;
459 struct _xmlID {
460     struct _xmlID    *next;	/* next ID */
461     const xmlChar    *value;	/* The ID name */
462     xmlAttrPtr        attr;	/* The attribute holding it */
463     const xmlChar    *name;	/* The attribute if attr is not available */
464     int               lineno;	/* The line number if attr is not available */
465     struct _xmlDoc   *doc;	/* The document holding the ID */
466 };
467 
468 /**
469  * xmlRef:
470  *
471  * An XML IDREF instance.
472  */
473 
474 typedef struct _xmlRef xmlRef;
475 typedef xmlRef *xmlRefPtr;
476 struct _xmlRef {
477     struct _xmlRef    *next;	/* next Ref */
478     const xmlChar     *value;	/* The Ref name */
479     xmlAttrPtr        attr;	/* The attribute holding it */
480     const xmlChar    *name;	/* The attribute if attr is not available */
481     int               lineno;	/* The line number if attr is not available */
482 };
483 
484 /**
485  * xmlNode:
486  *
487  * A node in an XML tree.
488  */
489 typedef struct _xmlNode xmlNode;
490 typedef xmlNode *xmlNodePtr;
491 struct _xmlNode {
492     void           *_private;	/* application data */
493     xmlElementType   type;	/* type number, must be second ! */
494     const xmlChar   *name;      /* the name of the node, or the entity */
495     struct _xmlNode *children;	/* parent->childs link */
496     struct _xmlNode *last;	/* last child link */
497     struct _xmlNode *parent;	/* child->parent link */
498     struct _xmlNode *next;	/* next sibling link  */
499     struct _xmlNode *prev;	/* previous sibling link  */
500     struct _xmlDoc  *doc;	/* the containing document */
501 
502     /* End of common part */
503     xmlNs           *ns;        /* pointer to the associated namespace */
504     xmlChar         *content;   /* the content */
505     struct _xmlAttr *properties;/* properties list */
506     xmlNs           *nsDef;     /* namespace definitions on this node */
507     void            *psvi;	/* for type/PSVI information */
508     unsigned short   line;	/* line number */
509     unsigned short   extra;	/* extra data for XPath/XSLT */
510 };
511 
512 /**
513  * XML_GET_CONTENT:
514  *
515  * Macro to extract the content pointer of a node.
516  */
517 #define XML_GET_CONTENT(n)					\
518     ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
519 
520 /**
521  * XML_GET_LINE:
522  *
523  * Macro to extract the line number of an element node.
524  */
525 #define XML_GET_LINE(n)						\
526     (xmlGetLineNo(n))
527 
528 /**
529  * xmlDocProperty
530  *
531  * Set of properties of the document as found by the parser
532  * Some of them are linked to similarly named xmlParserOption
533  */
534 typedef enum {
535     XML_DOC_WELLFORMED		= 1<<0, /* document is XML well formed */
536     XML_DOC_NSVALID		= 1<<1, /* document is Namespace valid */
537     XML_DOC_OLD10		= 1<<2, /* parsed with old XML-1.0 parser */
538     XML_DOC_DTDVALID		= 1<<3, /* DTD validation was successful */
539     XML_DOC_XINCLUDE		= 1<<4, /* XInclude substitution was done */
540     XML_DOC_USERBUILT		= 1<<5, /* Document was built using the API
541                                            and not by parsing an instance */
542     XML_DOC_INTERNAL		= 1<<6, /* built for internal processing */
543     XML_DOC_HTML		= 1<<7  /* parsed or built HTML document */
544 } xmlDocProperties;
545 
546 /**
547  * xmlDoc:
548  *
549  * An XML document.
550  */
551 typedef struct _xmlDoc xmlDoc;
552 typedef xmlDoc *xmlDocPtr;
553 struct _xmlDoc {
554     void           *_private;	/* application data */
555     xmlElementType  type;       /* XML_DOCUMENT_NODE, must be second ! */
556     char           *name;	/* name/filename/URI of the document */
557     struct _xmlNode *children;	/* the document tree */
558     struct _xmlNode *last;	/* last child link */
559     struct _xmlNode *parent;	/* child->parent link */
560     struct _xmlNode *next;	/* next sibling link  */
561     struct _xmlNode *prev;	/* previous sibling link  */
562     struct _xmlDoc  *doc;	/* autoreference to itself */
563 
564     /* End of common part */
565     int             compression;/* level of zlib compression */
566     int             standalone; /* standalone document (no external refs)
567 				     1 if standalone="yes"
568 				     0 if standalone="no"
569 				    -1 if there is no XML declaration
570 				    -2 if there is an XML declaration, but no
571 					standalone attribute was specified */
572     struct _xmlDtd  *intSubset;	/* the document internal subset */
573     struct _xmlDtd  *extSubset;	/* the document external subset */
574     struct _xmlNs   *oldNs;	/* Global namespace, the old way */
575     const xmlChar  *version;	/* the XML version string */
576     const xmlChar  *encoding;   /* actual encoding, if any */
577     void           *ids;        /* Hash table for ID attributes if any */
578     void           *refs;       /* Hash table for IDREFs attributes if any */
579     const xmlChar  *URL;	/* The URI for that document */
580     int             charset;    /* unused */
581     struct _xmlDict *dict;      /* dict used to allocate names or NULL */
582     void           *psvi;	/* for type/PSVI information */
583     int             parseFlags;	/* set of xmlParserOption used to parse the
584 				   document */
585     int             properties;	/* set of xmlDocProperties for this document
586 				   set at the end of parsing */
587 };
588 
589 
590 typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
591 typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
592 
593 /**
594  * xmlDOMWrapAcquireNsFunction:
595  * @ctxt:  a DOM wrapper context
596  * @node:  the context node (element or attribute)
597  * @nsName:  the requested namespace name
598  * @nsPrefix:  the requested namespace prefix
599  *
600  * A function called to acquire namespaces (xmlNs) from the wrapper.
601  *
602  * Returns an xmlNsPtr or NULL in case of an error.
603  */
604 typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
605 						 xmlNodePtr node,
606 						 const xmlChar *nsName,
607 						 const xmlChar *nsPrefix);
608 
609 /**
610  * xmlDOMWrapCtxt:
611  *
612  * Context for DOM wrapper-operations.
613  */
614 struct _xmlDOMWrapCtxt {
615     void * _private;
616     /*
617     * The type of this context, just in case we need specialized
618     * contexts in the future.
619     */
620     int type;
621     /*
622     * Internal namespace map used for various operations.
623     */
624     void * namespaceMap;
625     /*
626     * Use this one to acquire an xmlNsPtr intended for node->ns.
627     * (Note that this is not intended for elem->nsDef).
628     */
629     xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
630 };
631 
632 /**
633  * xmlRegisterNodeFunc:
634  * @node: the current node
635  *
636  * Signature for the registration callback of a created node
637  */
638 typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
639 
640 /**
641  * xmlDeregisterNodeFunc:
642  * @node: the current node
643  *
644  * Signature for the deregistration callback of a discarded node
645  */
646 typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
647 
648 /**
649  * xmlChildrenNode:
650  *
651  * Macro for compatibility naming layer with libxml1. Maps
652  * to "children."
653  */
654 #ifndef xmlChildrenNode
655 #define xmlChildrenNode children
656 #endif
657 
658 /**
659  * xmlRootNode:
660  *
661  * Macro for compatibility naming layer with libxml1. Maps
662  * to "children".
663  */
664 #ifndef xmlRootNode
665 #define xmlRootNode children
666 #endif
667 
668 /*
669  * Variables.
670  */
671 
672 /** DOC_DISABLE */
673 #define XML_GLOBALS_TREE \
674   XML_OP(xmlBufferAllocScheme, xmlBufferAllocationScheme, XML_DEPRECATED) \
675   XML_OP(xmlDefaultBufferSize, int, XML_DEPRECATED) \
676   XML_OP(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc, XML_DEPRECATED) \
677   XML_OP(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc, \
678          XML_DEPRECATED)
679 
680 #define XML_OP XML_DECLARE_GLOBAL
681 XML_GLOBALS_TREE
682 #undef XML_OP
683 
684 #if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
685   #define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme)
686   #define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize)
687   #define xmlRegisterNodeDefaultValue \
688     XML_GLOBAL_MACRO(xmlRegisterNodeDefaultValue)
689   #define xmlDeregisterNodeDefaultValue \
690     XML_GLOBAL_MACRO(xmlDeregisterNodeDefaultValue)
691 #endif
692 /** DOC_ENABLE */
693 
694 /*
695  * Some helper functions
696  */
697 XMLPUBFUN int
698 		xmlValidateNCName	(const xmlChar *value,
699 					 int space);
700 
701 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
702 XMLPUBFUN int
703 		xmlValidateQName	(const xmlChar *value,
704 					 int space);
705 XMLPUBFUN int
706 		xmlValidateName		(const xmlChar *value,
707 					 int space);
708 XMLPUBFUN int
709 		xmlValidateNMToken	(const xmlChar *value,
710 					 int space);
711 #endif
712 
713 XMLPUBFUN xmlChar *
714 		xmlBuildQName		(const xmlChar *ncname,
715 					 const xmlChar *prefix,
716 					 xmlChar *memory,
717 					 int len);
718 XMLPUBFUN xmlChar *
719 		xmlSplitQName2		(const xmlChar *name,
720 					 xmlChar **prefix);
721 XMLPUBFUN const xmlChar *
722 		xmlSplitQName3		(const xmlChar *name,
723 					 int *len);
724 
725 /*
726  * Handling Buffers, the old ones see @xmlBuf for the new ones.
727  */
728 
729 XMLPUBFUN void
730 		xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
731 XMLPUBFUN xmlBufferAllocationScheme
732 		xmlGetBufferAllocationScheme(void);
733 
734 XMLPUBFUN xmlBufferPtr
735 		xmlBufferCreate		(void);
736 XMLPUBFUN xmlBufferPtr
737 		xmlBufferCreateSize	(size_t size);
738 XMLPUBFUN xmlBufferPtr
739 		xmlBufferCreateStatic	(void *mem,
740 					 size_t size);
741 XMLPUBFUN int
742 		xmlBufferResize		(xmlBufferPtr buf,
743 					 unsigned int size);
744 XMLPUBFUN void
745 		xmlBufferFree		(xmlBufferPtr buf);
746 XMLPUBFUN int
747 		xmlBufferDump		(FILE *file,
748 					 xmlBufferPtr buf);
749 XMLPUBFUN int
750 		xmlBufferAdd		(xmlBufferPtr buf,
751 					 const xmlChar *str,
752 					 int len);
753 XMLPUBFUN int
754 		xmlBufferAddHead	(xmlBufferPtr buf,
755 					 const xmlChar *str,
756 					 int len);
757 XMLPUBFUN int
758 		xmlBufferCat		(xmlBufferPtr buf,
759 					 const xmlChar *str);
760 XMLPUBFUN int
761 		xmlBufferCCat		(xmlBufferPtr buf,
762 					 const char *str);
763 XMLPUBFUN int
764 		xmlBufferShrink		(xmlBufferPtr buf,
765 					 unsigned int len);
766 XMLPUBFUN int
767 		xmlBufferGrow		(xmlBufferPtr buf,
768 					 unsigned int len);
769 XMLPUBFUN void
770 		xmlBufferEmpty		(xmlBufferPtr buf);
771 XMLPUBFUN const xmlChar*
772 		xmlBufferContent	(const xmlBuffer *buf);
773 XMLPUBFUN xmlChar*
774 		xmlBufferDetach         (xmlBufferPtr buf);
775 XMLPUBFUN void
776 		xmlBufferSetAllocationScheme(xmlBufferPtr buf,
777 					 xmlBufferAllocationScheme scheme);
778 XMLPUBFUN int
779 		xmlBufferLength		(const xmlBuffer *buf);
780 
781 /*
782  * Creating/freeing new structures.
783  */
784 XMLPUBFUN xmlDtdPtr
785 		xmlCreateIntSubset	(xmlDocPtr doc,
786 					 const xmlChar *name,
787 					 const xmlChar *ExternalID,
788 					 const xmlChar *SystemID);
789 XMLPUBFUN xmlDtdPtr
790 		xmlNewDtd		(xmlDocPtr doc,
791 					 const xmlChar *name,
792 					 const xmlChar *ExternalID,
793 					 const xmlChar *SystemID);
794 XMLPUBFUN xmlDtdPtr
795 		xmlGetIntSubset		(const xmlDoc *doc);
796 XMLPUBFUN void
797 		xmlFreeDtd		(xmlDtdPtr cur);
798 #ifdef LIBXML_LEGACY_ENABLED
799 XML_DEPRECATED
800 XMLPUBFUN xmlNsPtr
801 		xmlNewGlobalNs		(xmlDocPtr doc,
802 					 const xmlChar *href,
803 					 const xmlChar *prefix);
804 #endif /* LIBXML_LEGACY_ENABLED */
805 XMLPUBFUN xmlNsPtr
806 		xmlNewNs		(xmlNodePtr node,
807 					 const xmlChar *href,
808 					 const xmlChar *prefix);
809 XMLPUBFUN void
810 		xmlFreeNs		(xmlNsPtr cur);
811 XMLPUBFUN void
812 		xmlFreeNsList		(xmlNsPtr cur);
813 XMLPUBFUN xmlDocPtr
814 		xmlNewDoc		(const xmlChar *version);
815 XMLPUBFUN void
816 		xmlFreeDoc		(xmlDocPtr cur);
817 XMLPUBFUN xmlAttrPtr
818 		xmlNewDocProp		(xmlDocPtr doc,
819 					 const xmlChar *name,
820 					 const xmlChar *value);
821 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
822     defined(LIBXML_SCHEMAS_ENABLED)
823 XMLPUBFUN xmlAttrPtr
824 		xmlNewProp		(xmlNodePtr node,
825 					 const xmlChar *name,
826 					 const xmlChar *value);
827 #endif
828 XMLPUBFUN xmlAttrPtr
829 		xmlNewNsProp		(xmlNodePtr node,
830 					 xmlNsPtr ns,
831 					 const xmlChar *name,
832 					 const xmlChar *value);
833 XMLPUBFUN xmlAttrPtr
834 		xmlNewNsPropEatName	(xmlNodePtr node,
835 					 xmlNsPtr ns,
836 					 xmlChar *name,
837 					 const xmlChar *value);
838 XMLPUBFUN void
839 		xmlFreePropList		(xmlAttrPtr cur);
840 XMLPUBFUN void
841 		xmlFreeProp		(xmlAttrPtr cur);
842 XMLPUBFUN xmlAttrPtr
843 		xmlCopyProp		(xmlNodePtr target,
844 					 xmlAttrPtr cur);
845 XMLPUBFUN xmlAttrPtr
846 		xmlCopyPropList		(xmlNodePtr target,
847 					 xmlAttrPtr cur);
848 #ifdef LIBXML_TREE_ENABLED
849 XMLPUBFUN xmlDtdPtr
850 		xmlCopyDtd		(xmlDtdPtr dtd);
851 #endif /* LIBXML_TREE_ENABLED */
852 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
853 XMLPUBFUN xmlDocPtr
854 		xmlCopyDoc		(xmlDocPtr doc,
855 					 int recursive);
856 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
857 /*
858  * Creating new nodes.
859  */
860 XMLPUBFUN xmlNodePtr
861 		xmlNewDocNode		(xmlDocPtr doc,
862 					 xmlNsPtr ns,
863 					 const xmlChar *name,
864 					 const xmlChar *content);
865 XMLPUBFUN xmlNodePtr
866 		xmlNewDocNodeEatName	(xmlDocPtr doc,
867 					 xmlNsPtr ns,
868 					 xmlChar *name,
869 					 const xmlChar *content);
870 XMLPUBFUN xmlNodePtr
871 		xmlNewNode		(xmlNsPtr ns,
872 					 const xmlChar *name);
873 XMLPUBFUN xmlNodePtr
874 		xmlNewNodeEatName	(xmlNsPtr ns,
875 					 xmlChar *name);
876 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
877 XMLPUBFUN xmlNodePtr
878 		xmlNewChild		(xmlNodePtr parent,
879 					 xmlNsPtr ns,
880 					 const xmlChar *name,
881 					 const xmlChar *content);
882 #endif
883 XMLPUBFUN xmlNodePtr
884 		xmlNewDocText		(const xmlDoc *doc,
885 					 const xmlChar *content);
886 XMLPUBFUN xmlNodePtr
887 		xmlNewText		(const xmlChar *content);
888 XMLPUBFUN xmlNodePtr
889 		xmlNewDocPI		(xmlDocPtr doc,
890 					 const xmlChar *name,
891 					 const xmlChar *content);
892 XMLPUBFUN xmlNodePtr
893 		xmlNewPI		(const xmlChar *name,
894 					 const xmlChar *content);
895 XMLPUBFUN xmlNodePtr
896 		xmlNewDocTextLen	(xmlDocPtr doc,
897 					 const xmlChar *content,
898 					 int len);
899 XMLPUBFUN xmlNodePtr
900 		xmlNewTextLen		(const xmlChar *content,
901 					 int len);
902 XMLPUBFUN xmlNodePtr
903 		xmlNewDocComment	(xmlDocPtr doc,
904 					 const xmlChar *content);
905 XMLPUBFUN xmlNodePtr
906 		xmlNewComment		(const xmlChar *content);
907 XMLPUBFUN xmlNodePtr
908 		xmlNewCDataBlock	(xmlDocPtr doc,
909 					 const xmlChar *content,
910 					 int len);
911 XMLPUBFUN xmlNodePtr
912 		xmlNewCharRef		(xmlDocPtr doc,
913 					 const xmlChar *name);
914 XMLPUBFUN xmlNodePtr
915 		xmlNewReference		(const xmlDoc *doc,
916 					 const xmlChar *name);
917 XMLPUBFUN xmlNodePtr
918 		xmlCopyNode		(xmlNodePtr node,
919 					 int recursive);
920 XMLPUBFUN xmlNodePtr
921 		xmlDocCopyNode		(xmlNodePtr node,
922 					 xmlDocPtr doc,
923 					 int recursive);
924 XMLPUBFUN xmlNodePtr
925 		xmlDocCopyNodeList	(xmlDocPtr doc,
926 					 xmlNodePtr node);
927 XMLPUBFUN xmlNodePtr
928 		xmlCopyNodeList		(xmlNodePtr node);
929 #ifdef LIBXML_TREE_ENABLED
930 XMLPUBFUN xmlNodePtr
931 		xmlNewTextChild		(xmlNodePtr parent,
932 					 xmlNsPtr ns,
933 					 const xmlChar *name,
934 					 const xmlChar *content);
935 XMLPUBFUN xmlNodePtr
936 		xmlNewDocRawNode	(xmlDocPtr doc,
937 					 xmlNsPtr ns,
938 					 const xmlChar *name,
939 					 const xmlChar *content);
940 XMLPUBFUN xmlNodePtr
941 		xmlNewDocFragment	(xmlDocPtr doc);
942 #endif /* LIBXML_TREE_ENABLED */
943 
944 /*
945  * Navigating.
946  */
947 XMLPUBFUN long
948 		xmlGetLineNo		(const xmlNode *node);
949 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
950 XMLPUBFUN xmlChar *
951 		xmlGetNodePath		(const xmlNode *node);
952 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
953 XMLPUBFUN xmlNodePtr
954 		xmlDocGetRootElement	(const xmlDoc *doc);
955 XMLPUBFUN xmlNodePtr
956 		xmlGetLastChild		(const xmlNode *parent);
957 XMLPUBFUN int
958 		xmlNodeIsText		(const xmlNode *node);
959 XMLPUBFUN int
960 		xmlIsBlankNode		(const xmlNode *node);
961 
962 /*
963  * Changing the structure.
964  */
965 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
966 XMLPUBFUN xmlNodePtr
967 		xmlDocSetRootElement	(xmlDocPtr doc,
968 					 xmlNodePtr root);
969 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
970 #ifdef LIBXML_TREE_ENABLED
971 XMLPUBFUN void
972 		xmlNodeSetName		(xmlNodePtr cur,
973 					 const xmlChar *name);
974 #endif /* LIBXML_TREE_ENABLED */
975 XMLPUBFUN xmlNodePtr
976 		xmlAddChild		(xmlNodePtr parent,
977 					 xmlNodePtr cur);
978 XMLPUBFUN xmlNodePtr
979 		xmlAddChildList		(xmlNodePtr parent,
980 					 xmlNodePtr cur);
981 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
982 XMLPUBFUN xmlNodePtr
983 		xmlReplaceNode		(xmlNodePtr old,
984 					 xmlNodePtr cur);
985 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
986 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
987     defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
988 XMLPUBFUN xmlNodePtr
989 		xmlAddPrevSibling	(xmlNodePtr cur,
990 					 xmlNodePtr elem);
991 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
992 XMLPUBFUN xmlNodePtr
993 		xmlAddSibling		(xmlNodePtr cur,
994 					 xmlNodePtr elem);
995 XMLPUBFUN xmlNodePtr
996 		xmlAddNextSibling	(xmlNodePtr cur,
997 					 xmlNodePtr elem);
998 XMLPUBFUN void
999 		xmlUnlinkNode		(xmlNodePtr cur);
1000 XMLPUBFUN xmlNodePtr
1001 		xmlTextMerge		(xmlNodePtr first,
1002 					 xmlNodePtr second);
1003 XMLPUBFUN int
1004 		xmlTextConcat		(xmlNodePtr node,
1005 					 const xmlChar *content,
1006 					 int len);
1007 XMLPUBFUN void
1008 		xmlFreeNodeList		(xmlNodePtr cur);
1009 XMLPUBFUN void
1010 		xmlFreeNode		(xmlNodePtr cur);
1011 XMLPUBFUN int
1012 		xmlSetTreeDoc		(xmlNodePtr tree,
1013 					 xmlDocPtr doc);
1014 XMLPUBFUN int
1015 		xmlSetListDoc		(xmlNodePtr list,
1016 					 xmlDocPtr doc);
1017 /*
1018  * Namespaces.
1019  */
1020 XMLPUBFUN xmlNsPtr
1021 		xmlSearchNs		(xmlDocPtr doc,
1022 					 xmlNodePtr node,
1023 					 const xmlChar *nameSpace);
1024 XMLPUBFUN xmlNsPtr
1025 		xmlSearchNsByHref	(xmlDocPtr doc,
1026 					 xmlNodePtr node,
1027 					 const xmlChar *href);
1028 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
1029     defined(LIBXML_SCHEMAS_ENABLED)
1030 XMLPUBFUN int
1031 		xmlGetNsListSafe	(const xmlDoc *doc,
1032 					 const xmlNode *node,
1033 					 xmlNsPtr **out);
1034 XMLPUBFUN xmlNsPtr *
1035 		xmlGetNsList		(const xmlDoc *doc,
1036 					 const xmlNode *node);
1037 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
1038 
1039 XMLPUBFUN void
1040 		xmlSetNs		(xmlNodePtr node,
1041 					 xmlNsPtr ns);
1042 XMLPUBFUN xmlNsPtr
1043 		xmlCopyNamespace	(xmlNsPtr cur);
1044 XMLPUBFUN xmlNsPtr
1045 		xmlCopyNamespaceList	(xmlNsPtr cur);
1046 
1047 /*
1048  * Changing the content.
1049  */
1050 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
1051     defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
1052 XMLPUBFUN xmlAttrPtr
1053 		xmlSetProp		(xmlNodePtr node,
1054 					 const xmlChar *name,
1055 					 const xmlChar *value);
1056 XMLPUBFUN xmlAttrPtr
1057 		xmlSetNsProp		(xmlNodePtr node,
1058 					 xmlNsPtr ns,
1059 					 const xmlChar *name,
1060 					 const xmlChar *value);
1061 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
1062 	  defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
1063 XMLPUBFUN int
1064 		xmlNodeGetAttrValue	(const xmlNode *node,
1065 					 const xmlChar *name,
1066 					 const xmlChar *nsUri,
1067 					 xmlChar **out);
1068 XMLPUBFUN xmlChar *
1069 		xmlGetNoNsProp		(const xmlNode *node,
1070 					 const xmlChar *name);
1071 XMLPUBFUN xmlChar *
1072 		xmlGetProp		(const xmlNode *node,
1073 					 const xmlChar *name);
1074 XMLPUBFUN xmlAttrPtr
1075 		xmlHasProp		(const xmlNode *node,
1076 					 const xmlChar *name);
1077 XMLPUBFUN xmlAttrPtr
1078 		xmlHasNsProp		(const xmlNode *node,
1079 					 const xmlChar *name,
1080 					 const xmlChar *nameSpace);
1081 XMLPUBFUN xmlChar *
1082 		xmlGetNsProp		(const xmlNode *node,
1083 					 const xmlChar *name,
1084 					 const xmlChar *nameSpace);
1085 XMLPUBFUN xmlNodePtr
1086 		xmlStringGetNodeList	(const xmlDoc *doc,
1087 					 const xmlChar *value);
1088 XMLPUBFUN xmlNodePtr
1089 		xmlStringLenGetNodeList	(const xmlDoc *doc,
1090 					 const xmlChar *value,
1091 					 int len);
1092 XMLPUBFUN xmlChar *
1093 		xmlNodeListGetString	(xmlDocPtr doc,
1094 					 const xmlNode *list,
1095 					 int inLine);
1096 #ifdef LIBXML_TREE_ENABLED
1097 XMLPUBFUN xmlChar *
1098 		xmlNodeListGetRawString	(const xmlDoc *doc,
1099 					 const xmlNode *list,
1100 					 int inLine);
1101 #endif /* LIBXML_TREE_ENABLED */
1102 XMLPUBFUN int
1103 		xmlNodeSetContent	(xmlNodePtr cur,
1104 					 const xmlChar *content);
1105 #ifdef LIBXML_TREE_ENABLED
1106 XMLPUBFUN int
1107 		xmlNodeSetContentLen	(xmlNodePtr cur,
1108 					 const xmlChar *content,
1109 					 int len);
1110 #endif /* LIBXML_TREE_ENABLED */
1111 XMLPUBFUN int
1112 		xmlNodeAddContent	(xmlNodePtr cur,
1113 					 const xmlChar *content);
1114 XMLPUBFUN int
1115 		xmlNodeAddContentLen	(xmlNodePtr cur,
1116 					 const xmlChar *content,
1117 					 int len);
1118 XMLPUBFUN xmlChar *
1119 		xmlNodeGetContent	(const xmlNode *cur);
1120 
1121 XMLPUBFUN int
1122 		xmlNodeBufGetContent	(xmlBufferPtr buffer,
1123 					 const xmlNode *cur);
1124 XMLPUBFUN int
1125 		xmlBufGetNodeContent	(xmlBufPtr buf,
1126 					 const xmlNode *cur);
1127 
1128 XMLPUBFUN xmlChar *
1129 		xmlNodeGetLang		(const xmlNode *cur);
1130 XMLPUBFUN int
1131 		xmlNodeGetSpacePreserve	(const xmlNode *cur);
1132 #ifdef LIBXML_TREE_ENABLED
1133 XMLPUBFUN int
1134 		xmlNodeSetLang		(xmlNodePtr cur,
1135 					 const xmlChar *lang);
1136 XMLPUBFUN int
1137 		xmlNodeSetSpacePreserve (xmlNodePtr cur,
1138 					 int val);
1139 #endif /* LIBXML_TREE_ENABLED */
1140 XMLPUBFUN int
1141 		xmlNodeGetBaseSafe	(const xmlDoc *doc,
1142 					 const xmlNode *cur,
1143 					 xmlChar **baseOut);
1144 XMLPUBFUN xmlChar *
1145 		xmlNodeGetBase		(const xmlDoc *doc,
1146 					 const xmlNode *cur);
1147 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1148 XMLPUBFUN int
1149 		xmlNodeSetBase		(xmlNodePtr cur,
1150 					 const xmlChar *uri);
1151 #endif
1152 
1153 /*
1154  * Removing content.
1155  */
1156 XMLPUBFUN int
1157 		xmlRemoveProp		(xmlAttrPtr cur);
1158 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1159 XMLPUBFUN int
1160 		xmlUnsetNsProp		(xmlNodePtr node,
1161 					 xmlNsPtr ns,
1162 					 const xmlChar *name);
1163 XMLPUBFUN int
1164 		xmlUnsetProp		(xmlNodePtr node,
1165 					 const xmlChar *name);
1166 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1167 
1168 /*
1169  * Internal, don't use.
1170  */
1171 XMLPUBFUN void
1172 		xmlBufferWriteCHAR	(xmlBufferPtr buf,
1173 					 const xmlChar *string);
1174 XMLPUBFUN void
1175 		xmlBufferWriteChar	(xmlBufferPtr buf,
1176 					 const char *string);
1177 XMLPUBFUN void
1178 		xmlBufferWriteQuotedString(xmlBufferPtr buf,
1179 					 const xmlChar *string);
1180 
1181 #ifdef LIBXML_OUTPUT_ENABLED
1182 XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
1183 					 xmlDocPtr doc,
1184 					 xmlAttrPtr attr,
1185 					 const xmlChar *string);
1186 #endif /* LIBXML_OUTPUT_ENABLED */
1187 
1188 #ifdef LIBXML_TREE_ENABLED
1189 /*
1190  * Namespace handling.
1191  */
1192 XMLPUBFUN int
1193 		xmlReconciliateNs	(xmlDocPtr doc,
1194 					 xmlNodePtr tree);
1195 #endif
1196 
1197 #ifdef LIBXML_OUTPUT_ENABLED
1198 /*
1199  * Saving.
1200  */
1201 XMLPUBFUN void
1202 		xmlDocDumpFormatMemory	(xmlDocPtr cur,
1203 					 xmlChar **mem,
1204 					 int *size,
1205 					 int format);
1206 XMLPUBFUN void
1207 		xmlDocDumpMemory	(xmlDocPtr cur,
1208 					 xmlChar **mem,
1209 					 int *size);
1210 XMLPUBFUN void
1211 		xmlDocDumpMemoryEnc	(xmlDocPtr out_doc,
1212 					 xmlChar **doc_txt_ptr,
1213 					 int * doc_txt_len,
1214 					 const char *txt_encoding);
1215 XMLPUBFUN void
1216 		xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
1217 					 xmlChar **doc_txt_ptr,
1218 					 int * doc_txt_len,
1219 					 const char *txt_encoding,
1220 					 int format);
1221 XMLPUBFUN int
1222 		xmlDocFormatDump	(FILE *f,
1223 					 xmlDocPtr cur,
1224 					 int format);
1225 XMLPUBFUN int
1226 		xmlDocDump		(FILE *f,
1227 					 xmlDocPtr cur);
1228 XMLPUBFUN void
1229 		xmlElemDump		(FILE *f,
1230 					 xmlDocPtr doc,
1231 					 xmlNodePtr cur);
1232 XMLPUBFUN int
1233 		xmlSaveFile		(const char *filename,
1234 					 xmlDocPtr cur);
1235 XMLPUBFUN int
1236 		xmlSaveFormatFile	(const char *filename,
1237 					 xmlDocPtr cur,
1238 					 int format);
1239 XMLPUBFUN size_t
1240 		xmlBufNodeDump		(xmlBufPtr buf,
1241 					 xmlDocPtr doc,
1242 					 xmlNodePtr cur,
1243 					 int level,
1244 					 int format);
1245 XMLPUBFUN int
1246 		xmlNodeDump		(xmlBufferPtr buf,
1247 					 xmlDocPtr doc,
1248 					 xmlNodePtr cur,
1249 					 int level,
1250 					 int format);
1251 
1252 XMLPUBFUN int
1253 		xmlSaveFileTo		(xmlOutputBufferPtr buf,
1254 					 xmlDocPtr cur,
1255 					 const char *encoding);
1256 XMLPUBFUN int
1257 		xmlSaveFormatFileTo     (xmlOutputBufferPtr buf,
1258 					 xmlDocPtr cur,
1259 				         const char *encoding,
1260 				         int format);
1261 XMLPUBFUN void
1262 		xmlNodeDumpOutput	(xmlOutputBufferPtr buf,
1263 					 xmlDocPtr doc,
1264 					 xmlNodePtr cur,
1265 					 int level,
1266 					 int format,
1267 					 const char *encoding);
1268 
1269 XMLPUBFUN int
1270 		xmlSaveFormatFileEnc    (const char *filename,
1271 					 xmlDocPtr cur,
1272 					 const char *encoding,
1273 					 int format);
1274 
1275 XMLPUBFUN int
1276 		xmlSaveFileEnc		(const char *filename,
1277 					 xmlDocPtr cur,
1278 					 const char *encoding);
1279 
1280 #endif /* LIBXML_OUTPUT_ENABLED */
1281 /*
1282  * XHTML
1283  */
1284 XMLPUBFUN int
1285 		xmlIsXHTML		(const xmlChar *systemID,
1286 					 const xmlChar *publicID);
1287 
1288 /*
1289  * Compression.
1290  */
1291 XMLPUBFUN int
1292 		xmlGetDocCompressMode	(const xmlDoc *doc);
1293 XMLPUBFUN void
1294 		xmlSetDocCompressMode	(xmlDocPtr doc,
1295 					 int mode);
1296 XML_DEPRECATED
1297 XMLPUBFUN int
1298 		xmlGetCompressMode	(void);
1299 XML_DEPRECATED
1300 XMLPUBFUN void
1301 		xmlSetCompressMode	(int mode);
1302 
1303 /*
1304 * DOM-wrapper helper functions.
1305 */
1306 XMLPUBFUN xmlDOMWrapCtxtPtr
1307 		xmlDOMWrapNewCtxt	(void);
1308 XMLPUBFUN void
1309 		xmlDOMWrapFreeCtxt	(xmlDOMWrapCtxtPtr ctxt);
1310 XMLPUBFUN int
1311 	    xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
1312 					 xmlNodePtr elem,
1313 					 int options);
1314 XMLPUBFUN int
1315 	    xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt,
1316 					 xmlDocPtr sourceDoc,
1317 					 xmlNodePtr node,
1318 					 xmlDocPtr destDoc,
1319 					 xmlNodePtr destParent,
1320 					 int options);
1321 XMLPUBFUN int
1322 	    xmlDOMWrapRemoveNode	(xmlDOMWrapCtxtPtr ctxt,
1323 					 xmlDocPtr doc,
1324 					 xmlNodePtr node,
1325 					 int options);
1326 XMLPUBFUN int
1327 	    xmlDOMWrapCloneNode		(xmlDOMWrapCtxtPtr ctxt,
1328 					 xmlDocPtr sourceDoc,
1329 					 xmlNodePtr node,
1330 					 xmlNodePtr *clonedNode,
1331 					 xmlDocPtr destDoc,
1332 					 xmlNodePtr destParent,
1333 					 int deep,
1334 					 int options);
1335 
1336 #ifdef LIBXML_TREE_ENABLED
1337 /*
1338  * 5 interfaces from DOM ElementTraversal, but different in entities
1339  * traversal.
1340  */
1341 XMLPUBFUN unsigned long
1342             xmlChildElementCount        (xmlNodePtr parent);
1343 XMLPUBFUN xmlNodePtr
1344             xmlNextElementSibling       (xmlNodePtr node);
1345 XMLPUBFUN xmlNodePtr
1346             xmlFirstElementChild        (xmlNodePtr parent);
1347 XMLPUBFUN xmlNodePtr
1348             xmlLastElementChild         (xmlNodePtr parent);
1349 XMLPUBFUN xmlNodePtr
1350             xmlPreviousElementSibling   (xmlNodePtr node);
1351 #endif
1352 
1353 XML_DEPRECATED
1354 XMLPUBFUN xmlRegisterNodeFunc
1355 	    xmlRegisterNodeDefault	(xmlRegisterNodeFunc func);
1356 XML_DEPRECATED
1357 XMLPUBFUN xmlDeregisterNodeFunc
1358 	    xmlDeregisterNodeDefault	(xmlDeregisterNodeFunc func);
1359 XML_DEPRECATED
1360 XMLPUBFUN xmlRegisterNodeFunc
1361             xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
1362 XML_DEPRECATED
1363 XMLPUBFUN xmlDeregisterNodeFunc
1364             xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
1365 
1366 XML_DEPRECATED XMLPUBFUN xmlBufferAllocationScheme
1367             xmlThrDefBufferAllocScheme  (xmlBufferAllocationScheme v);
1368 XML_DEPRECATED XMLPUBFUN int
1369             xmlThrDefDefaultBufferSize  (int v);
1370 
1371 #ifdef __cplusplus
1372 }
1373 #endif
1374 
1375 #endif /* __XML_TREE_H__ */
1376 
1377