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