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