parser.h 39 KB

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