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