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