Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * tree.h : describes the structures found in an tree resulting |
| 3 | * from an XML parsing. |
| 4 | * |
| 5 | * See Copyright for the status of this software. |
| 6 | * |
| 7 | * Daniel.Veillard@w3.org |
| 8 | * |
| 9 | * 14 Nov 2000 ht - added redefinition of xmlBufferWriteChar for VMS |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #ifndef __XML_TREE_H__ |
| 14 | #define __XML_TREE_H__ |
| 15 | |
| 16 | #include <stdio.h> |
| 17 | #include <libxml/xmlversion.h> |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | #define XML_XML_NAMESPACE \ |
| 24 | (const xmlChar *) "http://www.w3.org/XML/1998/namespace" |
| 25 | |
| 26 | /* |
| 27 | * The different element types carried by an XML tree |
| 28 | * |
| 29 | * NOTE: This is synchronized with DOM Level1 values |
| 30 | * See http://www.w3.org/TR/REC-DOM-Level-1/ |
| 31 | * |
| 32 | * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should |
| 33 | * be deprecated to use an XML_DTD_NODE. |
| 34 | */ |
| 35 | typedef enum { |
| 36 | XML_ELEMENT_NODE= 1, |
| 37 | XML_ATTRIBUTE_NODE= 2, |
| 38 | XML_TEXT_NODE= 3, |
| 39 | XML_CDATA_SECTION_NODE= 4, |
| 40 | XML_ENTITY_REF_NODE= 5, |
| 41 | XML_ENTITY_NODE= 6, |
| 42 | XML_PI_NODE= 7, |
| 43 | XML_COMMENT_NODE= 8, |
| 44 | XML_DOCUMENT_NODE= 9, |
| 45 | XML_DOCUMENT_TYPE_NODE= 10, |
| 46 | XML_DOCUMENT_FRAG_NODE= 11, |
| 47 | XML_NOTATION_NODE= 12, |
| 48 | XML_HTML_DOCUMENT_NODE= 13, |
| 49 | XML_DTD_NODE= 14, |
| 50 | XML_ELEMENT_DECL= 15, |
| 51 | XML_ATTRIBUTE_DECL= 16, |
| 52 | XML_ENTITY_DECL= 17, |
| 53 | XML_NAMESPACE_DECL= 18, |
| 54 | XML_XINCLUDE_START= 19, |
| 55 | XML_XINCLUDE_END= 20 |
| 56 | #ifdef LIBXML_SGML_ENABLED |
| 57 | ,XML_SGML_DOCUMENT_NODE= 21 |
| 58 | #endif |
| 59 | } xmlElementType; |
| 60 | |
| 61 | /* |
| 62 | * Size of an internal character representation. |
| 63 | * |
| 64 | * We use 8bit chars internal representation for memory efficiency, |
| 65 | * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle |
| 66 | * correctly non ISO-Latin input. |
| 67 | */ |
| 68 | |
| 69 | typedef unsigned char xmlChar; |
| 70 | |
| 71 | #ifndef WIN32 |
| 72 | #ifndef CHAR |
| 73 | #define CHAR xmlChar |
| 74 | #endif |
| 75 | #endif |
| 76 | |
| 77 | #define BAD_CAST (xmlChar *) |
| 78 | |
| 79 | /* |
| 80 | * a DTD Notation definition |
| 81 | */ |
| 82 | |
| 83 | typedef struct _xmlNotation xmlNotation; |
| 84 | typedef xmlNotation *xmlNotationPtr; |
| 85 | struct _xmlNotation { |
Daniel Veillard | 9e7160d | 2001-03-18 23:17:47 +0000 | [diff] [blame] | 86 | const xmlChar *name; /* Notation name */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 87 | const xmlChar *PublicID; /* Public identifier, if any */ |
| 88 | const xmlChar *SystemID; /* System identifier, if any */ |
| 89 | }; |
| 90 | |
| 91 | /* |
| 92 | * a DTD Attribute definition |
| 93 | */ |
| 94 | |
| 95 | typedef enum { |
| 96 | XML_ATTRIBUTE_CDATA = 1, |
| 97 | XML_ATTRIBUTE_ID, |
| 98 | XML_ATTRIBUTE_IDREF , |
| 99 | XML_ATTRIBUTE_IDREFS, |
| 100 | XML_ATTRIBUTE_ENTITY, |
| 101 | XML_ATTRIBUTE_ENTITIES, |
| 102 | XML_ATTRIBUTE_NMTOKEN, |
| 103 | XML_ATTRIBUTE_NMTOKENS, |
| 104 | XML_ATTRIBUTE_ENUMERATION, |
| 105 | XML_ATTRIBUTE_NOTATION |
| 106 | } xmlAttributeType; |
| 107 | |
| 108 | typedef enum { |
| 109 | XML_ATTRIBUTE_NONE = 1, |
| 110 | XML_ATTRIBUTE_REQUIRED, |
| 111 | XML_ATTRIBUTE_IMPLIED, |
| 112 | XML_ATTRIBUTE_FIXED |
| 113 | } xmlAttributeDefault; |
| 114 | |
| 115 | typedef struct _xmlEnumeration xmlEnumeration; |
| 116 | typedef xmlEnumeration *xmlEnumerationPtr; |
| 117 | struct _xmlEnumeration { |
| 118 | struct _xmlEnumeration *next; /* next one */ |
| 119 | const xmlChar *name; /* Enumeration name */ |
| 120 | }; |
| 121 | |
| 122 | typedef struct _xmlAttribute xmlAttribute; |
| 123 | typedef xmlAttribute *xmlAttributePtr; |
| 124 | struct _xmlAttribute { |
| 125 | #ifndef XML_WITHOUT_CORBA |
| 126 | void *_private; /* for Corba, must be first ! */ |
| 127 | #endif |
| 128 | xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ |
| 129 | const xmlChar *name; /* Attribute name */ |
| 130 | struct _xmlNode *children; /* NULL */ |
| 131 | struct _xmlNode *last; /* NULL */ |
| 132 | struct _xmlDtd *parent; /* -> DTD */ |
| 133 | struct _xmlNode *next; /* next sibling link */ |
| 134 | struct _xmlNode *prev; /* previous sibling link */ |
| 135 | struct _xmlDoc *doc; /* the containing document */ |
| 136 | |
| 137 | struct _xmlAttribute *nexth; /* next in hash table */ |
| 138 | xmlAttributeType atype; /* The attribute type */ |
| 139 | xmlAttributeDefault def; /* the default */ |
| 140 | const xmlChar *defaultValue; /* or the default value */ |
| 141 | xmlEnumerationPtr tree; /* or the enumeration tree if any */ |
| 142 | const xmlChar *prefix; /* the namespace prefix if any */ |
| 143 | const xmlChar *elem; /* Element holding the attribute */ |
| 144 | }; |
| 145 | |
| 146 | /* |
| 147 | * a DTD Element definition. |
| 148 | */ |
| 149 | typedef enum { |
| 150 | XML_ELEMENT_CONTENT_PCDATA = 1, |
| 151 | XML_ELEMENT_CONTENT_ELEMENT, |
| 152 | XML_ELEMENT_CONTENT_SEQ, |
| 153 | XML_ELEMENT_CONTENT_OR |
| 154 | } xmlElementContentType; |
| 155 | |
| 156 | typedef enum { |
| 157 | XML_ELEMENT_CONTENT_ONCE = 1, |
| 158 | XML_ELEMENT_CONTENT_OPT, |
| 159 | XML_ELEMENT_CONTENT_MULT, |
| 160 | XML_ELEMENT_CONTENT_PLUS |
| 161 | } xmlElementContentOccur; |
| 162 | |
| 163 | typedef struct _xmlElementContent xmlElementContent; |
| 164 | typedef xmlElementContent *xmlElementContentPtr; |
| 165 | struct _xmlElementContent { |
| 166 | xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ |
| 167 | xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ |
| 168 | const xmlChar *name; /* Element name */ |
| 169 | struct _xmlElementContent *c1; /* first child */ |
| 170 | struct _xmlElementContent *c2; /* second child */ |
| 171 | }; |
| 172 | |
| 173 | typedef enum { |
| 174 | XML_ELEMENT_TYPE_EMPTY = 1, |
| 175 | XML_ELEMENT_TYPE_ANY, |
| 176 | XML_ELEMENT_TYPE_MIXED, |
| 177 | XML_ELEMENT_TYPE_ELEMENT |
| 178 | } xmlElementTypeVal; |
| 179 | |
| 180 | typedef struct _xmlElement xmlElement; |
| 181 | typedef xmlElement *xmlElementPtr; |
| 182 | struct _xmlElement { |
| 183 | #ifndef XML_WITHOUT_CORBA |
| 184 | void *_private; /* for Corba, must be first ! */ |
| 185 | #endif |
| 186 | xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ |
| 187 | const xmlChar *name; /* Element name */ |
| 188 | struct _xmlNode *children; /* NULL */ |
| 189 | struct _xmlNode *last; /* NULL */ |
| 190 | struct _xmlDtd *parent; /* -> DTD */ |
| 191 | struct _xmlNode *next; /* next sibling link */ |
| 192 | struct _xmlNode *prev; /* previous sibling link */ |
| 193 | struct _xmlDoc *doc; /* the containing document */ |
| 194 | |
| 195 | xmlElementTypeVal etype; /* The type */ |
| 196 | xmlElementContentPtr content; /* the allowed element content */ |
| 197 | xmlAttributePtr attributes; /* List of the declared attributes */ |
| 198 | const xmlChar *prefix; /* the namespace prefix if any */ |
| 199 | }; |
| 200 | |
| 201 | /* |
| 202 | * An XML namespace. |
| 203 | * Note that prefix == NULL is valid, it defines the default namespace |
| 204 | * within the subtree (until overriden). |
| 205 | * |
| 206 | * XML_GLOBAL_NAMESPACE is now deprecated for good |
| 207 | * xmlNsType is unified with xmlElementType |
| 208 | */ |
| 209 | |
| 210 | #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL |
| 211 | typedef xmlElementType xmlNsType; |
| 212 | |
| 213 | typedef struct _xmlNs xmlNs; |
| 214 | typedef xmlNs *xmlNsPtr; |
| 215 | struct _xmlNs { |
| 216 | struct _xmlNs *next; /* next Ns link for this node */ |
| 217 | xmlNsType type; /* global or local */ |
| 218 | const xmlChar *href; /* URL for the namespace */ |
| 219 | const xmlChar *prefix; /* prefix for the namespace */ |
| 220 | }; |
| 221 | |
| 222 | /* |
| 223 | * An XML DtD, as defined by <!DOCTYPE. |
| 224 | */ |
| 225 | typedef struct _xmlDtd xmlDtd; |
| 226 | typedef xmlDtd *xmlDtdPtr; |
| 227 | struct _xmlDtd { |
| 228 | #ifndef XML_WITHOUT_CORBA |
| 229 | void *_private; /* for Corba, must be first ! */ |
| 230 | #endif |
| 231 | xmlElementType type; /* XML_DTD_NODE, must be second ! */ |
| 232 | const xmlChar *name; /* Name of the DTD */ |
| 233 | struct _xmlNode *children; /* the value of the property link */ |
| 234 | struct _xmlNode *last; /* last child link */ |
| 235 | struct _xmlDoc *parent; /* child->parent link */ |
| 236 | struct _xmlNode *next; /* next sibling link */ |
| 237 | struct _xmlNode *prev; /* previous sibling link */ |
| 238 | struct _xmlDoc *doc; /* the containing document */ |
| 239 | |
| 240 | /* End of common part */ |
| 241 | void *notations; /* Hash table for notations if any */ |
| 242 | void *elements; /* Hash table for elements if any */ |
| 243 | void *attributes; /* Hash table for attributes if any */ |
| 244 | void *entities; /* Hash table for entities if any */ |
| 245 | const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ |
| 246 | const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ |
| 247 | void *pentities; /* Hash table for param entities if any */ |
| 248 | }; |
| 249 | |
| 250 | /* |
| 251 | * A attribute of an XML node. |
| 252 | */ |
| 253 | typedef struct _xmlAttr xmlAttr; |
| 254 | typedef xmlAttr *xmlAttrPtr; |
| 255 | struct _xmlAttr { |
| 256 | #ifndef XML_WITHOUT_CORBA |
| 257 | void *_private; /* for Corba, must be first ! */ |
| 258 | #endif |
| 259 | xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ |
| 260 | const xmlChar *name; /* the name of the property */ |
| 261 | struct _xmlNode *children; /* the value of the property */ |
| 262 | struct _xmlNode *last; /* NULL */ |
| 263 | struct _xmlNode *parent; /* child->parent link */ |
| 264 | struct _xmlAttr *next; /* next sibling link */ |
| 265 | struct _xmlAttr *prev; /* previous sibling link */ |
| 266 | struct _xmlDoc *doc; /* the containing document */ |
| 267 | xmlNs *ns; /* pointer to the associated namespace */ |
| 268 | xmlAttributeType atype; /* the attribute type if validating */ |
| 269 | }; |
| 270 | |
| 271 | /* |
| 272 | * An XML ID instance. |
| 273 | */ |
| 274 | |
| 275 | typedef struct _xmlID xmlID; |
| 276 | typedef xmlID *xmlIDPtr; |
| 277 | struct _xmlID { |
| 278 | struct _xmlID *next; /* next ID */ |
| 279 | const xmlChar *value; /* The ID name */ |
| 280 | xmlAttrPtr attr; /* The attribut holding it */ |
| 281 | }; |
| 282 | |
| 283 | /* |
| 284 | * An XML IDREF instance. |
| 285 | */ |
| 286 | |
| 287 | typedef struct _xmlRef xmlRef; |
| 288 | typedef xmlRef *xmlRefPtr; |
| 289 | struct _xmlRef { |
| 290 | struct _xmlRef *next; /* next Ref */ |
| 291 | const xmlChar *value; /* The Ref name */ |
| 292 | xmlAttrPtr attr; /* The attribut holding it */ |
| 293 | }; |
| 294 | |
| 295 | /* |
| 296 | * A buffer structure |
| 297 | */ |
| 298 | |
| 299 | typedef enum { |
| 300 | XML_BUFFER_ALLOC_DOUBLEIT, |
| 301 | XML_BUFFER_ALLOC_EXACT |
| 302 | } xmlBufferAllocationScheme; |
| 303 | |
| 304 | typedef struct _xmlBuffer xmlBuffer; |
| 305 | typedef xmlBuffer *xmlBufferPtr; |
| 306 | struct _xmlBuffer { |
| 307 | xmlChar *content; /* The buffer content UTF8 */ |
| 308 | unsigned int use; /* The buffer size used */ |
| 309 | unsigned int size; /* The buffer size */ |
| 310 | xmlBufferAllocationScheme alloc; /* The realloc method */ |
| 311 | }; |
| 312 | |
| 313 | /* |
| 314 | * A node in an XML tree. |
| 315 | */ |
| 316 | typedef struct _xmlNode xmlNode; |
| 317 | typedef xmlNode *xmlNodePtr; |
| 318 | struct _xmlNode { |
| 319 | #ifndef XML_WITHOUT_CORBA |
| 320 | void *_private; /* for Corba, must be first ! */ |
| 321 | #endif |
| 322 | xmlElementType type; /* type number, must be second ! */ |
| 323 | const xmlChar *name; /* the name of the node, or the entity */ |
| 324 | struct _xmlNode *children; /* parent->childs link */ |
| 325 | struct _xmlNode *last; /* last child link */ |
| 326 | struct _xmlNode *parent; /* child->parent link */ |
| 327 | struct _xmlNode *next; /* next sibling link */ |
| 328 | struct _xmlNode *prev; /* previous sibling link */ |
| 329 | struct _xmlDoc *doc; /* the containing document */ |
| 330 | xmlNs *ns; /* pointer to the associated namespace */ |
| 331 | #ifndef XML_USE_BUFFER_CONTENT |
| 332 | xmlChar *content; /* the content */ |
| 333 | #else |
| 334 | xmlBufferPtr content; /* the content in a buffer */ |
| 335 | #endif |
| 336 | |
| 337 | /* End of common part */ |
| 338 | struct _xmlAttr *properties;/* properties list */ |
| 339 | xmlNs *nsDef; /* namespace definitions on this node */ |
| 340 | }; |
| 341 | |
| 342 | /* |
| 343 | * An XML document. |
| 344 | */ |
| 345 | typedef struct _xmlDoc xmlDoc; |
| 346 | typedef xmlDoc *xmlDocPtr; |
| 347 | struct _xmlDoc { |
| 348 | #ifndef XML_WITHOUT_CORBA |
| 349 | void *_private; /* for Corba, must be first ! */ |
| 350 | #endif |
| 351 | xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ |
| 352 | char *name; /* name/filename/URI of the document */ |
| 353 | struct _xmlNode *children; /* the document tree */ |
| 354 | struct _xmlNode *last; /* last child link */ |
| 355 | struct _xmlNode *parent; /* child->parent link */ |
| 356 | struct _xmlNode *next; /* next sibling link */ |
| 357 | struct _xmlNode *prev; /* previous sibling link */ |
| 358 | struct _xmlDoc *doc; /* autoreference to itself */ |
| 359 | |
| 360 | /* End of common part */ |
| 361 | int compression;/* level of zlib compression */ |
| 362 | int standalone; /* standalone document (no external refs) */ |
| 363 | struct _xmlDtd *intSubset; /* the document internal subset */ |
| 364 | struct _xmlDtd *extSubset; /* the document external subset */ |
| 365 | struct _xmlNs *oldNs; /* Global namespace, the old way */ |
| 366 | const xmlChar *version; /* the XML version string */ |
| 367 | const xmlChar *encoding; /* external initial encoding, if any */ |
| 368 | void *ids; /* Hash table for ID attributes if any */ |
| 369 | void *refs; /* Hash table for IDREFs attributes if any */ |
| 370 | const xmlChar *URL; /* The URI for that document */ |
| 371 | int charset; /* encoding of the in-memory content |
| 372 | actually an xmlCharEncoding */ |
| 373 | }; |
| 374 | |
| 375 | /* |
| 376 | * Compatibility naming layer with libxml1 |
| 377 | */ |
| 378 | #ifndef xmlChildrenNode |
| 379 | #define xmlChildrenNode children |
| 380 | #define xmlRootNode children |
| 381 | #endif |
| 382 | |
| 383 | /* |
| 384 | * Variables. |
| 385 | */ |
| 386 | LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD; |
| 387 | LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ |
| 388 | LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ |
| 389 | LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ |
Daniel Veillard | e356c28 | 2001-03-10 12:32:04 +0000 | [diff] [blame] | 390 | LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */ |
| 391 | LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 392 | |
| 393 | /* |
| 394 | * Handling Buffers. |
| 395 | */ |
| 396 | |
| 397 | xmlBufferPtr xmlBufferCreate (void); |
| 398 | xmlBufferPtr xmlBufferCreateSize (size_t size); |
| 399 | void xmlBufferFree (xmlBufferPtr buf); |
| 400 | int xmlBufferDump (FILE *file, |
| 401 | xmlBufferPtr buf); |
| 402 | void xmlBufferAdd (xmlBufferPtr buf, |
| 403 | const xmlChar *str, |
| 404 | int len); |
| 405 | void xmlBufferAddHead (xmlBufferPtr buf, |
| 406 | const xmlChar *str, |
| 407 | int len); |
| 408 | void xmlBufferCat (xmlBufferPtr buf, |
| 409 | const xmlChar *str); |
| 410 | void xmlBufferCCat (xmlBufferPtr buf, |
| 411 | const char *str); |
| 412 | int xmlBufferShrink (xmlBufferPtr buf, |
| 413 | unsigned int len); |
| 414 | int xmlBufferGrow (xmlBufferPtr buf, |
| 415 | unsigned int len); |
| 416 | void xmlBufferEmpty (xmlBufferPtr buf); |
| 417 | const xmlChar* xmlBufferContent (const xmlBufferPtr buf); |
| 418 | int xmlBufferUse (const xmlBufferPtr buf); |
| 419 | void xmlBufferSetAllocationScheme(xmlBufferPtr buf, |
| 420 | xmlBufferAllocationScheme scheme); |
| 421 | int xmlBufferLength (const xmlBufferPtr buf); |
| 422 | |
| 423 | /* |
| 424 | * Creating/freeing new structures |
| 425 | */ |
| 426 | xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc, |
| 427 | const xmlChar *name, |
| 428 | const xmlChar *ExternalID, |
| 429 | const xmlChar *SystemID); |
| 430 | xmlDtdPtr xmlNewDtd (xmlDocPtr doc, |
| 431 | const xmlChar *name, |
| 432 | const xmlChar *ExternalID, |
| 433 | const xmlChar *SystemID); |
| 434 | xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc); |
| 435 | void xmlFreeDtd (xmlDtdPtr cur); |
| 436 | xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc, |
| 437 | const xmlChar *href, |
| 438 | const xmlChar *prefix); |
| 439 | xmlNsPtr xmlNewNs (xmlNodePtr node, |
| 440 | const xmlChar *href, |
| 441 | const xmlChar *prefix); |
| 442 | void xmlFreeNs (xmlNsPtr cur); |
| 443 | xmlDocPtr xmlNewDoc (const xmlChar *version); |
| 444 | void xmlFreeDoc (xmlDocPtr cur); |
| 445 | xmlAttrPtr xmlNewDocProp (xmlDocPtr doc, |
| 446 | const xmlChar *name, |
| 447 | const xmlChar *value); |
| 448 | xmlAttrPtr xmlNewProp (xmlNodePtr node, |
| 449 | const xmlChar *name, |
| 450 | const xmlChar *value); |
| 451 | xmlAttrPtr xmlNewNsProp (xmlNodePtr node, |
| 452 | xmlNsPtr ns, |
| 453 | const xmlChar *name, |
| 454 | const xmlChar *value); |
| 455 | void xmlFreePropList (xmlAttrPtr cur); |
| 456 | void xmlFreeProp (xmlAttrPtr cur); |
| 457 | xmlAttrPtr xmlCopyProp (xmlNodePtr target, |
| 458 | xmlAttrPtr cur); |
| 459 | xmlAttrPtr xmlCopyPropList (xmlNodePtr target, |
| 460 | xmlAttrPtr cur); |
| 461 | xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd); |
| 462 | xmlDocPtr xmlCopyDoc (xmlDocPtr doc, |
| 463 | int recursive); |
| 464 | |
| 465 | /* |
| 466 | * Creating new nodes |
| 467 | */ |
| 468 | xmlNodePtr xmlNewDocNode (xmlDocPtr doc, |
| 469 | xmlNsPtr ns, |
| 470 | const xmlChar *name, |
| 471 | const xmlChar *content); |
| 472 | xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc, |
| 473 | xmlNsPtr ns, |
| 474 | const xmlChar *name, |
| 475 | const xmlChar *content); |
| 476 | xmlNodePtr xmlNewNode (xmlNsPtr ns, |
| 477 | const xmlChar *name); |
| 478 | xmlNodePtr xmlNewChild (xmlNodePtr parent, |
| 479 | xmlNsPtr ns, |
| 480 | const xmlChar *name, |
| 481 | const xmlChar *content); |
| 482 | xmlNodePtr xmlNewTextChild (xmlNodePtr parent, |
| 483 | xmlNsPtr ns, |
| 484 | const xmlChar *name, |
| 485 | const xmlChar *content); |
| 486 | xmlNodePtr xmlNewDocText (xmlDocPtr doc, |
| 487 | const xmlChar *content); |
| 488 | xmlNodePtr xmlNewText (const xmlChar *content); |
| 489 | xmlNodePtr xmlNewPI (const xmlChar *name, |
| 490 | const xmlChar *content); |
| 491 | xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc, |
| 492 | const xmlChar *content, |
| 493 | int len); |
| 494 | xmlNodePtr xmlNewTextLen (const xmlChar *content, |
| 495 | int len); |
| 496 | xmlNodePtr xmlNewDocComment (xmlDocPtr doc, |
| 497 | const xmlChar *content); |
| 498 | xmlNodePtr xmlNewComment (const xmlChar *content); |
| 499 | xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc, |
| 500 | const xmlChar *content, |
| 501 | int len); |
| 502 | xmlNodePtr xmlNewCharRef (xmlDocPtr doc, |
| 503 | const xmlChar *name); |
| 504 | xmlNodePtr xmlNewReference (xmlDocPtr doc, |
| 505 | const xmlChar *name); |
| 506 | xmlNodePtr xmlCopyNode (xmlNodePtr node, |
| 507 | int recursive); |
| 508 | xmlNodePtr xmlCopyNodeList (xmlNodePtr node); |
| 509 | xmlNodePtr xmlNewDocFragment (xmlDocPtr doc); |
| 510 | |
| 511 | /* |
| 512 | * Navigating |
| 513 | */ |
| 514 | xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc); |
| 515 | xmlNodePtr xmlGetLastChild (xmlNodePtr parent); |
| 516 | int xmlNodeIsText (xmlNodePtr node); |
| 517 | int xmlIsBlankNode (xmlNodePtr node); |
| 518 | |
| 519 | /* |
| 520 | * Changing the structure |
| 521 | */ |
| 522 | xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc, |
| 523 | xmlNodePtr root); |
| 524 | void xmlNodeSetName (xmlNodePtr cur, |
| 525 | const xmlChar *name); |
| 526 | xmlNodePtr xmlAddChild (xmlNodePtr parent, |
| 527 | xmlNodePtr cur); |
| 528 | xmlNodePtr xmlAddChildList (xmlNodePtr parent, |
| 529 | xmlNodePtr cur); |
| 530 | xmlNodePtr xmlReplaceNode (xmlNodePtr old, |
| 531 | xmlNodePtr cur); |
| 532 | xmlNodePtr xmlAddSibling (xmlNodePtr cur, |
| 533 | xmlNodePtr elem); |
| 534 | xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur, |
| 535 | xmlNodePtr elem); |
| 536 | xmlNodePtr xmlAddNextSibling (xmlNodePtr cur, |
| 537 | xmlNodePtr elem); |
| 538 | void xmlUnlinkNode (xmlNodePtr cur); |
| 539 | xmlNodePtr xmlTextMerge (xmlNodePtr first, |
| 540 | xmlNodePtr second); |
| 541 | void xmlTextConcat (xmlNodePtr node, |
| 542 | const xmlChar *content, |
| 543 | int len); |
| 544 | void xmlFreeNodeList (xmlNodePtr cur); |
| 545 | void xmlFreeNode (xmlNodePtr cur); |
| 546 | void xmlSetTreeDoc (xmlNodePtr tree, |
| 547 | xmlDocPtr doc); |
| 548 | void xmlSetListDoc (xmlNodePtr list, |
| 549 | xmlDocPtr doc); |
| 550 | |
| 551 | /* |
| 552 | * Namespaces |
| 553 | */ |
| 554 | xmlNsPtr xmlSearchNs (xmlDocPtr doc, |
| 555 | xmlNodePtr node, |
| 556 | const xmlChar *nameSpace); |
| 557 | xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc, |
| 558 | xmlNodePtr node, |
| 559 | const xmlChar *href); |
| 560 | xmlNsPtr * xmlGetNsList (xmlDocPtr doc, |
| 561 | xmlNodePtr node); |
| 562 | void xmlSetNs (xmlNodePtr node, |
| 563 | xmlNsPtr ns); |
| 564 | xmlNsPtr xmlCopyNamespace (xmlNsPtr cur); |
| 565 | xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur); |
| 566 | |
| 567 | /* |
| 568 | * Changing the content. |
| 569 | */ |
| 570 | xmlAttrPtr xmlSetProp (xmlNodePtr node, |
| 571 | const xmlChar *name, |
| 572 | const xmlChar *value); |
| 573 | xmlChar * xmlGetProp (xmlNodePtr node, |
| 574 | const xmlChar *name); |
| 575 | xmlAttrPtr xmlHasProp (xmlNodePtr node, |
| 576 | const xmlChar *name); |
| 577 | xmlAttrPtr xmlSetNsProp (xmlNodePtr node, |
| 578 | xmlNsPtr ns, |
| 579 | const xmlChar *name, |
| 580 | const xmlChar *value); |
| 581 | xmlChar * xmlGetNsProp (xmlNodePtr node, |
| 582 | const xmlChar *name, |
| 583 | const xmlChar *nameSpace); |
| 584 | xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, |
| 585 | const xmlChar *value); |
| 586 | xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc, |
| 587 | const xmlChar *value, |
| 588 | int len); |
| 589 | xmlChar * xmlNodeListGetString (xmlDocPtr doc, |
| 590 | xmlNodePtr list, |
| 591 | int inLine); |
| 592 | xmlChar * xmlNodeListGetRawString (xmlDocPtr doc, |
| 593 | xmlNodePtr list, |
| 594 | int inLine); |
| 595 | void xmlNodeSetContent (xmlNodePtr cur, |
| 596 | const xmlChar *content); |
| 597 | void xmlNodeSetContentLen (xmlNodePtr cur, |
| 598 | const xmlChar *content, |
| 599 | int len); |
| 600 | void xmlNodeAddContent (xmlNodePtr cur, |
| 601 | const xmlChar *content); |
| 602 | void xmlNodeAddContentLen (xmlNodePtr cur, |
| 603 | const xmlChar *content, |
| 604 | int len); |
| 605 | xmlChar * xmlNodeGetContent (xmlNodePtr cur); |
| 606 | xmlChar * xmlNodeGetLang (xmlNodePtr cur); |
| 607 | void xmlNodeSetLang (xmlNodePtr cur, |
| 608 | const xmlChar *lang); |
| 609 | int xmlNodeGetSpacePreserve (xmlNodePtr cur); |
| 610 | void xmlNodeSetSpacePreserve (xmlNodePtr cur, int |
| 611 | val); |
| 612 | xmlChar * xmlNodeGetBase (xmlDocPtr doc, |
| 613 | xmlNodePtr cur); |
| 614 | void xmlNodeSetBase (xmlNodePtr cur, |
| 615 | xmlChar *uri); |
| 616 | |
| 617 | /* |
| 618 | * Removing content. |
| 619 | */ |
| 620 | int xmlRemoveProp (xmlAttrPtr attr); |
| 621 | int xmlRemoveNode (xmlNodePtr node); /* TODO */ |
| 622 | |
| 623 | /* |
| 624 | * Internal, don't use |
| 625 | */ |
| 626 | #ifdef VMS |
| 627 | void xmlBufferWriteXmlCHAR (xmlBufferPtr buf, |
| 628 | const xmlChar *string); |
| 629 | #define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR |
| 630 | #else |
| 631 | void xmlBufferWriteCHAR (xmlBufferPtr buf, |
| 632 | const xmlChar *string); |
| 633 | #endif |
| 634 | void xmlBufferWriteChar (xmlBufferPtr buf, |
| 635 | const char *string); |
| 636 | void xmlBufferWriteQuotedString(xmlBufferPtr buf, |
| 637 | const xmlChar *string); |
| 638 | |
| 639 | /* |
| 640 | * Namespace handling |
| 641 | */ |
| 642 | int xmlReconciliateNs (xmlDocPtr doc, |
| 643 | xmlNodePtr tree); |
| 644 | |
| 645 | /* |
| 646 | * Saving |
| 647 | */ |
| 648 | void xmlDocDumpFormatMemory (xmlDocPtr cur, |
| 649 | xmlChar**mem, |
| 650 | int *size, |
| 651 | int format); |
| 652 | void xmlDocDumpMemory (xmlDocPtr cur, |
| 653 | xmlChar**mem, |
| 654 | int *size); |
| 655 | void xmlDocDumpMemoryEnc (xmlDocPtr out_doc, |
| 656 | xmlChar **doc_txt_ptr, |
| 657 | int * doc_txt_len, |
| 658 | const char *txt_encoding); |
| 659 | void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, |
| 660 | xmlChar **doc_txt_ptr, |
| 661 | int * doc_txt_len, |
| 662 | const char *txt_encoding, |
| 663 | int format); |
| 664 | int xmlDocDump (FILE *f, |
| 665 | xmlDocPtr cur); |
| 666 | void xmlElemDump (FILE *f, |
| 667 | xmlDocPtr doc, |
| 668 | xmlNodePtr cur); |
| 669 | int xmlSaveFile (const char *filename, |
| 670 | xmlDocPtr cur); |
| 671 | void xmlNodeDump (xmlBufferPtr buf, |
| 672 | xmlDocPtr doc, |
| 673 | xmlNodePtr cur, |
| 674 | int level, |
| 675 | int format); |
| 676 | |
| 677 | /* This one is exported from xmlIO.h |
| 678 | |
| 679 | int xmlSaveFileTo (xmlOutputBuffer *buf, |
| 680 | xmlDocPtr cur, |
| 681 | const char *encoding); |
| 682 | */ |
| 683 | |
| 684 | int xmlSaveFileEnc (const char *filename, |
| 685 | xmlDocPtr cur, |
| 686 | const char *encoding); |
| 687 | |
| 688 | /* |
| 689 | * Compression |
| 690 | */ |
| 691 | int xmlGetDocCompressMode (xmlDocPtr doc); |
| 692 | void xmlSetDocCompressMode (xmlDocPtr doc, |
| 693 | int mode); |
| 694 | int xmlGetCompressMode (void); |
| 695 | void xmlSetCompressMode (int mode); |
| 696 | |
| 697 | #ifdef __cplusplus |
| 698 | } |
| 699 | #endif |
| 700 | |
| 701 | #endif /* __XML_TREE_H__ */ |
| 702 | |