tree.h 39 KB

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