parser.h 41 KB

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