tree.h 38 KB

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