tree.h 36 KB

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