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