tree.h 37 KB

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