parser.h 39 KB

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