parser.h 39 KB

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