libxmlparser.inc 46 KB

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