tree.h


    1 /*
    2  * tree.h : describes the structures found in an tree resulting
    3  *          from an XML parsing.
    4  *
    5  * See Copyright for the status of this software.
    6  *
    7  * daniel@veillard.com
    8  *
    9  */
    10 
    11 #ifndef __XML_TREE_H__
    12 #define __XML_TREE_H__
    13 
    14 #include 
    15 #include 
    16 
    17 #ifdef __cplusplus
    18 extern "C" {
    19 #endif
    20 
    21 /*
    22  * Some of the basic types pointer to structures:
    23  */
    24 /* xmlIO.h */
    25 typedef struct _xmlParserInputBuffer xmlParserInputBuffer;  <_xmlParserInputBuffer>
    26 typedef xmlParserInputBuffer *xmlParserInputBufferPtr;  <typedef:xmlParserInputBufferPtr>
    27 
    28 typedef struct _xmlOutputBuffer xmlOutputBuffer;  <_xmlOutputBuffer>
    29 typedef xmlOutputBuffer *xmlOutputBufferPtr;  <typedef:xmlOutputBufferPtr>
    30 
    31 /* parser.h */
    32 typedef struct _xmlParserInput xmlParserInput;  <_xmlParserInput>
    33 typedef xmlParserInput *xmlParserInputPtr;  <typedef:xmlParserInputPtr>
    34 
    35 typedef struct _xmlParserCtxt xmlParserCtxt;  <_xmlParserCtxt>
    36 typedef xmlParserCtxt *xmlParserCtxtPtr;  <typedef:xmlParserCtxtPtr>
    37 
    38 typedef struct _xmlSAXLocator xmlSAXLocator;  <_xmlSAXLocator>
    39 typedef xmlSAXLocator *xmlSAXLocatorPtr;  <typedef:xmlSAXLocatorPtr>
    40 
    41 typedef struct _xmlSAXHandler xmlSAXHandler;  <_xmlSAXHandler>
    42 typedef xmlSAXHandler *xmlSAXHandlerPtr;  <typedef:xmlSAXHandlerPtr>
    43 
    44 /* entities.h */
    45 typedef struct _xmlEntity xmlEntity;  <_xmlEntity>
    46 typedef xmlEntity *xmlEntityPtr;  <typedef:xmlEntityPtr>
    47 
    48 /**
    49  * BASE_BUFFER_SIZE:
    50  *
    51  * default buffer size 4000.
    52  */
    53 #define BASE_BUFFER_SIZE 4000
    54 
    55 /**
    56  * XML_XML_NAMESPACE:
    57  *
    58  * This is the namespace for the special xml: prefix predefined in the
    59  * XML Namespace specification.
    60  */
    61 #define XML_XML_NAMESPACE \
    62     (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
    63 
    64 /*
    65  * The different element types carried by an XML tree.
    66  *
    67  * NOTE: This is synchronized with DOM Level1 values
    68  *       See http://www.w3.org/TR/REC-DOM-Level-1/
    69  *
    70  * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
    71  * be deprecated to use an XML_DTD_NODE.
    72  */
    73 typedef enum { <XML_ELEMENT_NODE> <XML_ATTRIBUTE_NODE> <XML_TEXT_NODE> <XML_CDATA_SECTION_NODE> <XML_ENTITY_REF_NODE> <XML_ENTITY_NODE> <XML_PI_NODE> <XML_COMMENT_NODE> <XML_DOCUMENT_NODE> <XML_DOCUMENT_TYPE_NODE> <XML_DOCUMENT_FRAG_NODE> <XML_NOTATION_NODE> <XML_HTML_DOCUMENT_NODE> <XML_DTD_NODE> <XML_ELEMENT_DECL> <XML_ATTRIBUTE_DECL> <XML_ENTITY_DECL> <XML_NAMESPACE_DECL> <XML_XINCLUDE_START> <XML_XINCLUDE_END> <XML_DOCB_DOCUMENT_NODE>
    74     XML_ELEMENT_NODE=		1,
    75     XML_ATTRIBUTE_NODE=		2,
    76     XML_TEXT_NODE=		3,
    77     XML_CDATA_SECTION_NODE=	4,
    78     XML_ENTITY_REF_NODE=	5,
    79     XML_ENTITY_NODE=		6,
    80     XML_PI_NODE=		7,
    81     XML_COMMENT_NODE=		8,
    82     XML_DOCUMENT_NODE=		9,
    83     XML_DOCUMENT_TYPE_NODE=	10,
    84     XML_DOCUMENT_FRAG_NODE=	11,
    85     XML_NOTATION_NODE=		12,
    86     XML_HTML_DOCUMENT_NODE=	13,
    87     XML_DTD_NODE=		14,
    88     XML_ELEMENT_DECL=		15,
    89     XML_ATTRIBUTE_DECL=		16,
    90     XML_ENTITY_DECL=		17,
    91     XML_NAMESPACE_DECL=		18,
    92     XML_XINCLUDE_START=		19,
    93     XML_XINCLUDE_END=		20
    94 #ifdef LIBXML_DOCB_ENABLED
    95    ,XML_DOCB_DOCUMENT_NODE=	21
    96 #endif
    97 } xmlElementType;  <typedef:xmlElementType>
    98 
    99 /**
    100  * xmlChar:
    101  *
    102  * This is a basic byte in an UTF-8 encoded string.
    103  * It's unsigned allowing to pinpoint case where char * are assigned
    104  * to xmlChar * (possibly making serialization back impossible).
    105  */
    106 
    107 typedef unsigned char xmlChar;  <typedef:xmlChar>
    108 
    109 /**
    110  * BAD_CAST:
    111  *
    112  * Macro to cast a string to an xmlChar * when one know its safe.
    113  */
    114 #define BAD_CAST (xmlChar *)
    115 
    116 /**
    117  * xmlNotation:
    118  *
    119  * A DTD Notation definition.
    120  */
    121 
    122 typedef struct _xmlNotation xmlNotation;  <_xmlNotation>
    123 typedef xmlNotation *xmlNotationPtr;  <typedef:xmlNotationPtr>
    124 struct _xmlNotation {
    125     const xmlChar               *name;	        /* Notation name */
    126     const xmlChar               *PublicID;	/* Public identifier, if any */
    127     const xmlChar               *SystemID;	/* System identifier, if any */
    128 };
    129 
    130 /**
    131  * xmlAttributeType:
    132  *
    133  * A DTD Attribute type definition.
    134  */
    135 
    136 typedef enum { <XML_ATTRIBUTE_CDATA> <XML_ATTRIBUTE_ID> <XML_ATTRIBUTE_IDREF> <XML_ATTRIBUTE_IDREFS> <XML_ATTRIBUTE_ENTITY> <XML_ATTRIBUTE_ENTITIES> <XML_ATTRIBUTE_NMTOKEN> <XML_ATTRIBUTE_NMTOKENS> <XML_ATTRIBUTE_ENUMERATION> <XML_ATTRIBUTE_NOTATION>
    137     XML_ATTRIBUTE_CDATA = 1,
    138     XML_ATTRIBUTE_ID,
    139     XML_ATTRIBUTE_IDREF	,
    140     XML_ATTRIBUTE_IDREFS,
    141     XML_ATTRIBUTE_ENTITY,
    142     XML_ATTRIBUTE_ENTITIES,
    143     XML_ATTRIBUTE_NMTOKEN,
    144     XML_ATTRIBUTE_NMTOKENS,
    145     XML_ATTRIBUTE_ENUMERATION,
    146     XML_ATTRIBUTE_NOTATION
    147 } xmlAttributeType;  <typedef:xmlAttributeType>
    148 
    149 /**
    150  * xmlAttributeDefault:
    151  *
    152  * A DTD Attribute default definition.
    153  */
    154 
    155 typedef enum { <XML_ATTRIBUTE_NONE> <XML_ATTRIBUTE_REQUIRED> <XML_ATTRIBUTE_IMPLIED> <XML_ATTRIBUTE_FIXED>
    156     XML_ATTRIBUTE_NONE = 1,
    157     XML_ATTRIBUTE_REQUIRED,
    158     XML_ATTRIBUTE_IMPLIED,
    159     XML_ATTRIBUTE_FIXED
    160 } xmlAttributeDefault;  <typedef:xmlAttributeDefault>
    161 
    162 /**
    163  * xmlEnumeration:
    164  *
    165  * List structure used when there is an enumeration in DTDs.
    166  */
    167 
    168 typedef struct _xmlEnumeration xmlEnumeration;  <_xmlEnumeration>
    169 typedef xmlEnumeration *xmlEnumerationPtr;  <typedef:xmlEnumerationPtr>
    170 struct _xmlEnumeration {
    171     struct _xmlEnumeration    *next;	/* next one */
    172     const xmlChar            *name;	/* Enumeration name */
    173 };
    174 
    175 /**
    176  * xmlAttribute:
    177  *
    178  * An Attribute declaration in a DTD.
    179  */
    180 
    181 typedef struct _xmlAttribute xmlAttribute;  <_xmlAttribute>
    182 typedef xmlAttribute *xmlAttributePtr;  <typedef:xmlAttributePtr>
    183 struct _xmlAttribute {
    184     void           *_private;	        /* application data */
    185     xmlElementType          type;       /* XML_ATTRIBUTE_DECL, must be second ! */
    186     const xmlChar          *name;	/* Attribute name */
    187     struct _xmlNode    *children;	/* NULL */  <_xmlNode>
    188     struct _xmlNode        *last;	/* NULL */
    189     struct _xmlDtd       *parent;	/* -> DTD */  <_xmlDtd>
    190     struct _xmlNode        *next;	/* next sibling link  */
    191     struct _xmlNode        *prev;	/* previous sibling link  */
    192     struct _xmlDoc          *doc;       /* the containing document */  <_xmlDoc>
    193 
    194     struct _xmlAttribute  *nexth;	/* next in hash table */
    195     xmlAttributeType       atype;	/* The attribute type */
    196     xmlAttributeDefault      def;	/* the default */
    197     const xmlChar  *defaultValue;	/* or the default value */
    198     xmlEnumerationPtr       tree;       /* or the enumeration tree if any */
    199     const xmlChar        *prefix;	/* the namespace prefix if any */
    200     const xmlChar          *elem;	/* Element holding the attribute */
    201 };
    202 
    203 /**
    204  * xmlElementContentType:
    205  *
    206  * Possible definitions of element content types.
    207  */
    208 typedef enum { <XML_ELEMENT_CONTENT_PCDATA> <XML_ELEMENT_CONTENT_ELEMENT> <XML_ELEMENT_CONTENT_SEQ> <XML_ELEMENT_CONTENT_OR>
    209     XML_ELEMENT_CONTENT_PCDATA = 1,
    210     XML_ELEMENT_CONTENT_ELEMENT,
    211     XML_ELEMENT_CONTENT_SEQ,
    212     XML_ELEMENT_CONTENT_OR
    213 } xmlElementContentType;  <typedef:xmlElementContentType>
    214 
    215 /**
    216  * xmlElementContentOccur:
    217  *
    218  * Possible definitions of element content occurrences.
    219  */
    220 typedef enum { <XML_ELEMENT_CONTENT_ONCE> <XML_ELEMENT_CONTENT_OPT> <XML_ELEMENT_CONTENT_MULT> <XML_ELEMENT_CONTENT_PLUS>
    221     XML_ELEMENT_CONTENT_ONCE = 1,
    222     XML_ELEMENT_CONTENT_OPT,
    223     XML_ELEMENT_CONTENT_MULT,
    224     XML_ELEMENT_CONTENT_PLUS
    225 } xmlElementContentOccur;  <typedef:xmlElementContentOccur>
    226 
    227 /**
    228  * xmlElementContent:
    229  *
    230  * An XML Element content as stored after parsing an element definition
    231  * in a DTD.
    232  */
    233 
    234 typedef struct _xmlElementContent xmlElementContent;  <_xmlElementContent>
    235 typedef xmlElementContent *xmlElementContentPtr;  <typedef:xmlElementContentPtr>
    236 struct _xmlElementContent {
    237     xmlElementContentType     type;	/* PCDATA, ELEMENT, SEQ or OR */
    238     xmlElementContentOccur    ocur;	/* ONCE, OPT, MULT or PLUS */
    239     const xmlChar             *name;	/* Element name */
    240     struct _xmlElementContent *c1;	/* first child */
    241     struct _xmlElementContent *c2;	/* second child */
    242     struct _xmlElementContent *parent;	/* parent */
    243     const xmlChar             *prefix;	/* Element name */
    244 };
    245 
    246 /**
    247  * xmlElementTypeVal:
    248  *
    249  * The different possibilities for an element content type.
    250  */
    251 
    252 typedef enum { <XML_ELEMENT_TYPE_UNDEFINED> <XML_ELEMENT_TYPE_EMPTY> <XML_ELEMENT_TYPE_ANY> <XML_ELEMENT_TYPE_MIXED> <XML_ELEMENT_TYPE_ELEMENT>
    253     XML_ELEMENT_TYPE_UNDEFINED = 0,
    254     XML_ELEMENT_TYPE_EMPTY = 1,
    255     XML_ELEMENT_TYPE_ANY,
    256     XML_ELEMENT_TYPE_MIXED,
    257     XML_ELEMENT_TYPE_ELEMENT
    258 } xmlElementTypeVal;  <typedef:xmlElementTypeVal>
    259 
    260 
    261 #ifdef __cplusplus
    262 }
    263 #endif
    264 #include 
    265 #ifdef __cplusplus
    266 extern "C" {
    267 #endif
    268 
    269 /**
    270  * xmlElement:
    271  *
    272  * An XML Element declaration from a DTD.
    273  */
    274 
    275 typedef struct _xmlElement xmlElement;  <_xmlElement>
    276 typedef xmlElement *xmlElementPtr;  <typedef:xmlElementPtr>
    277 struct _xmlElement {
    278     void           *_private;	        /* application data */
    279     xmlElementType          type;       /* XML_ELEMENT_DECL, must be second ! */
    280     const xmlChar          *name;	/* Element name */
    281     struct _xmlNode    *children;	/* NULL */
    282     struct _xmlNode        *last;	/* NULL */
    283     struct _xmlDtd       *parent;	/* -> DTD */
    284     struct _xmlNode        *next;	/* next sibling link  */
    285     struct _xmlNode        *prev;	/* previous sibling link  */
    286     struct _xmlDoc          *doc;       /* the containing document */
    287 
    288     xmlElementTypeVal      etype;	/* The type */
    289     xmlElementContentPtr content;	/* the allowed element content */
    290     xmlAttributePtr   attributes;	/* List of the declared attributes */
    291     const xmlChar        *prefix;	/* the namespace prefix if any */
    292 #ifdef LIBXML_REGEXP_ENABLED
    293     xmlRegexpPtr       contModel;	/* the validating regexp */
    294 #else
    295     void	      *contModel;
    296 #endif
    297 };
    298 
    299 
    300 /**
    301  * XML_LOCAL_NAMESPACE:
    302  *
    303  * A namespace declaration node.
    304  */
    305 #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
    306 typedef xmlElementType xmlNsType;  <typedef:xmlNsType>
    307 
    308 /**
    309  * xmlNs:
    310  *
    311  * An XML namespace.
    312  * Note that prefix == NULL is valid, it defines the default namespace
    313  * within the subtree (until overridden).
    314  *
    315  * xmlNsType is unified with xmlElementType.
    316  */
    317 
    318 typedef struct _xmlNs xmlNs;  <_xmlNs>
    319 typedef xmlNs *xmlNsPtr;  <typedef:xmlNsPtr>
    320 struct _xmlNs {
    321     struct _xmlNs  *next;	/* next Ns link for this node  */
    322     xmlNsType      type;	/* global or local */
    323     const xmlChar *href;	/* URL for the namespace */
    324     const xmlChar *prefix;	/* prefix for the namespace */
    325     void           *_private;   /* application data */
    326 };
    327 
    328 /**
    329  * xmlDtd:
    330  *
    331  * An XML DTD, as defined by     332  * the internal subset and for the external subset.
    333  */
    334 typedef struct _xmlDtd xmlDtd;  <typedef:xmlDtd>
    335 typedef xmlDtd *xmlDtdPtr;  <typedef:xmlDtdPtr>
    336 struct _xmlDtd {
    337     void           *_private;	/* application data */
    338     xmlElementType  type;       /* XML_DTD_NODE, must be second ! */
    339     const xmlChar *name;	/* Name of the DTD */
    340     struct _xmlNode *children;	/* the value of the property link */
    341     struct _xmlNode *last;	/* last child link */
    342     struct _xmlDoc  *parent;	/* child->parent link */
    343     struct _xmlNode *next;	/* next sibling link  */
    344     struct _xmlNode *prev;	/* previous sibling link  */
    345     struct _xmlDoc  *doc;	/* the containing document */
    346 
    347     /* End of common part */
    348     void          *notations;   /* Hash table for notations if any */
    349     void          *elements;    /* Hash table for elements if any */
    350     void          *attributes;  /* Hash table for attributes if any */
    351     void          *entities;    /* Hash table for entities if any */
    352     const xmlChar *ExternalID;	/* External identifier for PUBLIC DTD */
    353     const xmlChar *SystemID;	/* URI for a SYSTEM or PUBLIC DTD */
    354     void          *pentities;   /* Hash table for param entities if any */
    355 };
    356 
    357 /**
    358  * xmlAttr:
    359  *
    360  * An attribute on an XML node.
    361  */
    362 typedef struct _xmlAttr xmlAttr;  <_xmlAttr>
    363 typedef xmlAttr *xmlAttrPtr;  <typedef:xmlAttrPtr>
    364 struct _xmlAttr {
    365     void           *_private;	/* application data */
    366     xmlElementType   type;      /* XML_ATTRIBUTE_NODE, must be second ! */
    367     const xmlChar   *name;      /* the name of the property */
    368     struct _xmlNode *children;	/* the value of the property */
    369     struct _xmlNode *last;	/* NULL */
    370     struct _xmlNode *parent;	/* child->parent link */
    371     struct _xmlAttr *next;	/* next sibling link  */
    372     struct _xmlAttr *prev;	/* previous sibling link  */
    373     struct _xmlDoc  *doc;	/* the containing document */
    374     xmlNs           *ns;        /* pointer to the associated namespace */
    375     xmlAttributeType atype;     /* the attribute type if validating */
    376 };
    377 
    378 /**
    379  * xmlID:
    380  *
    381  * An XML ID instance.
    382  */
    383 
    384 typedef struct _xmlID xmlID;  <_xmlID>
    385 typedef xmlID *xmlIDPtr;  <typedef:xmlIDPtr>
    386 struct _xmlID {
    387     struct _xmlID    *next;	/* next ID */
    388     const xmlChar    *value;	/* The ID name */
    389     xmlAttrPtr        attr;	/* The attribute holding it */
    390 };
    391 
    392 /**
    393  * xmlRef:
    394  *
    395  * An XML IDREF instance.
    396  */
    397 
    398 typedef struct _xmlRef xmlRef;  <_xmlRef>
    399 typedef xmlRef *xmlRefPtr;  <typedef:xmlRefPtr>
    400 struct _xmlRef {
    401     struct _xmlRef    *next;	/* next Ref */
    402     const xmlChar     *value;	/* The Ref name */
    403     xmlAttrPtr        attr;	/* The attribute holding it */
    404 };
    405 
    406 /**
    407  * xmlBufferAllocationScheme:
    408  *
    409  * A buffer allocation scheme can be defined to either match exactly the
    410  * need or double it's allocated size each time it is found too small.
    411  */
    412 
    413 typedef enum { <XML_BUFFER_ALLOC_DOUBLEIT> <XML_BUFFER_ALLOC_EXACT>
    414     XML_BUFFER_ALLOC_DOUBLEIT,
    415     XML_BUFFER_ALLOC_EXACT
    416 } xmlBufferAllocationScheme;  <typedef:xmlBufferAllocationScheme>
    417 
    418 /**
    419  * xmlBuffer:
    420  *
    421  * A buffer structure.
    422  */
    423 typedef struct _xmlBuffer xmlBuffer;  <_xmlBuffer>
    424 typedef xmlBuffer *xmlBufferPtr;  <typedef:xmlBufferPtr>
    425 struct _xmlBuffer {
    426     xmlChar *content;		/* The buffer content UTF8 */
    427     unsigned int use;		/* The buffer size used */
    428     unsigned int size;		/* The buffer size */
    429     xmlBufferAllocationScheme alloc; /* The realloc method */
    430 };
    431 
    432 /**
    433  * xmlNode:
    434  *
    435  * A node in an XML tree.
    436  */
    437 typedef struct _xmlNode xmlNode;  <typedef:xmlNode>
    438 typedef xmlNode *xmlNodePtr;  <typedef:xmlNodePtr>
    439 struct _xmlNode {
    440     void           *_private;	/* application data */
    441     xmlElementType   type;	/* type number, must be second ! */
    442     const xmlChar   *name;      /* the name of the node, or the entity */
    443     struct _xmlNode *children;	/* parent->childs link */
    444     struct _xmlNode *last;	/* last child link */
    445     struct _xmlNode *parent;	/* child->parent link */
    446     struct _xmlNode *next;	/* next sibling link  */
    447     struct _xmlNode *prev;	/* previous sibling link  */
    448     struct _xmlDoc  *doc;	/* the containing document */
    449 
    450     /* End of common part */
    451     xmlNs           *ns;        /* pointer to the associated namespace */
    452     xmlChar         *content;   /* the content */
    453     struct _xmlAttr *properties;/* properties list */
    454     xmlNs           *nsDef;     /* namespace definitions on this node */
    455 };
    456 
    457 /**
    458  * XML_GET_CONTENT:
    459  *
    460  * Macro to extract the content pointer of a node.
    461  */
    462 #define XML_GET_CONTENT(n)					\
    463     ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
    464 
    465 /**
    466  * XML_GET_LINE:
    467  *
    468  * Macro to extract the line number of an element node. 
    469  * This will work only if line numbering is activated by
    470  * calling xmlLineNumbersDefault(1) before parsing.
    471  */
    472 #define XML_GET_LINE(n)						\
    473     ((n)->type == XML_ELEMENT_NODE ? (int) (n)->content : 0)
    474 
    475 /**
    476  * xmlDoc:
    477  *
    478  * An XML document.
    479  */
    480 typedef struct _xmlDoc xmlDoc;  <typedef:xmlDoc>
    481 typedef xmlDoc *xmlDocPtr;  <typedef:xmlDocPtr>
    482 struct _xmlDoc {
    483     void           *_private;	/* application data */
    484     xmlElementType  type;       /* XML_DOCUMENT_NODE, must be second ! */
    485     char           *name;	/* name/filename/URI of the document */
    486     struct _xmlNode *children;	/* the document tree */
    487     struct _xmlNode *last;	/* last child link */
    488     struct _xmlNode *parent;	/* child->parent link */
    489     struct _xmlNode *next;	/* next sibling link  */
    490     struct _xmlNode *prev;	/* previous sibling link  */
    491     struct _xmlDoc  *doc;	/* autoreference to itself */
    492 
    493     /* End of common part */
    494     int             compression;/* level of zlib compression */
    495     int             standalone; /* standalone document (no external refs) */
    496     struct _xmlDtd  *intSubset;	/* the document internal subset */
    497     struct _xmlDtd  *extSubset;	/* the document external subset */
    498     struct _xmlNs   *oldNs;	/* Global namespace, the old way */
    499     const xmlChar  *version;	/* the XML version string */
    500     const xmlChar  *encoding;   /* external initial encoding, if any */
    501     void           *ids;        /* Hash table for ID attributes if any */
    502     void           *refs;       /* Hash table for IDREFs attributes if any */
    503     const xmlChar  *URL;	/* The URI for that document */
    504     int             charset;    /* encoding of the in-memory content
    505 				   actually an xmlCharEncoding */
    506 };
    507 
    508 /**
    509  * xmlChildrenNode:
    510  *
    511  * Macro for compatibility naming layer with libxml1.
    512  */
    513 #ifndef xmlChildrenNode
    514 #define xmlChildrenNode children
    515 #endif
    516 
    517 /**
    518  * xmlRootNode:
    519  *
    520  * Macro for compatibility naming layer with libxml1.
    521  */
    522 #ifndef xmlRootNode
    523 #define xmlRootNode children
    524 #endif
    525 
    526 /*
    527  * Variables.
    528  */
    529 #if 0
    530 LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
    531 LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput;  /* try to indent the tree dumps */
    532 LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
    533 LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as  */
    534 LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
    535 #endif
    536 
    537 /*
    538  * Handling Buffers.
    539  */
    540 
    541 void		xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
    542 xmlBufferAllocationScheme	 xmlGetBufferAllocationScheme(void);
    543 
    544 xmlBufferPtr	xmlBufferCreate		(void);
    545 xmlBufferPtr	xmlBufferCreateSize	(size_t size);
    546 int		xmlBufferResize		(xmlBufferPtr buf,
    547 					 unsigned int size);
    548 void		xmlBufferFree		(xmlBufferPtr buf);
    549 int		xmlBufferDump		(FILE *file,
    550 					 xmlBufferPtr buf);
    551 void		xmlBufferAdd		(xmlBufferPtr buf,
    552 					 const xmlChar *str,
    553 					 int len);
    554 void		xmlBufferAddHead	(xmlBufferPtr buf,
    555 					 const xmlChar *str,
    556 					 int len);
    557 void		xmlBufferCat		(xmlBufferPtr buf,
    558 					 const xmlChar *str);
    559 void		xmlBufferCCat		(xmlBufferPtr buf,
    560 					 const char *str);
    561 int		xmlBufferShrink		(xmlBufferPtr buf,
    562 					 unsigned int len);
    563 int		xmlBufferGrow		(xmlBufferPtr buf,
    564 					 unsigned int len);
    565 void		xmlBufferEmpty		(xmlBufferPtr buf);
    566 const xmlChar*	xmlBufferContent	(const xmlBufferPtr buf);
    567 void		xmlBufferSetAllocationScheme(xmlBufferPtr buf,
    568 					 xmlBufferAllocationScheme scheme);
    569 int		xmlBufferLength		(const xmlBufferPtr buf);
    570 
    571 /*
    572  * Creating/freeing new structures.
    573  */
    574 xmlDtdPtr	xmlCreateIntSubset	(xmlDocPtr doc,
    575 					 const xmlChar *name,
    576 					 const xmlChar *ExternalID,
    577 					 const xmlChar *SystemID);
    578 xmlDtdPtr	xmlNewDtd		(xmlDocPtr doc,
    579 					 const xmlChar *name,
    580 					 const xmlChar *ExternalID,
    581 					 const xmlChar *SystemID);
    582 xmlDtdPtr	xmlGetIntSubset		(xmlDocPtr doc);
    583 void		xmlFreeDtd		(xmlDtdPtr cur);
    584 xmlNsPtr	xmlNewGlobalNs		(xmlDocPtr doc,
    585 					 const xmlChar *href,
    586 					 const xmlChar *prefix);
    587 xmlNsPtr	xmlNewNs		(xmlNodePtr node,
    588 					 const xmlChar *href,
    589 					 const xmlChar *prefix);
    590 void		xmlFreeNs		(xmlNsPtr cur);
    591 void		xmlFreeNsList		(xmlNsPtr cur);
    592 xmlDocPtr 	xmlNewDoc		(const xmlChar *version);
    593 void		xmlFreeDoc		(xmlDocPtr cur);
    594 xmlAttrPtr	xmlNewDocProp		(xmlDocPtr doc,
    595 					 const xmlChar *name,
    596 					 const xmlChar *value);
    597 xmlAttrPtr	xmlNewProp		(xmlNodePtr node,
    598 					 const xmlChar *name,
    599 					 const xmlChar *value);
    600 xmlAttrPtr	xmlNewNsProp		(xmlNodePtr node,
    601 					 xmlNsPtr ns,
    602 					 const xmlChar *name,
    603 					 const xmlChar *value);
    604 xmlAttrPtr	xmlNewNsPropEatName	(xmlNodePtr node,
    605 					 xmlNsPtr ns,
    606 					 xmlChar *name,
    607 					 const xmlChar *value);
    608 void		xmlFreePropList		(xmlAttrPtr cur);
    609 void		xmlFreeProp		(xmlAttrPtr cur);
    610 xmlAttrPtr	xmlCopyProp		(xmlNodePtr target,
    611 					 xmlAttrPtr cur);
    612 xmlAttrPtr	xmlCopyPropList		(xmlNodePtr target,
    613 					 xmlAttrPtr cur);
    614 xmlDtdPtr	xmlCopyDtd		(xmlDtdPtr dtd);
    615 xmlDocPtr	xmlCopyDoc		(xmlDocPtr doc,
    616 					 int recursive);
    617 
    618 /*
    619  * Creating new nodes.
    620  */
    621 xmlNodePtr	xmlNewDocNode		(xmlDocPtr doc,
    622 					 xmlNsPtr ns,
    623 					 const xmlChar *name,
    624 					 const xmlChar *content);
    625 xmlNodePtr	xmlNewDocNodeEatName	(xmlDocPtr doc,
    626 					 xmlNsPtr ns,
    627 					 xmlChar *name,
    628 					 const xmlChar *content);
    629 xmlNodePtr	xmlNewDocRawNode	(xmlDocPtr doc,
    630 					 xmlNsPtr ns,
    631 					 const xmlChar *name,
    632 					 const xmlChar *content);
    633 xmlNodePtr	xmlNewNode		(xmlNsPtr ns,
    634 					 const xmlChar *name);
    635 xmlNodePtr	xmlNewNodeEatName	(xmlNsPtr ns,
    636 					 xmlChar *name);
    637 xmlNodePtr	xmlNewChild		(xmlNodePtr parent,
    638 					 xmlNsPtr ns,
    639 					 const xmlChar *name,
    640 					 const xmlChar *content);
    641 xmlNodePtr	xmlNewTextChild		(xmlNodePtr parent,
    642 					 xmlNsPtr ns,
    643 					 const xmlChar *name,
    644 					 const xmlChar *content);
    645 xmlNodePtr	xmlNewDocText		(xmlDocPtr doc,
    646 					 const xmlChar *content);
    647 xmlNodePtr	xmlNewText		(const xmlChar *content);
    648 xmlNodePtr	xmlNewPI		(const xmlChar *name,
    649 					 const xmlChar *content);
    650 xmlNodePtr	xmlNewDocTextLen	(xmlDocPtr doc,
    651 					 const xmlChar *content,
    652 					 int len);
    653 xmlNodePtr	xmlNewTextLen		(const xmlChar *content,
    654 					 int len);
    655 xmlNodePtr	xmlNewDocComment	(xmlDocPtr doc,
    656 					 const xmlChar *content);
    657 xmlNodePtr	xmlNewComment		(const xmlChar *content);
    658 xmlNodePtr	xmlNewCDataBlock	(xmlDocPtr doc,
    659 					 const xmlChar *content,
    660 					 int len);
    661 xmlNodePtr	xmlNewCharRef		(xmlDocPtr doc,
    662 					 const xmlChar *name);
    663 xmlNodePtr	xmlNewReference		(xmlDocPtr doc,
    664 					 const xmlChar *name);
    665 xmlNodePtr	xmlCopyNode		(const xmlNodePtr node,
    666 					 int recursive);
    667 xmlNodePtr	xmlDocCopyNode		(const xmlNodePtr node,
    668 					 xmlDocPtr doc,
    669 					 int recursive);
    670 xmlNodePtr	xmlCopyNodeList		(const xmlNodePtr node);
    671 xmlNodePtr	xmlNewDocFragment	(xmlDocPtr doc);
    672 
    673 /*
    674  * Navigating.
    675  */
    676 long		xmlGetLineNo		(xmlNodePtr node);
    677 xmlChar *	xmlGetNodePath		(xmlNodePtr node);
    678 xmlNodePtr	xmlDocGetRootElement	(xmlDocPtr doc);
    679 xmlNodePtr	xmlGetLastChild		(xmlNodePtr parent);
    680 int		xmlNodeIsText		(xmlNodePtr node);
    681 int		xmlIsBlankNode		(xmlNodePtr node);
    682 
    683 /*
    684  * Changing the structure.
    685  */
    686 xmlNodePtr	xmlDocSetRootElement	(xmlDocPtr doc,
    687 					 xmlNodePtr root);
    688 void		xmlNodeSetName		(xmlNodePtr cur,
    689 					 const xmlChar *name);
    690 xmlNodePtr	xmlAddChild		(xmlNodePtr parent,
    691 					 xmlNodePtr cur);
    692 xmlNodePtr	xmlAddChildList		(xmlNodePtr parent,
    693 					 xmlNodePtr cur);
    694 xmlNodePtr	xmlReplaceNode		(xmlNodePtr old,
    695 					 xmlNodePtr cur);
    696 xmlNodePtr	xmlAddSibling		(xmlNodePtr cur,
    697 					 xmlNodePtr elem);
    698 xmlNodePtr	xmlAddPrevSibling	(xmlNodePtr cur,
    699 					 xmlNodePtr elem);
    700 xmlNodePtr	xmlAddNextSibling	(xmlNodePtr cur,
    701 					 xmlNodePtr elem);
    702 void		xmlUnlinkNode		(xmlNodePtr cur);
    703 xmlNodePtr	xmlTextMerge		(xmlNodePtr first,
    704 					 xmlNodePtr second);
    705 void		xmlTextConcat		(xmlNodePtr node,
    706 					 const xmlChar *content,
    707 					 int len);
    708 void		xmlFreeNodeList		(xmlNodePtr cur);
    709 void		xmlFreeNode		(xmlNodePtr cur);
    710 void		xmlSetTreeDoc		(xmlNodePtr tree,
    711 					 xmlDocPtr doc);
    712 void		xmlSetListDoc		(xmlNodePtr list,
    713 					 xmlDocPtr doc);
    714 
    715 /*
    716  * Namespaces.
    717  */
    718 xmlNsPtr	xmlSearchNs		(xmlDocPtr doc,
    719 					 xmlNodePtr node,
    720 					 const xmlChar *nameSpace);
    721 xmlNsPtr	xmlSearchNsByHref	(xmlDocPtr doc,
    722 					 xmlNodePtr node,
    723 					 const xmlChar *href);
    724 xmlNsPtr *	xmlGetNsList		(xmlDocPtr doc,
    725 					 xmlNodePtr node);
    726 void		xmlSetNs		(xmlNodePtr node,
    727 					 xmlNsPtr ns);
    728 xmlNsPtr	xmlCopyNamespace	(xmlNsPtr cur);
    729 xmlNsPtr	xmlCopyNamespaceList	(xmlNsPtr cur);
    730 
    731 /*
    732  * Changing the content.
    733  */
    734 xmlAttrPtr	xmlSetProp		(xmlNodePtr node,
    735 					 const xmlChar *name,
    736 					 const xmlChar *value);
    737 xmlChar *	xmlGetProp		(xmlNodePtr node,
    738 					 const xmlChar *name);
    739 xmlAttrPtr	xmlHasProp		(xmlNodePtr node,
    740 					 const xmlChar *name);
    741 xmlAttrPtr	xmlHasNsProp		(xmlNodePtr node,
    742 					 const xmlChar *name,
    743 					 const xmlChar *nameSpace);
    744 xmlAttrPtr	xmlSetNsProp		(xmlNodePtr node,
    745 					 xmlNsPtr ns,
    746 					 const xmlChar *name,
    747 					 const xmlChar *value);
    748 xmlChar *	xmlGetNsProp		(xmlNodePtr node,
    749 					 const xmlChar *name,
    750 					 const xmlChar *nameSpace);
    751 xmlNodePtr	xmlStringGetNodeList	(xmlDocPtr doc,
    752 					 const xmlChar *value);
    753 xmlNodePtr	xmlStringLenGetNodeList	(xmlDocPtr doc,
    754 					 const xmlChar *value,
    755 					 int len);
    756 xmlChar *	xmlNodeListGetString	(xmlDocPtr doc,
    757 					 xmlNodePtr list,
    758 					 int inLine);
    759 xmlChar *	xmlNodeListGetRawString	(xmlDocPtr doc,
    760 					 xmlNodePtr list,
    761 					 int inLine);
    762 void		xmlNodeSetContent	(xmlNodePtr cur,
    763 					 const xmlChar *content);
    764 void		xmlNodeSetContentLen	(xmlNodePtr cur,
    765 					 const xmlChar *content,
    766 					 int len);
    767 void		xmlNodeAddContent	(xmlNodePtr cur,
    768 					 const xmlChar *content);
    769 void		xmlNodeAddContentLen	(xmlNodePtr cur,
    770 					 const xmlChar *content,
    771 					 int len);
    772 xmlChar *	xmlNodeGetContent	(xmlNodePtr cur);
    773 xmlChar *	xmlNodeGetLang		(xmlNodePtr cur);
    774 void		xmlNodeSetLang		(xmlNodePtr cur,
    775 					 const xmlChar *lang);
    776 int		xmlNodeGetSpacePreserve	(xmlNodePtr cur);
    777 void		xmlNodeSetSpacePreserve (xmlNodePtr cur,
    778 					 int val);
    779 xmlChar *	xmlNodeGetBase		(xmlDocPtr doc,
    780 					 xmlNodePtr cur);
    781 void		xmlNodeSetBase		(xmlNodePtr cur,
    782 					 xmlChar *uri);
    783 
    784 /*
    785  * Removing content.
    786  */
    787 int		xmlRemoveProp		(xmlAttrPtr cur);
    788 int		xmlUnsetProp		(xmlNodePtr node,
    789 					 const xmlChar *name);
    790 int		xmlUnsetNsProp		(xmlNodePtr node,
    791 					 xmlNsPtr ns,
    792 					 const xmlChar *name);
    793 
    794 /*
    795  * Internal, don't use.
    796  */
    797 void		xmlBufferWriteCHAR	(xmlBufferPtr buf,
    798 					 const xmlChar *string);
    799 void		xmlBufferWriteChar	(xmlBufferPtr buf,
    800 					 const char *string);
    801 void		xmlBufferWriteQuotedString(xmlBufferPtr buf,
    802 					 const xmlChar *string);
    803 
    804 /*
    805  * Namespace handling.
    806  */
    807 int		xmlReconciliateNs	(xmlDocPtr doc,
    808 					 xmlNodePtr tree);
    809 
    810 /*
    811  * Saving.
    812  */
    813 void		xmlDocDumpFormatMemory	(xmlDocPtr cur,
    814 					 xmlChar **mem,
    815 					 int *size,
    816 					 int format);
    817 void		xmlDocDumpMemory	(xmlDocPtr cur,
    818 					 xmlChar **mem,
    819 					 int *size);
    820 void		xmlDocDumpMemoryEnc	(xmlDocPtr out_doc,
    821 					 xmlChar **doc_txt_ptr,
    822 					 int * doc_txt_len,
    823 					 const char *txt_encoding);
    824 void		xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
    825 					 xmlChar **doc_txt_ptr,
    826 					 int * doc_txt_len,
    827 					 const char *txt_encoding,
    828 					 int format);
    829 int		xmlDocFormatDump(FILE *f,
    830 					 xmlDocPtr cur,
    831 					 int format);
    832 int		xmlDocDump		(FILE *f,
    833 					 xmlDocPtr cur);
    834 void		xmlElemDump		(FILE *f,
    835 					 xmlDocPtr doc,
    836 					 xmlNodePtr cur);
    837 int		xmlSaveFile		(const char *filename,
    838 					 xmlDocPtr cur);
    839 int		xmlSaveFormatFile	(const char *filename,
    840 					 xmlDocPtr cur,
    841 					 int format);
    842 void		xmlNodeDump		(xmlBufferPtr buf,
    843 					 xmlDocPtr doc,
    844 					 xmlNodePtr cur,
    845 					 int level,
    846 					 int format);
    847 
    848 int		xmlSaveFileTo		(xmlOutputBufferPtr buf,
    849 					 xmlDocPtr cur,
    850 					 const char *encoding);
    851 int             xmlSaveFormatFileTo     (xmlOutputBufferPtr buf,
    852 					 xmlDocPtr cur,
    853 				         const char *encoding,
    854 				         int format);
    855 void		xmlNodeDumpOutput	(xmlOutputBufferPtr buf,
    856 					 xmlDocPtr doc,
    857 					 xmlNodePtr cur,
    858 					 int level,
    859 					 int format,
    860 					 const char *encoding);
    861 
    862 int		xmlSaveFormatFileEnc    (const char *filename,
    863 					 xmlDocPtr cur,
    864 					 const char *encoding,
    865 					 int format);
    866 
    867 int		xmlSaveFileEnc		(const char *filename,
    868 					 xmlDocPtr cur,
    869 					 const char *encoding);
    870 
    871 /*
    872  * XHTML
    873  */
    874 int		xmlIsXHTML		(const xmlChar *systemID,
    875 					 const xmlChar *publicID);
    876 
    877 /*
    878  * Compression.
    879  */
    880 int		xmlGetDocCompressMode	(xmlDocPtr doc);
    881 void		xmlSetDocCompressMode	(xmlDocPtr doc,
    882 					 int mode);
    883 int		xmlGetCompressMode	(void);
    884 void		xmlSetCompressMode	(int mode);
    885 
    886 #ifdef __cplusplus
    887 }
    888 #endif
    889 #ifndef __XML_PARSER_H__
    890 #include 
    891 #endif
    892 
    893 #endif /* __XML_TREE_H__ */
    894