parser.h 38 KB

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