You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1241 lines
39 KiB

4 years ago
  1. /*
  2. * Summary: the core parser module
  3. * Description: Interfaces, constants and types related to the XML parser
  4. *
  5. * Copy: See Copyright for the status of this software.
  6. *
  7. * Author: Daniel Veillard
  8. */
  9. #ifndef __XML_PARSER_H__
  10. #define __XML_PARSER_H__
  11. #include <stdarg.h>
  12. #include <libxml/xmlversion.h>
  13. #include <libxml/tree.h>
  14. #include <libxml/dict.h>
  15. #include <libxml/hash.h>
  16. #include <libxml/valid.h>
  17. #include <libxml/entities.h>
  18. #include <libxml/xmlerror.h>
  19. #include <libxml/xmlstring.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /**
  24. * XML_DEFAULT_VERSION:
  25. *
  26. * The default version of XML used: 1.0
  27. */
  28. #define XML_DEFAULT_VERSION "1.0"
  29. /**
  30. * xmlParserInput:
  31. *
  32. * An xmlParserInput is an input flow for the XML processor.
  33. * Each entity parsed is associated an xmlParserInput (except the
  34. * few predefined ones). This is the case both for internal entities
  35. * - in which case the flow is already completely in memory - or
  36. * external entities - in which case we use the buf structure for
  37. * progressive reading and I18N conversions to the internal UTF-8 format.
  38. */
  39. /**
  40. * xmlParserInputDeallocate:
  41. * @str: the string to deallocate
  42. *
  43. * Callback for freeing some parser input allocations.
  44. */
  45. typedef void (* xmlParserInputDeallocate)(xmlChar *str);
  46. struct _xmlParserInput {
  47. /* Input buffer */
  48. xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
  49. const char *filename; /* The file analyzed, if any */
  50. const char *directory; /* the directory/base of the file */
  51. const xmlChar *base; /* Base of the array to parse */
  52. const xmlChar *cur; /* Current char being parsed */
  53. const xmlChar *end; /* end of the array to parse */
  54. int length; /* length if known */
  55. int line; /* Current line */
  56. int col; /* Current column */
  57. /*
  58. * NOTE: consumed is only tested for equality in the parser code,
  59. * so even if there is an overflow this should not give troubles
  60. * for parsing very large instances.
  61. */
  62. unsigned long consumed; /* How many xmlChars already consumed */
  63. xmlParserInputDeallocate free; /* function to deallocate the base */
  64. const xmlChar *encoding; /* the encoding string for entity */
  65. const xmlChar *version; /* the version string for entity */
  66. int standalone; /* Was that entity marked standalone */
  67. int id; /* an unique identifier for the entity */
  68. };
  69. /**
  70. * xmlParserNodeInfo:
  71. *
  72. * The parser can be asked to collect Node informations, i.e. at what
  73. * place in the file they were detected.
  74. * NOTE: This is off by default and not very well tested.
  75. */
  76. typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
  77. typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
  78. struct _xmlParserNodeInfo {
  79. const struct _xmlNode* node;
  80. /* Position & line # that text that created the node begins & ends on */
  81. unsigned long begin_pos;
  82. unsigned long begin_line;
  83. unsigned long end_pos;
  84. unsigned long end_line;
  85. };
  86. typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
  87. typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
  88. struct _xmlParserNodeInfoSeq {
  89. unsigned long maximum;
  90. unsigned long length;
  91. xmlParserNodeInfo* buffer;
  92. };
  93. /**
  94. * xmlParserInputState:
  95. *
  96. * The parser is now working also as a state based parser.
  97. * The recursive one use the state info for entities processing.
  98. */
  99. typedef enum {
  100. XML_PARSER_EOF = -1, /* nothing is to be parsed */
  101. XML_PARSER_START = 0, /* nothing has been parsed */
  102. XML_PARSER_MISC, /* Misc* before int subset */
  103. XML_PARSER_PI, /* Within a processing instruction */
  104. XML_PARSER_DTD, /* within some DTD content */
  105. XML_PARSER_PROLOG, /* Misc* after internal subset */
  106. XML_PARSER_COMMENT, /* within a comment */
  107. XML_PARSER_START_TAG, /* within a start tag */
  108. XML_PARSER_CONTENT, /* within the content */
  109. XML_PARSER_CDATA_SECTION, /* within a CDATA section */
  110. XML_PARSER_END_TAG, /* within a closing tag */
  111. XML_PARSER_ENTITY_DECL, /* within an entity declaration */
  112. XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
  113. XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
  114. XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
  115. XML_PARSER_EPILOG, /* the Misc* after the last end tag */
  116. XML_PARSER_IGNORE, /* within an IGNORED section */
  117. XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
  118. } xmlParserInputState;
  119. /**
  120. * XML_DETECT_IDS:
  121. *
  122. * Bit in the loadsubset context field to tell to do ID/REFs lookups.
  123. * Use it to initialize xmlLoadExtDtdDefaultValue.
  124. */
  125. #define XML_DETECT_IDS 2
  126. /**
  127. * XML_COMPLETE_ATTRS:
  128. *
  129. * Bit in the loadsubset context field to tell to do complete the
  130. * elements attributes lists with the ones defaulted from the DTDs.
  131. * Use it to initialize xmlLoadExtDtdDefaultValue.
  132. */
  133. #define XML_COMPLETE_ATTRS 4
  134. /**
  135. * XML_SKIP_IDS:
  136. *
  137. * Bit in the loadsubset context field to tell to not do ID/REFs registration.
  138. * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
  139. */
  140. #define XML_SKIP_IDS 8
  141. /**
  142. * xmlParserMode:
  143. *
  144. * A parser can operate in various modes
  145. */
  146. typedef enum {
  147. XML_PARSE_UNKNOWN = 0,
  148. XML_PARSE_DOM = 1,
  149. XML_PARSE_SAX = 2,
  150. XML_PARSE_PUSH_DOM = 3,
  151. XML_PARSE_PUSH_SAX = 4,
  152. XML_PARSE_READER = 5
  153. } xmlParserMode;
  154. /**
  155. * xmlParserCtxt:
  156. *
  157. * The parser context.
  158. * NOTE This doesn't completely define the parser state, the (current ?)
  159. * design of the parser uses recursive function calls since this allow
  160. * and easy mapping from the production rules of the specification
  161. * to the actual code. The drawback is that the actual function call
  162. * also reflect the parser state. However most of the parsing routines
  163. * takes as the only argument the parser context pointer, so migrating
  164. * to a state based parser for progressive parsing shouldn't be too hard.
  165. */
  166. struct _xmlParserCtxt {
  167. struct _xmlSAXHandler *sax; /* The SAX handler */
  168. void *userData; /* For SAX interface only, used by DOM build */
  169. xmlDocPtr myDoc; /* the document being built */
  170. int wellFormed; /* is the document well formed */
  171. int replaceEntities; /* shall we replace entities ? */
  172. const xmlChar *version; /* the XML version string */
  173. const xmlChar *encoding; /* the declared encoding, if any */
  174. int standalone; /* standalone document */
  175. int html; /* an HTML(1)/Docbook(2) document
  176. * 3 is HTML after <head>
  177. * 10 is HTML after <body>
  178. */
  179. /* Input stream stack */
  180. xmlParserInputPtr input; /* Current input stream */
  181. int inputNr; /* Number of current input streams */
  182. int inputMax; /* Max number of input streams */
  183. xmlParserInputPtr *inputTab; /* stack of inputs */
  184. /* Node analysis stack only used for DOM building */
  185. xmlNodePtr node; /* Current parsed Node */
  186. int nodeNr; /* Depth of the parsing stack */
  187. int nodeMax; /* Max depth of the parsing stack */
  188. xmlNodePtr *nodeTab; /* array of nodes */
  189. int record_info; /* Whether node info should be kept */
  190. xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
  191. int errNo; /* error code */
  192. int hasExternalSubset; /* reference and external subset */
  193. int hasPErefs; /* the internal subset has PE refs */
  194. int external; /* are we parsing an external entity */
  195. int valid; /* is the document valid */
  196. int validate; /* shall we try to validate ? */
  197. xmlValidCtxt vctxt; /* The validity context */
  198. xmlParserInputState instate; /* current type of input */
  199. int token; /* next char look-ahead */
  200. char *directory; /* the data directory */
  201. /* Node name stack */
  202. const xmlChar *name; /* Current parsed Node */
  203. int nameNr; /* Depth of the parsing stack */
  204. int nameMax; /* Max depth of the parsing stack */
  205. const xmlChar * *nameTab; /* array of nodes */
  206. long nbChars; /* number of xmlChar processed */
  207. long checkIndex; /* used by progressive parsing lookup */
  208. int keepBlanks; /* ugly but ... */
  209. int disableSAX; /* SAX callbacks are disabled */
  210. int inSubset; /* Parsing is in int 1/ext 2 subset */
  211. const xmlChar * intSubName; /* name of subset */
  212. xmlChar * extSubURI; /* URI of external subset */
  213. xmlChar * extSubSystem; /* SYSTEM ID of external subset */
  214. /* xml:space values */
  215. int * space; /* Should the parser preserve spaces */
  216. int spaceNr; /* Depth of the parsing stack */
  217. int spaceMax; /* Max depth of the parsing stack */
  218. int * spaceTab; /* array of space infos */
  219. int depth; /* to prevent entity substitution loops */
  220. xmlParserInputPtr entity; /* used to check entities boundaries */
  221. int charset; /* encoding of the in-memory content
  222. actually an xmlCharEncoding */
  223. int nodelen; /* Those two fields are there to */
  224. int nodemem; /* Speed up large node parsing */
  225. int pedantic; /* signal pedantic warnings */
  226. void *_private; /* For user data, libxml won't touch it */
  227. int loadsubset; /* should the external subset be loaded */
  228. int linenumbers; /* set line number in element content */
  229. void *catalogs; /* document's own catalog */
  230. int recovery; /* run in recovery mode */
  231. int progressive; /* is this a progressive parsing */
  232. xmlDictPtr dict; /* dictionary for the parser */
  233. const xmlChar * *atts; /* array for the attributes callbacks */
  234. int maxatts; /* the size of the array */
  235. int docdict; /* use strings from dict to build tree */
  236. /*
  237. * pre-interned strings
  238. */
  239. const xmlChar *str_xml;
  240. const xmlChar *str_xmlns;
  241. const xmlChar *str_xml_ns;
  242. /*
  243. * Everything below is used only by the new SAX mode
  244. */
  245. int sax2; /* operating in the new SAX mode */
  246. int nsNr; /* the number of inherited namespaces */
  247. int nsMax; /* the size of the arrays */
  248. const xmlChar * *nsTab; /* the array of prefix/namespace name */
  249. int *attallocs; /* which attribute were allocated */
  250. void * *pushTab; /* array of data for push */
  251. xmlHashTablePtr attsDefault; /* defaulted attributes if any */
  252. xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
  253. int nsWellFormed; /* is the document XML Nanespace okay */
  254. int options; /* Extra options */
  255. /*
  256. * Those fields are needed only for treaming parsing so far
  257. */
  258. int dictNames; /* Use dictionary names for the tree */
  259. int freeElemsNr; /* number of freed element nodes */
  260. xmlNodePtr freeElems; /* List of freed element nodes */
  261. int freeAttrsNr; /* number of freed attributes nodes */
  262. xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
  263. /*
  264. * the complete error informations for the last error.
  265. */
  266. xmlError lastError;
  267. xmlParserMode parseMode; /* the parser mode */
  268. unsigned long nbentities; /* number of entities references */
  269. unsigned long sizeentities; /* size of parsed entities */
  270. /* for use by HTML non-recursive parser */
  271. xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */
  272. int nodeInfoNr; /* Depth of the parsing stack */
  273. int nodeInfoMax; /* Max depth of the parsing stack */
  274. xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */
  275. int input_id; /* we need to label inputs */
  276. unsigned long sizeentcopy; /* volume of entity copy */
  277. };
  278. /**
  279. * xmlSAXLocator:
  280. *
  281. * A SAX Locator.
  282. */
  283. struct _xmlSAXLocator {
  284. const xmlChar *(*getPublicId)(void *ctx);
  285. const xmlChar *(*getSystemId)(void *ctx);
  286. int (*getLineNumber)(void *ctx);
  287. int (*getColumnNumber)(void *ctx);
  288. };
  289. /**
  290. * xmlSAXHandler:
  291. *
  292. * A SAX handler is bunch of callbacks called by the parser when processing
  293. * of the input generate data or structure informations.
  294. */
  295. /**
  296. * resolveEntitySAXFunc:
  297. * @ctx: the user data (XML parser context)
  298. * @publicId: The public ID of the entity
  299. * @systemId: The system ID of the entity
  300. *
  301. * Callback:
  302. * The entity loader, to control the loading of external entities,
  303. * the application can either:
  304. * - override this resolveEntity() callback in the SAX block
  305. * - or better use the xmlSetExternalEntityLoader() function to
  306. * set up it's own entity resolution routine
  307. *
  308. * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
  309. */
  310. typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
  311. const xmlChar *publicId,
  312. const xmlChar *systemId);
  313. /**
  314. * internalSubsetSAXFunc:
  315. * @ctx: the user data (XML parser context)
  316. * @name: the root element name
  317. * @ExternalID: the external ID
  318. * @SystemID: the SYSTEM ID (e.g. filename or URL)
  319. *
  320. * Callback on internal subset declaration.
  321. */
  322. typedef void (*internalSubsetSAXFunc) (void *ctx,
  323. const xmlChar *name,
  324. const xmlChar *ExternalID,
  325. const xmlChar *SystemID);
  326. /**
  327. * externalSubsetSAXFunc:
  328. * @ctx: the user data (XML parser context)
  329. * @name: the root element name
  330. * @ExternalID: the external ID
  331. * @SystemID: the SYSTEM ID (e.g. filename or URL)
  332. *
  333. * Callback on external subset declaration.
  334. */
  335. typedef void (*externalSubsetSAXFunc) (void *ctx,
  336. const xmlChar *name,
  337. const xmlChar *ExternalID,
  338. const xmlChar *SystemID);
  339. /**
  340. * getEntitySAXFunc:
  341. * @ctx: the user data (XML parser context)
  342. * @name: The entity name
  343. *
  344. * Get an entity by name.
  345. *
  346. * Returns the xmlEntityPtr if found.
  347. */
  348. typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
  349. const xmlChar *name);
  350. /**
  351. * getParameterEntitySAXFunc:
  352. * @ctx: the user data (XML parser context)
  353. * @name: The entity name
  354. *
  355. * Get a parameter entity by name.
  356. *
  357. * Returns the xmlEntityPtr if found.
  358. */
  359. typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
  360. const xmlChar *name);
  361. /**
  362. * entityDeclSAXFunc:
  363. * @ctx: the user data (XML parser context)
  364. * @name: the entity name
  365. * @type: the entity type
  366. * @publicId: The public ID of the entity
  367. * @systemId: The system ID of the entity
  368. * @content: the entity value (without processing).
  369. *
  370. * An entity definition has been parsed.
  371. */
  372. typedef void (*entityDeclSAXFunc) (void *ctx,
  373. const xmlChar *name,
  374. int type,
  375. const xmlChar *publicId,
  376. const xmlChar *systemId,
  377. xmlChar *content);
  378. /**
  379. * notationDeclSAXFunc:
  380. * @ctx: the user data (XML parser context)
  381. * @name: The name of the notation
  382. * @publicId: The public ID of the entity
  383. * @systemId: The system ID of the entity
  384. *
  385. * What to do when a notation declaration has been parsed.
  386. */
  387. typedef void (*notationDeclSAXFunc)(void *ctx,
  388. const xmlChar *name,
  389. const xmlChar *publicId,
  390. const xmlChar *systemId);
  391. /**
  392. * attributeDeclSAXFunc:
  393. * @ctx: the user data (XML parser context)
  394. * @elem: the name of the element
  395. * @fullname: the attribute name
  396. * @type: the attribute type
  397. * @def: the type of default value
  398. * @defaultValue: the attribute default value
  399. * @tree: the tree of enumerated value set
  400. *
  401. * An attribute definition has been parsed.
  402. */
  403. typedef void (*attributeDeclSAXFunc)(void *ctx,
  404. const xmlChar *elem,
  405. const xmlChar *fullname,
  406. int type,
  407. int def,
  408. const xmlChar *defaultValue,
  409. xmlEnumerationPtr tree);
  410. /**
  411. * elementDeclSAXFunc:
  412. * @ctx: the user data (XML parser context)
  413. * @name: the element name
  414. * @type: the element type
  415. * @content: the element value tree
  416. *
  417. * An element definition has been parsed.
  418. */
  419. typedef void (*elementDeclSAXFunc)(void *ctx,
  420. const xmlChar *name,
  421. int type,
  422. xmlElementContentPtr content);
  423. /**
  424. * unparsedEntityDeclSAXFunc:
  425. * @ctx: the user data (XML parser context)
  426. * @name: The name of the entity
  427. * @publicId: The public ID of the entity
  428. * @systemId: The system ID of the entity
  429. * @notationName: the name of the notation
  430. *
  431. * What to do when an unparsed entity declaration is parsed.
  432. */
  433. typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
  434. const xmlChar *name,
  435. const xmlChar *publicId,
  436. const xmlChar *systemId,
  437. const xmlChar *notationName);
  438. /**
  439. * setDocumentLocatorSAXFunc:
  440. * @ctx: the user data (XML parser context)
  441. * @loc: A SAX Locator
  442. *
  443. * Receive the document locator at startup, actually xmlDefaultSAXLocator.
  444. * Everything is available on the context, so this is useless in our case.
  445. */
  446. typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
  447. xmlSAXLocatorPtr loc);
  448. /**
  449. * startDocumentSAXFunc:
  450. * @ctx: the user data (XML parser context)
  451. *
  452. * Called when the document start being processed.
  453. */
  454. typedef void (*startDocumentSAXFunc) (void *ctx);
  455. /**
  456. * endDocumentSAXFunc:
  457. * @ctx: the user data (XML parser context)
  458. *
  459. * Called when the document end has been detected.
  460. */
  461. typedef void (*endDocumentSAXFunc) (void *ctx);
  462. /**
  463. * startElementSAXFunc:
  464. * @ctx: the user data (XML parser context)
  465. * @name: The element name, including namespace prefix
  466. * @atts: An array of name/value attributes pairs, NULL terminated
  467. *
  468. * Called when an opening tag has been processed.
  469. */
  470. typedef void (*startElementSAXFunc) (void *ctx,
  471. const xmlChar *name,
  472. const xmlChar **atts);
  473. /**
  474. * endElementSAXFunc:
  475. * @ctx: the user data (XML parser context)
  476. * @name: The element name
  477. *
  478. * Called when the end of an element has been detected.
  479. */
  480. typedef void (*endElementSAXFunc) (void *ctx,
  481. const xmlChar *name);
  482. /**
  483. * attributeSAXFunc:
  484. * @ctx: the user data (XML parser context)
  485. * @name: The attribute name, including namespace prefix
  486. * @value: The attribute value
  487. *
  488. * Handle an attribute that has been read by the parser.
  489. * The default handling is to convert the attribute into an
  490. * DOM subtree and past it in a new xmlAttr element added to
  491. * the element.
  492. */
  493. typedef void (*attributeSAXFunc) (void *ctx,
  494. const xmlChar *name,
  495. const xmlChar *value);
  496. /**
  497. * referenceSAXFunc:
  498. * @ctx: the user data (XML parser context)
  499. * @name: The entity name
  500. *
  501. * Called when an entity reference is detected.
  502. */
  503. typedef void (*referenceSAXFunc) (void *ctx,
  504. const xmlChar *name);
  505. /**
  506. * charactersSAXFunc:
  507. * @ctx: the user data (XML parser context)
  508. * @ch: a xmlChar string
  509. * @len: the number of xmlChar
  510. *
  511. * Receiving some chars from the parser.
  512. */
  513. typedef void (*charactersSAXFunc) (void *ctx,
  514. const xmlChar *ch,
  515. int len);
  516. /**
  517. * ignorableWhitespaceSAXFunc:
  518. * @ctx: the user data (XML parser context)
  519. * @ch: a xmlChar string
  520. * @len: the number of xmlChar
  521. *
  522. * Receiving some ignorable whitespaces from the parser.
  523. * UNUSED: by default the DOM building will use characters.
  524. */
  525. typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
  526. const xmlChar *ch,
  527. int len);
  528. /**
  529. * processingInstructionSAXFunc:
  530. * @ctx: the user data (XML parser context)
  531. * @target: the target name
  532. * @data: the PI data's
  533. *
  534. * A processing instruction has been parsed.
  535. */
  536. typedef void (*processingInstructionSAXFunc) (void *ctx,
  537. const xmlChar *target,
  538. const xmlChar *data);
  539. /**
  540. * commentSAXFunc:
  541. * @ctx: the user data (XML parser context)
  542. * @value: the comment content
  543. *
  544. * A comment has been parsed.
  545. */
  546. typedef void (*commentSAXFunc) (void *ctx,
  547. const xmlChar *value);
  548. /**
  549. * cdataBlockSAXFunc:
  550. * @ctx: the user data (XML parser context)
  551. * @value: The pcdata content
  552. * @len: the block length
  553. *
  554. * Called when a pcdata block has been parsed.
  555. */
  556. typedef void (*cdataBlockSAXFunc) (
  557. void *ctx,
  558. const xmlChar *value,
  559. int len);
  560. /**
  561. * warningSAXFunc:
  562. * @ctx: an XML parser context
  563. * @msg: the message to display/transmit
  564. * @...: extra parameters for the message display
  565. *
  566. * Display and format a warning messages, callback.
  567. */
  568. typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
  569. const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
  570. /**
  571. * errorSAXFunc:
  572. * @ctx: an XML parser context
  573. * @msg: the message to display/transmit
  574. * @...: extra parameters for the message display
  575. *
  576. * Display and format an error messages, callback.
  577. */
  578. typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
  579. const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
  580. /**
  581. * fatalErrorSAXFunc:
  582. * @ctx: an XML parser context
  583. * @msg: the message to display/transmit
  584. * @...: extra parameters for the message display
  585. *
  586. * Display and format fatal error messages, callback.
  587. * Note: so far fatalError() SAX callbacks are not used, error()
  588. * get all the callbacks for errors.
  589. */
  590. typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
  591. const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
  592. /**
  593. * isStandaloneSAXFunc:
  594. * @ctx: the user data (XML parser context)
  595. *
  596. * Is this document tagged standalone?
  597. *
  598. * Returns 1 if true
  599. */
  600. typedef int (*isStandaloneSAXFunc) (void *ctx);
  601. /**
  602. * hasInternalSubsetSAXFunc:
  603. * @ctx: the user data (XML parser context)
  604. *
  605. * Does this document has an internal subset.
  606. *
  607. * Returns 1 if true
  608. */
  609. typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
  610. /**
  611. * hasExternalSubsetSAXFunc:
  612. * @ctx: the user data (XML parser context)
  613. *
  614. * Does this document has an external subset?
  615. *
  616. * Returns 1 if true
  617. */
  618. typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
  619. /************************************************************************
  620. * *
  621. * The SAX version 2 API extensions *
  622. * *
  623. ************************************************************************/
  624. /**
  625. * XML_SAX2_MAGIC:
  626. *
  627. * Special constant found in SAX2 blocks initialized fields
  628. */
  629. #define XML_SAX2_MAGIC 0xDEEDBEAF
  630. /**
  631. * startElementNsSAX2Func:
  632. * @ctx: the user data (XML parser context)
  633. * @localname: the local name of the element
  634. * @prefix: the element namespace prefix if available
  635. * @URI: the element namespace name if available
  636. * @nb_namespaces: number of namespace definitions on that node
  637. * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
  638. * @nb_attributes: the number of attributes on that node
  639. * @nb_defaulted: the number of defaulted attributes. The defaulted
  640. * ones are at the end of the array
  641. * @attributes: pointer to the array of (localname/prefix/URI/value/end)
  642. * attribute values.
  643. *
  644. * SAX2 callback when an element start has been detected by the parser.
  645. * It provides the namespace informations for the element, as well as
  646. * the new namespace declarations on the element.
  647. */
  648. typedef void (*startElementNsSAX2Func) (void *ctx,
  649. const xmlChar *localname,
  650. const xmlChar *prefix,
  651. const xmlChar *URI,
  652. int nb_namespaces,
  653. const xmlChar **namespaces,
  654. int nb_attributes,
  655. int nb_defaulted,
  656. const xmlChar **attributes);
  657. /**
  658. * endElementNsSAX2Func:
  659. * @ctx: the user data (XML parser context)
  660. * @localname: the local name of the element
  661. * @prefix: the element namespace prefix if available
  662. * @URI: the element namespace name if available
  663. *
  664. * SAX2 callback when an element end has been detected by the parser.
  665. * It provides the namespace informations for the element.
  666. */
  667. typedef void (*endElementNsSAX2Func) (void *ctx,
  668. const xmlChar *localname,
  669. const xmlChar *prefix,
  670. const xmlChar *URI);
  671. struct _xmlSAXHandler {
  672. internalSubsetSAXFunc internalSubset;
  673. isStandaloneSAXFunc isStandalone;
  674. hasInternalSubsetSAXFunc hasInternalSubset;
  675. hasExternalSubsetSAXFunc hasExternalSubset;
  676. resolveEntitySAXFunc resolveEntity;
  677. getEntitySAXFunc getEntity;
  678. entityDeclSAXFunc entityDecl;
  679. notationDeclSAXFunc notationDecl;
  680. attributeDeclSAXFunc attributeDecl;
  681. elementDeclSAXFunc elementDecl;
  682. unparsedEntityDeclSAXFunc unparsedEntityDecl;
  683. setDocumentLocatorSAXFunc setDocumentLocator;
  684. startDocumentSAXFunc startDocument;
  685. endDocumentSAXFunc endDocument;
  686. startElementSAXFunc startElement;
  687. endElementSAXFunc endElement;
  688. referenceSAXFunc reference;
  689. charactersSAXFunc characters;
  690. ignorableWhitespaceSAXFunc ignorableWhitespace;
  691. processingInstructionSAXFunc processingInstruction;
  692. commentSAXFunc comment;
  693. warningSAXFunc warning;
  694. errorSAXFunc error;
  695. fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
  696. getParameterEntitySAXFunc getParameterEntity;
  697. cdataBlockSAXFunc cdataBlock;
  698. externalSubsetSAXFunc externalSubset;
  699. unsigned int initialized;
  700. /* The following fields are extensions available only on version 2 */
  701. void *_private;
  702. startElementNsSAX2Func startElementNs;
  703. endElementNsSAX2Func endElementNs;
  704. xmlStructuredErrorFunc serror;
  705. };
  706. /*
  707. * SAX Version 1
  708. */
  709. typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
  710. typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
  711. struct _xmlSAXHandlerV1 {
  712. internalSubsetSAXFunc internalSubset;
  713. isStandaloneSAXFunc isStandalone;
  714. hasInternalSubsetSAXFunc hasInternalSubset;
  715. hasExternalSubsetSAXFunc hasExternalSubset;
  716. resolveEntitySAXFunc resolveEntity;
  717. getEntitySAXFunc getEntity;
  718. entityDeclSAXFunc entityDecl;
  719. notationDeclSAXFunc notationDecl;
  720. attributeDeclSAXFunc attributeDecl;
  721. elementDeclSAXFunc elementDecl;
  722. unparsedEntityDeclSAXFunc unparsedEntityDecl;
  723. setDocumentLocatorSAXFunc setDocumentLocator;
  724. startDocumentSAXFunc startDocument;
  725. endDocumentSAXFunc endDocument;
  726. startElementSAXFunc startElement;
  727. endElementSAXFunc endElement;
  728. referenceSAXFunc reference;
  729. charactersSAXFunc characters;
  730. ignorableWhitespaceSAXFunc ignorableWhitespace;
  731. processingInstructionSAXFunc processingInstruction;
  732. commentSAXFunc comment;
  733. warningSAXFunc warning;
  734. errorSAXFunc error;
  735. fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
  736. getParameterEntitySAXFunc getParameterEntity;
  737. cdataBlockSAXFunc cdataBlock;
  738. externalSubsetSAXFunc externalSubset;
  739. unsigned int initialized;
  740. };
  741. /**
  742. * xmlExternalEntityLoader:
  743. * @URL: The System ID of the resource requested
  744. * @ID: The Public ID of the resource requested
  745. * @context: the XML parser context
  746. *
  747. * External entity loaders types.
  748. *
  749. * Returns the entity input parser.
  750. */
  751. typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
  752. const char *ID,
  753. xmlParserCtxtPtr context);
  754. #ifdef __cplusplus
  755. }
  756. #endif
  757. #include <libxml/encoding.h>
  758. #include <libxml/xmlIO.h>
  759. #include <libxml/globals.h>
  760. #ifdef __cplusplus
  761. extern "C" {
  762. #endif
  763. /*
  764. * Init/Cleanup
  765. */
  766. XMLPUBFUN void XMLCALL
  767. xmlInitParser (void);
  768. XMLPUBFUN void XMLCALL
  769. xmlCleanupParser (void);
  770. /*
  771. * Input functions
  772. */
  773. XMLPUBFUN int XMLCALL
  774. xmlParserInputRead (xmlParserInputPtr in,
  775. int len);
  776. XMLPUBFUN int XMLCALL
  777. xmlParserInputGrow (xmlParserInputPtr in,
  778. int len);
  779. /*
  780. * Basic parsing Interfaces
  781. */
  782. #ifdef LIBXML_SAX1_ENABLED
  783. XMLPUBFUN xmlDocPtr XMLCALL
  784. xmlParseDoc (const xmlChar *cur);
  785. XMLPUBFUN xmlDocPtr XMLCALL
  786. xmlParseFile (const char *filename);
  787. XMLPUBFUN xmlDocPtr XMLCALL
  788. xmlParseMemory (const char *buffer,
  789. int size);
  790. #endif /* LIBXML_SAX1_ENABLED */
  791. XMLPUBFUN int XMLCALL
  792. xmlSubstituteEntitiesDefault(int val);
  793. XMLPUBFUN int XMLCALL
  794. xmlKeepBlanksDefault (int val);
  795. XMLPUBFUN void XMLCALL
  796. xmlStopParser (xmlParserCtxtPtr ctxt);
  797. XMLPUBFUN int XMLCALL
  798. xmlPedanticParserDefault(int val);
  799. XMLPUBFUN int XMLCALL
  800. xmlLineNumbersDefault (int val);
  801. #ifdef LIBXML_SAX1_ENABLED
  802. /*
  803. * Recovery mode
  804. */
  805. XMLPUBFUN xmlDocPtr XMLCALL
  806. xmlRecoverDoc (const xmlChar *cur);
  807. XMLPUBFUN xmlDocPtr XMLCALL
  808. xmlRecoverMemory (const char *buffer,
  809. int size);
  810. XMLPUBFUN xmlDocPtr XMLCALL
  811. xmlRecoverFile (const char *filename);
  812. #endif /* LIBXML_SAX1_ENABLED */
  813. /*
  814. * Less common routines and SAX interfaces
  815. */
  816. XMLPUBFUN int XMLCALL
  817. xmlParseDocument (xmlParserCtxtPtr ctxt);
  818. XMLPUBFUN int XMLCALL
  819. xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
  820. #ifdef LIBXML_SAX1_ENABLED
  821. XMLPUBFUN int XMLCALL
  822. xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
  823. void *user_data,
  824. const char *filename);
  825. XMLPUBFUN int XMLCALL
  826. xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
  827. void *user_data,
  828. const char *buffer,
  829. int size);
  830. XMLPUBFUN xmlDocPtr XMLCALL
  831. xmlSAXParseDoc (xmlSAXHandlerPtr sax,
  832. const xmlChar *cur,
  833. int recovery);
  834. XMLPUBFUN xmlDocPtr XMLCALL
  835. xmlSAXParseMemory (xmlSAXHandlerPtr sax,
  836. const char *buffer,
  837. int size,
  838. int recovery);
  839. XMLPUBFUN xmlDocPtr XMLCALL
  840. xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
  841. const char *buffer,
  842. int size,
  843. int recovery,
  844. void *data);
  845. XMLPUBFUN xmlDocPtr XMLCALL
  846. xmlSAXParseFile (xmlSAXHandlerPtr sax,
  847. const char *filename,
  848. int recovery);
  849. XMLPUBFUN xmlDocPtr XMLCALL
  850. xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
  851. const char *filename,
  852. int recovery,
  853. void *data);
  854. XMLPUBFUN xmlDocPtr XMLCALL
  855. xmlSAXParseEntity (xmlSAXHandlerPtr sax,
  856. const char *filename);
  857. XMLPUBFUN xmlDocPtr XMLCALL
  858. xmlParseEntity (const char *filename);
  859. #endif /* LIBXML_SAX1_ENABLED */
  860. #ifdef LIBXML_VALID_ENABLED
  861. XMLPUBFUN xmlDtdPtr XMLCALL
  862. xmlSAXParseDTD (xmlSAXHandlerPtr sax,
  863. const xmlChar *ExternalID,
  864. const xmlChar *SystemID);
  865. XMLPUBFUN xmlDtdPtr XMLCALL
  866. xmlParseDTD (const xmlChar *ExternalID,
  867. const xmlChar *SystemID);
  868. XMLPUBFUN xmlDtdPtr XMLCALL
  869. xmlIOParseDTD (xmlSAXHandlerPtr sax,
  870. xmlParserInputBufferPtr input,
  871. xmlCharEncoding enc);
  872. #endif /* LIBXML_VALID_ENABLE */
  873. #ifdef LIBXML_SAX1_ENABLED
  874. XMLPUBFUN int XMLCALL
  875. xmlParseBalancedChunkMemory(xmlDocPtr doc,
  876. xmlSAXHandlerPtr sax,
  877. void *user_data,
  878. int depth,
  879. const xmlChar *string,
  880. xmlNodePtr *lst);
  881. #endif /* LIBXML_SAX1_ENABLED */
  882. XMLPUBFUN xmlParserErrors XMLCALL
  883. xmlParseInNodeContext (xmlNodePtr node,
  884. const char *data,
  885. int datalen,
  886. int options,
  887. xmlNodePtr *lst);
  888. #ifdef LIBXML_SAX1_ENABLED
  889. XMLPUBFUN int XMLCALL
  890. xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
  891. xmlSAXHandlerPtr sax,
  892. void *user_data,
  893. int depth,
  894. const xmlChar *string,
  895. xmlNodePtr *lst,
  896. int recover);
  897. XMLPUBFUN int XMLCALL
  898. xmlParseExternalEntity (xmlDocPtr doc,
  899. xmlSAXHandlerPtr sax,
  900. void *user_data,
  901. int depth,
  902. const xmlChar *URL,
  903. const xmlChar *ID,
  904. xmlNodePtr *lst);
  905. #endif /* LIBXML_SAX1_ENABLED */
  906. XMLPUBFUN int XMLCALL
  907. xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
  908. const xmlChar *URL,
  909. const xmlChar *ID,
  910. xmlNodePtr *lst);
  911. /*
  912. * Parser contexts handling.
  913. */
  914. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  915. xmlNewParserCtxt (void);
  916. XMLPUBFUN int XMLCALL
  917. xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
  918. XMLPUBFUN void XMLCALL
  919. xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
  920. XMLPUBFUN void XMLCALL
  921. xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
  922. #ifdef LIBXML_SAX1_ENABLED
  923. XMLPUBFUN void XMLCALL
  924. xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
  925. const xmlChar* buffer,
  926. const char *filename);
  927. #endif /* LIBXML_SAX1_ENABLED */
  928. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  929. xmlCreateDocParserCtxt (const xmlChar *cur);
  930. #ifdef LIBXML_LEGACY_ENABLED
  931. /*
  932. * Reading/setting optional parsing features.
  933. */
  934. XMLPUBFUN int XMLCALL
  935. xmlGetFeaturesList (int *len,
  936. const char **result);
  937. XMLPUBFUN int XMLCALL
  938. xmlGetFeature (xmlParserCtxtPtr ctxt,
  939. const char *name,
  940. void *result);
  941. XMLPUBFUN int XMLCALL
  942. xmlSetFeature (xmlParserCtxtPtr ctxt,
  943. const char *name,
  944. void *value);
  945. #endif /* LIBXML_LEGACY_ENABLED */
  946. #ifdef LIBXML_PUSH_ENABLED
  947. /*
  948. * Interfaces for the Push mode.
  949. */
  950. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  951. xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
  952. void *user_data,
  953. const char *chunk,
  954. int size,
  955. const char *filename);
  956. XMLPUBFUN int XMLCALL
  957. xmlParseChunk (xmlParserCtxtPtr ctxt,
  958. const char *chunk,
  959. int size,
  960. int terminate);
  961. #endif /* LIBXML_PUSH_ENABLED */
  962. /*
  963. * Special I/O mode.
  964. */
  965. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  966. xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
  967. void *user_data,
  968. xmlInputReadCallback ioread,
  969. xmlInputCloseCallback ioclose,
  970. void *ioctx,
  971. xmlCharEncoding enc);
  972. XMLPUBFUN xmlParserInputPtr XMLCALL
  973. xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
  974. xmlParserInputBufferPtr input,
  975. xmlCharEncoding enc);
  976. /*
  977. * Node infos.
  978. */
  979. XMLPUBFUN const xmlParserNodeInfo* XMLCALL
  980. xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
  981. const xmlNodePtr node);
  982. XMLPUBFUN void XMLCALL
  983. xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
  984. XMLPUBFUN void XMLCALL
  985. xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
  986. XMLPUBFUN unsigned long XMLCALL
  987. xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
  988. const xmlNodePtr node);
  989. XMLPUBFUN void XMLCALL
  990. xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
  991. const xmlParserNodeInfoPtr info);
  992. /*
  993. * External entities handling actually implemented in xmlIO.
  994. */
  995. XMLPUBFUN void XMLCALL
  996. xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
  997. XMLPUBFUN xmlExternalEntityLoader XMLCALL
  998. xmlGetExternalEntityLoader(void);
  999. XMLPUBFUN xmlParserInputPtr XMLCALL
  1000. xmlLoadExternalEntity (const char *URL,
  1001. const char *ID,
  1002. xmlParserCtxtPtr ctxt);
  1003. /*
  1004. * Index lookup, actually implemented in the encoding module
  1005. */
  1006. XMLPUBFUN long XMLCALL
  1007. xmlByteConsumed (xmlParserCtxtPtr ctxt);
  1008. /*
  1009. * New set of simpler/more flexible APIs
  1010. */
  1011. /**
  1012. * xmlParserOption:
  1013. *
  1014. * This is the set of XML parser options that can be passed down
  1015. * to the xmlReadDoc() and similar calls.
  1016. */
  1017. typedef enum {
  1018. XML_PARSE_RECOVER = 1<<0, /* recover on errors */
  1019. XML_PARSE_NOENT = 1<<1, /* substitute entities */
  1020. XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */
  1021. XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */
  1022. XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
  1023. XML_PARSE_NOERROR = 1<<5, /* suppress error reports */
  1024. XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
  1025. XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
  1026. XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
  1027. XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
  1028. XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */
  1029. XML_PARSE_NONET = 1<<11,/* Forbid network access */
  1030. XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
  1031. XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
  1032. XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
  1033. XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
  1034. XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of
  1035. the tree allowed afterwards (will possibly
  1036. crash if you try to modify the tree) */
  1037. XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
  1038. XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
  1039. XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
  1040. XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
  1041. XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
  1042. XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
  1043. } xmlParserOption;
  1044. XMLPUBFUN void XMLCALL
  1045. xmlCtxtReset (xmlParserCtxtPtr ctxt);
  1046. XMLPUBFUN int XMLCALL
  1047. xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
  1048. const char *chunk,
  1049. int size,
  1050. const char *filename,
  1051. const char *encoding);
  1052. XMLPUBFUN int XMLCALL
  1053. xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
  1054. int options);
  1055. XMLPUBFUN xmlDocPtr XMLCALL
  1056. xmlReadDoc (const xmlChar *cur,
  1057. const char *URL,
  1058. const char *encoding,
  1059. int options);
  1060. XMLPUBFUN xmlDocPtr XMLCALL
  1061. xmlReadFile (const char *URL,
  1062. const char *encoding,
  1063. int options);
  1064. XMLPUBFUN xmlDocPtr XMLCALL
  1065. xmlReadMemory (const char *buffer,
  1066. int size,
  1067. const char *URL,
  1068. const char *encoding,
  1069. int options);
  1070. XMLPUBFUN xmlDocPtr XMLCALL
  1071. xmlReadFd (int fd,
  1072. const char *URL,
  1073. const char *encoding,
  1074. int options);
  1075. XMLPUBFUN xmlDocPtr XMLCALL
  1076. xmlReadIO (xmlInputReadCallback ioread,
  1077. xmlInputCloseCallback ioclose,
  1078. void *ioctx,
  1079. const char *URL,
  1080. const char *encoding,
  1081. int options);
  1082. XMLPUBFUN xmlDocPtr XMLCALL
  1083. xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
  1084. const xmlChar *cur,
  1085. const char *URL,
  1086. const char *encoding,
  1087. int options);
  1088. XMLPUBFUN xmlDocPtr XMLCALL
  1089. xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
  1090. const char *filename,
  1091. const char *encoding,
  1092. int options);
  1093. XMLPUBFUN xmlDocPtr XMLCALL
  1094. xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
  1095. const char *buffer,
  1096. int size,
  1097. const char *URL,
  1098. const char *encoding,
  1099. int options);
  1100. XMLPUBFUN xmlDocPtr XMLCALL
  1101. xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
  1102. int fd,
  1103. const char *URL,
  1104. const char *encoding,
  1105. int options);
  1106. XMLPUBFUN xmlDocPtr XMLCALL
  1107. xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
  1108. xmlInputReadCallback ioread,
  1109. xmlInputCloseCallback ioclose,
  1110. void *ioctx,
  1111. const char *URL,
  1112. const char *encoding,
  1113. int options);
  1114. /*
  1115. * Library wide options
  1116. */
  1117. /**
  1118. * xmlFeature:
  1119. *
  1120. * Used to examine the existance of features that can be enabled
  1121. * or disabled at compile-time.
  1122. * They used to be called XML_FEATURE_xxx but this clashed with Expat
  1123. */
  1124. typedef enum {
  1125. XML_WITH_THREAD = 1,
  1126. XML_WITH_TREE = 2,
  1127. XML_WITH_OUTPUT = 3,
  1128. XML_WITH_PUSH = 4,
  1129. XML_WITH_READER = 5,
  1130. XML_WITH_PATTERN = 6,
  1131. XML_WITH_WRITER = 7,
  1132. XML_WITH_SAX1 = 8,
  1133. XML_WITH_FTP = 9,
  1134. XML_WITH_HTTP = 10,
  1135. XML_WITH_VALID = 11,
  1136. XML_WITH_HTML = 12,
  1137. XML_WITH_LEGACY = 13,
  1138. XML_WITH_C14N = 14,
  1139. XML_WITH_CATALOG = 15,
  1140. XML_WITH_XPATH = 16,
  1141. XML_WITH_XPTR = 17,
  1142. XML_WITH_XINCLUDE = 18,
  1143. XML_WITH_ICONV = 19,
  1144. XML_WITH_ISO8859X = 20,
  1145. XML_WITH_UNICODE = 21,
  1146. XML_WITH_REGEXP = 22,
  1147. XML_WITH_AUTOMATA = 23,
  1148. XML_WITH_EXPR = 24,
  1149. XML_WITH_SCHEMAS = 25,
  1150. XML_WITH_SCHEMATRON = 26,
  1151. XML_WITH_MODULES = 27,
  1152. XML_WITH_DEBUG = 28,
  1153. XML_WITH_DEBUG_MEM = 29,
  1154. XML_WITH_DEBUG_RUN = 30,
  1155. XML_WITH_ZLIB = 31,
  1156. XML_WITH_ICU = 32,
  1157. XML_WITH_LZMA = 33,
  1158. XML_WITH_NONE = 99999 /* just to be sure of allocation size */
  1159. } xmlFeature;
  1160. XMLPUBFUN int XMLCALL
  1161. xmlHasFeature (xmlFeature feature);
  1162. #ifdef __cplusplus
  1163. }
  1164. #endif
  1165. #endif /* __XML_PARSER_H__ */