parserInternals.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. /*
  2. * Summary: internals routines and limits exported by the parser.
  3. * Description: this module exports a number of internal parsing routines
  4. * they are not really all intended for applications but
  5. * can prove useful doing low level processing.
  6. *
  7. * Copy: See Copyright for the status of this software.
  8. *
  9. * Author: Daniel Veillard
  10. */
  11. #ifndef __XML_PARSER_INTERNALS_H__
  12. #define __XML_PARSER_INTERNALS_H__
  13. #include <libxml/xmlversion.h>
  14. #include <libxml/parser.h>
  15. #include <libxml/HTMLparser.h>
  16. #include <libxml/chvalid.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /**
  21. * xmlParserMaxDepth:
  22. *
  23. * arbitrary depth limit for the XML documents that we allow to
  24. * process. This is not a limitation of the parser but a safety
  25. * boundary feature, use XML_PARSE_HUGE option to override it.
  26. */
  27. XMLPUBVAR unsigned int xmlParserMaxDepth;
  28. /**
  29. * XML_MAX_TEXT_LENGTH:
  30. *
  31. * Maximum size allowed for a single text node when building a tree.
  32. * This is not a limitation of the parser but a safety boundary feature,
  33. * use XML_PARSE_HUGE option to override it.
  34. * Introduced in 2.9.0
  35. */
  36. #define XML_MAX_TEXT_LENGTH 10000000
  37. /**
  38. * XML_MAX_NAME_LENGTH:
  39. *
  40. * Maximum size allowed for a markup identifier.
  41. * This is not a limitation of the parser but a safety boundary feature,
  42. * use XML_PARSE_HUGE option to override it.
  43. * Note that with the use of parsing dictionaries overriding the limit
  44. * may result in more runtime memory usage in face of "unfriendly' content
  45. * Introduced in 2.9.0
  46. */
  47. #define XML_MAX_NAME_LENGTH 50000
  48. /**
  49. * XML_MAX_DICTIONARY_LIMIT:
  50. *
  51. * Maximum size allowed by the parser for a dictionary by default
  52. * This is not a limitation of the parser but a safety boundary feature,
  53. * use XML_PARSE_HUGE option to override it.
  54. * Introduced in 2.9.0
  55. */
  56. #define XML_MAX_DICTIONARY_LIMIT 10000000
  57. /**
  58. * XML_MAX_LOOKUP_LIMIT:
  59. *
  60. * Maximum size allowed by the parser for ahead lookup
  61. * This is an upper boundary enforced by the parser to avoid bad
  62. * behaviour on "unfriendly' content
  63. * Introduced in 2.9.0
  64. */
  65. #define XML_MAX_LOOKUP_LIMIT 10000000
  66. /**
  67. * XML_MAX_NAMELEN:
  68. *
  69. * Identifiers can be longer, but this will be more costly
  70. * at runtime.
  71. */
  72. #define XML_MAX_NAMELEN 100
  73. /**
  74. * INPUT_CHUNK:
  75. *
  76. * The parser tries to always have that amount of input ready.
  77. * One of the point is providing context when reporting errors.
  78. */
  79. #define INPUT_CHUNK 250
  80. /************************************************************************
  81. * *
  82. * UNICODE version of the macros. *
  83. * *
  84. ************************************************************************/
  85. /**
  86. * IS_BYTE_CHAR:
  87. * @c: an byte value (int)
  88. *
  89. * Macro to check the following production in the XML spec:
  90. *
  91. * [2] Char ::= #x9 | #xA | #xD | [#x20...]
  92. * any byte character in the accepted range
  93. */
  94. #define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
  95. /**
  96. * IS_CHAR:
  97. * @c: an UNICODE value (int)
  98. *
  99. * Macro to check the following production in the XML spec:
  100. *
  101. * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
  102. * | [#x10000-#x10FFFF]
  103. * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
  104. */
  105. #define IS_CHAR(c) xmlIsCharQ(c)
  106. /**
  107. * IS_CHAR_CH:
  108. * @c: an xmlChar (usually an unsigned char)
  109. *
  110. * Behaves like IS_CHAR on single-byte value
  111. */
  112. #define IS_CHAR_CH(c) xmlIsChar_ch(c)
  113. /**
  114. * IS_BLANK:
  115. * @c: an UNICODE value (int)
  116. *
  117. * Macro to check the following production in the XML spec:
  118. *
  119. * [3] S ::= (#x20 | #x9 | #xD | #xA)+
  120. */
  121. #define IS_BLANK(c) xmlIsBlankQ(c)
  122. /**
  123. * IS_BLANK_CH:
  124. * @c: an xmlChar value (normally unsigned char)
  125. *
  126. * Behaviour same as IS_BLANK
  127. */
  128. #define IS_BLANK_CH(c) xmlIsBlank_ch(c)
  129. /**
  130. * IS_BASECHAR:
  131. * @c: an UNICODE value (int)
  132. *
  133. * Macro to check the following production in the XML spec:
  134. *
  135. * [85] BaseChar ::= ... long list see REC ...
  136. */
  137. #define IS_BASECHAR(c) xmlIsBaseCharQ(c)
  138. /**
  139. * IS_DIGIT:
  140. * @c: an UNICODE value (int)
  141. *
  142. * Macro to check the following production in the XML spec:
  143. *
  144. * [88] Digit ::= ... long list see REC ...
  145. */
  146. #define IS_DIGIT(c) xmlIsDigitQ(c)
  147. /**
  148. * IS_DIGIT_CH:
  149. * @c: an xmlChar value (usually an unsigned char)
  150. *
  151. * Behaves like IS_DIGIT but with a single byte argument
  152. */
  153. #define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
  154. /**
  155. * IS_COMBINING:
  156. * @c: an UNICODE value (int)
  157. *
  158. * Macro to check the following production in the XML spec:
  159. *
  160. * [87] CombiningChar ::= ... long list see REC ...
  161. */
  162. #define IS_COMBINING(c) xmlIsCombiningQ(c)
  163. /**
  164. * IS_COMBINING_CH:
  165. * @c: an xmlChar (usually an unsigned char)
  166. *
  167. * Always false (all combining chars > 0xff)
  168. */
  169. #define IS_COMBINING_CH(c) 0
  170. /**
  171. * IS_EXTENDER:
  172. * @c: an UNICODE value (int)
  173. *
  174. * Macro to check the following production in the XML spec:
  175. *
  176. *
  177. * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
  178. * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
  179. * [#x309D-#x309E] | [#x30FC-#x30FE]
  180. */
  181. #define IS_EXTENDER(c) xmlIsExtenderQ(c)
  182. /**
  183. * IS_EXTENDER_CH:
  184. * @c: an xmlChar value (usually an unsigned char)
  185. *
  186. * Behaves like IS_EXTENDER but with a single-byte argument
  187. */
  188. #define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
  189. /**
  190. * IS_IDEOGRAPHIC:
  191. * @c: an UNICODE value (int)
  192. *
  193. * Macro to check the following production in the XML spec:
  194. *
  195. *
  196. * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
  197. */
  198. #define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
  199. /**
  200. * IS_LETTER:
  201. * @c: an UNICODE value (int)
  202. *
  203. * Macro to check the following production in the XML spec:
  204. *
  205. *
  206. * [84] Letter ::= BaseChar | Ideographic
  207. */
  208. #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
  209. /**
  210. * IS_LETTER_CH:
  211. * @c: an xmlChar value (normally unsigned char)
  212. *
  213. * Macro behaves like IS_LETTER, but only check base chars
  214. *
  215. */
  216. #define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
  217. /**
  218. * IS_ASCII_LETTER:
  219. * @c: an xmlChar value
  220. *
  221. * Macro to check [a-zA-Z]
  222. *
  223. */
  224. #define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
  225. ((0x61 <= (c)) && ((c) <= 0x7a)))
  226. /**
  227. * IS_ASCII_DIGIT:
  228. * @c: an xmlChar value
  229. *
  230. * Macro to check [0-9]
  231. *
  232. */
  233. #define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
  234. /**
  235. * IS_PUBIDCHAR:
  236. * @c: an UNICODE value (int)
  237. *
  238. * Macro to check the following production in the XML spec:
  239. *
  240. *
  241. * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  242. */
  243. #define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
  244. /**
  245. * IS_PUBIDCHAR_CH:
  246. * @c: an xmlChar value (normally unsigned char)
  247. *
  248. * Same as IS_PUBIDCHAR but for single-byte value
  249. */
  250. #define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
  251. /**
  252. * SKIP_EOL:
  253. * @p: and UTF8 string pointer
  254. *
  255. * Skips the end of line chars.
  256. */
  257. #define SKIP_EOL(p) \
  258. if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
  259. if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
  260. /**
  261. * MOVETO_ENDTAG:
  262. * @p: and UTF8 string pointer
  263. *
  264. * Skips to the next '>' char.
  265. */
  266. #define MOVETO_ENDTAG(p) \
  267. while ((*p) && (*(p) != '>')) (p)++
  268. /**
  269. * MOVETO_STARTTAG:
  270. * @p: and UTF8 string pointer
  271. *
  272. * Skips to the next '<' char.
  273. */
  274. #define MOVETO_STARTTAG(p) \
  275. while ((*p) && (*(p) != '<')) (p)++
  276. /**
  277. * Global variables used for predefined strings.
  278. */
  279. XMLPUBVAR const xmlChar xmlStringText[];
  280. XMLPUBVAR const xmlChar xmlStringTextNoenc[];
  281. XMLPUBVAR const xmlChar xmlStringComment[];
  282. /*
  283. * Function to finish the work of the macros where needed.
  284. */
  285. XMLPUBFUN int XMLCALL xmlIsLetter (int c);
  286. /**
  287. * Parser context.
  288. */
  289. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  290. xmlCreateFileParserCtxt (const char *filename);
  291. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  292. xmlCreateURLParserCtxt (const char *filename,
  293. int options);
  294. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  295. xmlCreateMemoryParserCtxt(const char *buffer,
  296. int size);
  297. XMLPUBFUN xmlParserCtxtPtr XMLCALL
  298. xmlCreateEntityParserCtxt(const xmlChar *URL,
  299. const xmlChar *ID,
  300. const xmlChar *base);
  301. XMLPUBFUN int XMLCALL
  302. xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
  303. xmlCharEncoding enc);
  304. XMLPUBFUN int XMLCALL
  305. xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
  306. xmlCharEncodingHandlerPtr handler);
  307. XMLPUBFUN int XMLCALL
  308. xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
  309. xmlParserInputPtr input,
  310. xmlCharEncodingHandlerPtr handler);
  311. #ifdef IN_LIBXML
  312. /* internal error reporting */
  313. XMLPUBFUN void XMLCALL
  314. __xmlErrEncoding (xmlParserCtxtPtr ctxt,
  315. xmlParserErrors xmlerr,
  316. const char *msg,
  317. const xmlChar * str1,
  318. const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
  319. #endif
  320. /**
  321. * Input Streams.
  322. */
  323. XMLPUBFUN xmlParserInputPtr XMLCALL
  324. xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
  325. const xmlChar *buffer);
  326. XMLPUBFUN xmlParserInputPtr XMLCALL
  327. xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
  328. xmlEntityPtr entity);
  329. XMLPUBFUN int XMLCALL
  330. xmlPushInput (xmlParserCtxtPtr ctxt,
  331. xmlParserInputPtr input);
  332. XMLPUBFUN xmlChar XMLCALL
  333. xmlPopInput (xmlParserCtxtPtr ctxt);
  334. XMLPUBFUN void XMLCALL
  335. xmlFreeInputStream (xmlParserInputPtr input);
  336. XMLPUBFUN xmlParserInputPtr XMLCALL
  337. xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
  338. const char *filename);
  339. XMLPUBFUN xmlParserInputPtr XMLCALL
  340. xmlNewInputStream (xmlParserCtxtPtr ctxt);
  341. /**
  342. * Namespaces.
  343. */
  344. XMLPUBFUN xmlChar * XMLCALL
  345. xmlSplitQName (xmlParserCtxtPtr ctxt,
  346. const xmlChar *name,
  347. xmlChar **prefix);
  348. /**
  349. * Generic production rules.
  350. */
  351. XMLPUBFUN const xmlChar * XMLCALL
  352. xmlParseName (xmlParserCtxtPtr ctxt);
  353. XMLPUBFUN xmlChar * XMLCALL
  354. xmlParseNmtoken (xmlParserCtxtPtr ctxt);
  355. XMLPUBFUN xmlChar * XMLCALL
  356. xmlParseEntityValue (xmlParserCtxtPtr ctxt,
  357. xmlChar **orig);
  358. XMLPUBFUN xmlChar * XMLCALL
  359. xmlParseAttValue (xmlParserCtxtPtr ctxt);
  360. XMLPUBFUN xmlChar * XMLCALL
  361. xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
  362. XMLPUBFUN xmlChar * XMLCALL
  363. xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
  364. XMLPUBFUN void XMLCALL
  365. xmlParseCharData (xmlParserCtxtPtr ctxt,
  366. int cdata);
  367. XMLPUBFUN xmlChar * XMLCALL
  368. xmlParseExternalID (xmlParserCtxtPtr ctxt,
  369. xmlChar **publicID,
  370. int strict);
  371. XMLPUBFUN void XMLCALL
  372. xmlParseComment (xmlParserCtxtPtr ctxt);
  373. XMLPUBFUN const xmlChar * XMLCALL
  374. xmlParsePITarget (xmlParserCtxtPtr ctxt);
  375. XMLPUBFUN void XMLCALL
  376. xmlParsePI (xmlParserCtxtPtr ctxt);
  377. XMLPUBFUN void XMLCALL
  378. xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
  379. XMLPUBFUN void XMLCALL
  380. xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
  381. XMLPUBFUN int XMLCALL
  382. xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
  383. xmlChar **value);
  384. XMLPUBFUN xmlEnumerationPtr XMLCALL
  385. xmlParseNotationType (xmlParserCtxtPtr ctxt);
  386. XMLPUBFUN xmlEnumerationPtr XMLCALL
  387. xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
  388. XMLPUBFUN int XMLCALL
  389. xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
  390. xmlEnumerationPtr *tree);
  391. XMLPUBFUN int XMLCALL
  392. xmlParseAttributeType (xmlParserCtxtPtr ctxt,
  393. xmlEnumerationPtr *tree);
  394. XMLPUBFUN void XMLCALL
  395. xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
  396. XMLPUBFUN xmlElementContentPtr XMLCALL
  397. xmlParseElementMixedContentDecl
  398. (xmlParserCtxtPtr ctxt,
  399. int inputchk);
  400. XMLPUBFUN xmlElementContentPtr XMLCALL
  401. xmlParseElementChildrenContentDecl
  402. (xmlParserCtxtPtr ctxt,
  403. int inputchk);
  404. XMLPUBFUN int XMLCALL
  405. xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
  406. const xmlChar *name,
  407. xmlElementContentPtr *result);
  408. XMLPUBFUN int XMLCALL
  409. xmlParseElementDecl (xmlParserCtxtPtr ctxt);
  410. XMLPUBFUN void XMLCALL
  411. xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
  412. XMLPUBFUN int XMLCALL
  413. xmlParseCharRef (xmlParserCtxtPtr ctxt);
  414. XMLPUBFUN xmlEntityPtr XMLCALL
  415. xmlParseEntityRef (xmlParserCtxtPtr ctxt);
  416. XMLPUBFUN void XMLCALL
  417. xmlParseReference (xmlParserCtxtPtr ctxt);
  418. XMLPUBFUN void XMLCALL
  419. xmlParsePEReference (xmlParserCtxtPtr ctxt);
  420. XMLPUBFUN void XMLCALL
  421. xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
  422. #ifdef LIBXML_SAX1_ENABLED
  423. XMLPUBFUN const xmlChar * XMLCALL
  424. xmlParseAttribute (xmlParserCtxtPtr ctxt,
  425. xmlChar **value);
  426. XMLPUBFUN const xmlChar * XMLCALL
  427. xmlParseStartTag (xmlParserCtxtPtr ctxt);
  428. XMLPUBFUN void XMLCALL
  429. xmlParseEndTag (xmlParserCtxtPtr ctxt);
  430. #endif /* LIBXML_SAX1_ENABLED */
  431. XMLPUBFUN void XMLCALL
  432. xmlParseCDSect (xmlParserCtxtPtr ctxt);
  433. XMLPUBFUN void XMLCALL
  434. xmlParseContent (xmlParserCtxtPtr ctxt);
  435. XMLPUBFUN void XMLCALL
  436. xmlParseElement (xmlParserCtxtPtr ctxt);
  437. XMLPUBFUN xmlChar * XMLCALL
  438. xmlParseVersionNum (xmlParserCtxtPtr ctxt);
  439. XMLPUBFUN xmlChar * XMLCALL
  440. xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
  441. XMLPUBFUN xmlChar * XMLCALL
  442. xmlParseEncName (xmlParserCtxtPtr ctxt);
  443. XMLPUBFUN const xmlChar * XMLCALL
  444. xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
  445. XMLPUBFUN int XMLCALL
  446. xmlParseSDDecl (xmlParserCtxtPtr ctxt);
  447. XMLPUBFUN void XMLCALL
  448. xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
  449. XMLPUBFUN void XMLCALL
  450. xmlParseTextDecl (xmlParserCtxtPtr ctxt);
  451. XMLPUBFUN void XMLCALL
  452. xmlParseMisc (xmlParserCtxtPtr ctxt);
  453. XMLPUBFUN void XMLCALL
  454. xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
  455. const xmlChar *ExternalID,
  456. const xmlChar *SystemID);
  457. /**
  458. * XML_SUBSTITUTE_NONE:
  459. *
  460. * If no entities need to be substituted.
  461. */
  462. #define XML_SUBSTITUTE_NONE 0
  463. /**
  464. * XML_SUBSTITUTE_REF:
  465. *
  466. * Whether general entities need to be substituted.
  467. */
  468. #define XML_SUBSTITUTE_REF 1
  469. /**
  470. * XML_SUBSTITUTE_PEREF:
  471. *
  472. * Whether parameter entities need to be substituted.
  473. */
  474. #define XML_SUBSTITUTE_PEREF 2
  475. /**
  476. * XML_SUBSTITUTE_BOTH:
  477. *
  478. * Both general and parameter entities need to be substituted.
  479. */
  480. #define XML_SUBSTITUTE_BOTH 3
  481. XMLPUBFUN xmlChar * XMLCALL
  482. xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
  483. const xmlChar *str,
  484. int what,
  485. xmlChar end,
  486. xmlChar end2,
  487. xmlChar end3);
  488. XMLPUBFUN xmlChar * XMLCALL
  489. xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
  490. const xmlChar *str,
  491. int len,
  492. int what,
  493. xmlChar end,
  494. xmlChar end2,
  495. xmlChar end3);
  496. /*
  497. * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
  498. */
  499. XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
  500. xmlNodePtr value);
  501. XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
  502. XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
  503. xmlParserInputPtr value);
  504. XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
  505. XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
  506. XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
  507. const xmlChar *value);
  508. /*
  509. * other commodities shared between parser.c and parserInternals.
  510. */
  511. XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
  512. XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
  513. const xmlChar *cur,
  514. int *len);
  515. XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
  516. XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
  517. /*
  518. * Really core function shared with HTML parser.
  519. */
  520. XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
  521. int *len);
  522. XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
  523. int val);
  524. XMLPUBFUN int XMLCALL xmlCopyChar (int len,
  525. xmlChar *out,
  526. int val);
  527. XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
  528. XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
  529. #ifdef LIBXML_HTML_ENABLED
  530. /*
  531. * Actually comes from the HTML parser but launched from the init stuff.
  532. */
  533. XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
  534. XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
  535. const char *encoding);
  536. #endif
  537. /*
  538. * Specific function to keep track of entities references
  539. * and used by the XSLT debugger.
  540. */
  541. #ifdef LIBXML_LEGACY_ENABLED
  542. /**
  543. * xmlEntityReferenceFunc:
  544. * @ent: the entity
  545. * @firstNode: the fist node in the chunk
  546. * @lastNode: the last nod in the chunk
  547. *
  548. * Callback function used when one needs to be able to track back the
  549. * provenance of a chunk of nodes inherited from an entity replacement.
  550. */
  551. typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
  552. xmlNodePtr firstNode,
  553. xmlNodePtr lastNode);
  554. XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
  555. XMLPUBFUN xmlChar * XMLCALL
  556. xmlParseQuotedString (xmlParserCtxtPtr ctxt);
  557. XMLPUBFUN void XMLCALL
  558. xmlParseNamespace (xmlParserCtxtPtr ctxt);
  559. XMLPUBFUN xmlChar * XMLCALL
  560. xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
  561. XMLPUBFUN xmlChar * XMLCALL
  562. xmlScanName (xmlParserCtxtPtr ctxt);
  563. XMLPUBFUN xmlChar * XMLCALL
  564. xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
  565. XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
  566. XMLPUBFUN xmlChar * XMLCALL
  567. xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
  568. xmlChar **prefix);
  569. /**
  570. * Entities
  571. */
  572. XMLPUBFUN xmlChar * XMLCALL
  573. xmlDecodeEntities (xmlParserCtxtPtr ctxt,
  574. int len,
  575. int what,
  576. xmlChar end,
  577. xmlChar end2,
  578. xmlChar end3);
  579. XMLPUBFUN void XMLCALL
  580. xmlHandleEntity (xmlParserCtxtPtr ctxt,
  581. xmlEntityPtr entity);
  582. #endif /* LIBXML_LEGACY_ENABLED */
  583. #ifdef IN_LIBXML
  584. /*
  585. * internal only
  586. */
  587. XMLPUBFUN void XMLCALL
  588. xmlErrMemory (xmlParserCtxtPtr ctxt,
  589. const char *extra);
  590. #endif
  591. #ifdef __cplusplus
  592. }
  593. #endif
  594. #endif /* __XML_PARSER_INTERNALS_H__ */