blob: d7184f61e6556c6005e67b4554cd01f7101ad5cd [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: internals routines 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.
Owen Taylor3473f882001-02-23 17:55:21 +00006 *
Daniel Veillardbe586972003-11-18 20:56:51 +00007 * Copy: See Copyright for the status of this software.
Owen Taylor3473f882001-02-23 17:55:21 +00008 *
Daniel Veillardbe586972003-11-18 20:56:51 +00009 * Author: Daniel Veillard
Owen Taylor3473f882001-02-23 17:55:21 +000010 */
11
12#ifndef __XML_PARSER_INTERNALS_H__
13#define __XML_PARSER_INTERNALS_H__
14
Igor Zlatkovic76874e42003-08-25 09:05:12 +000015#include <libxml/xmlversion.h>
Owen Taylor3473f882001-02-23 17:55:21 +000016#include <libxml/parser.h>
Daniel Veillard56a4cb82001-03-24 17:00:36 +000017#include <libxml/HTMLparser.h>
William M. Brack68aca052003-10-11 15:22:13 +000018#include <libxml/chvalid.h>
Owen Taylor3473f882001-02-23 17:55:21 +000019
20#ifdef __cplusplus
21extern "C" {
22#endif
23
Daniel Veillard4aede2e2003-10-17 12:43:59 +000024/**
25 * xmlParserMaxDepth:
26 *
Daniel Veillard1fb2e0d2009-01-18 14:08:36 +000027 * arbitrary depth limit for the XML documents that we allow to
28 * process. This is not a limitation of the parser but a safety
29 * boundary feature, use XML_PARSE_HUGE option to override it.
Daniel Veillard4aede2e2003-10-17 12:43:59 +000030 */
31XMLPUBVAR unsigned int xmlParserMaxDepth;
32
Daniel Veillard1fb2e0d2009-01-18 14:08:36 +000033/**
Daniel Veillardd4d47052009-01-18 17:26:02 +000034 * XML_MAX_TEXT_LENGHT:
Daniel Veillard1fb2e0d2009-01-18 14:08:36 +000035 *
36 * Maximum size allowed for a single text node when building a tree.
37 * This is not a limitation of the parser but a safety boundary feature,
38 * use XML_PARSE_HUGE option to override it.
39 */
40#define XML_MAX_TEXT_LENGHT 10000000
41
42/**
43 * XML_MAX_NAMELEN:
44 *
45 * Identifiers can be longer, but this will be more costly
46 * at runtime.
47 */
Owen Taylor3473f882001-02-23 17:55:21 +000048#define XML_MAX_NAMELEN 100
49
Daniel Veillardbed7b052001-05-19 14:59:49 +000050/**
51 * INPUT_CHUNK:
52 *
Daniel Veillard61f26172002-03-12 18:46:39 +000053 * The parser tries to always have that amount of input ready.
54 * One of the point is providing context when reporting errors.
Owen Taylor3473f882001-02-23 17:55:21 +000055 */
56#define INPUT_CHUNK 250
57
58/************************************************************************
59 * *
60 * UNICODE version of the macros. *
61 * *
62 ************************************************************************/
Daniel Veillardbed7b052001-05-19 14:59:49 +000063/**
Daniel Veillard73b013f2003-09-30 12:36:01 +000064 * IS_BYTE_CHAR:
65 * @c: an byte value (int)
66 *
67 * Macro to check the following production in the XML spec:
68 *
69 * [2] Char ::= #x9 | #xA | #xD | [#x20...]
70 * any byte character in the accepted range
71 */
William M. Brack68aca052003-10-11 15:22:13 +000072#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
Daniel Veillard73b013f2003-09-30 12:36:01 +000073
74/**
Daniel Veillardbed7b052001-05-19 14:59:49 +000075 * IS_CHAR:
76 * @c: an UNICODE value (int)
77 *
Daniel Veillard61f26172002-03-12 18:46:39 +000078 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000079 *
Owen Taylor3473f882001-02-23 17:55:21 +000080 * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
81 * | [#x10000-#x10FFFF]
82 * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
83 */
William M. Brack871611b2003-10-18 04:53:14 +000084#define IS_CHAR(c) xmlIsCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +000085
Daniel Veillardbed7b052001-05-19 14:59:49 +000086/**
William M. Brack76e95df2003-10-18 16:20:14 +000087 * IS_CHAR_CH:
88 * @c: an xmlChar (usually an unsigned char)
89 *
90 * Behaves like IS_CHAR on single-byte value
91 */
92#define IS_CHAR_CH(c) xmlIsChar_ch(c)
93
94/**
Daniel Veillardbed7b052001-05-19 14:59:49 +000095 * IS_BLANK:
96 * @c: an UNICODE value (int)
97 *
Daniel Veillard61f26172002-03-12 18:46:39 +000098 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000099 *
Owen Taylor3473f882001-02-23 17:55:21 +0000100 * [3] S ::= (#x20 | #x9 | #xD | #xA)+
101 */
William M. Brack871611b2003-10-18 04:53:14 +0000102#define IS_BLANK(c) xmlIsBlankQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000103
Daniel Veillardbed7b052001-05-19 14:59:49 +0000104/**
William M. Brack76e95df2003-10-18 16:20:14 +0000105 * IS_BLANK_CH:
106 * @c: an xmlChar value (normally unsigned char)
107 *
108 * Behaviour same as IS_BLANK
109 */
110#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
111
112/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000113 * IS_BASECHAR:
114 * @c: an UNICODE value (int)
115 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000116 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000117 *
Owen Taylor3473f882001-02-23 17:55:21 +0000118 * [85] BaseChar ::= ... long list see REC ...
119 */
William M. Brack871611b2003-10-18 04:53:14 +0000120#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000121
Daniel Veillardbed7b052001-05-19 14:59:49 +0000122/**
123 * IS_DIGIT:
124 * @c: an UNICODE value (int)
125 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000126 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000127 *
Owen Taylor3473f882001-02-23 17:55:21 +0000128 * [88] Digit ::= ... long list see REC ...
129 */
William M. Brack871611b2003-10-18 04:53:14 +0000130#define IS_DIGIT(c) xmlIsDigitQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000131
Daniel Veillardbed7b052001-05-19 14:59:49 +0000132/**
William M. Brack76e95df2003-10-18 16:20:14 +0000133 * IS_DIGIT_CH:
134 * @c: an xmlChar value (usually an unsigned char)
135 *
136 * Behaves like IS_DIGIT but with a single byte argument
137 */
138#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
139
140/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000141 * IS_COMBINING:
142 * @c: an UNICODE value (int)
143 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000144 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000145 *
Owen Taylor3473f882001-02-23 17:55:21 +0000146 * [87] CombiningChar ::= ... long list see REC ...
147 */
William M. Brack871611b2003-10-18 04:53:14 +0000148#define IS_COMBINING(c) xmlIsCombiningQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000149
Daniel Veillardbed7b052001-05-19 14:59:49 +0000150/**
William M. Brack76e95df2003-10-18 16:20:14 +0000151 * IS_COMBINING_CH:
152 * @c: an xmlChar (usually an unsigned char)
153 *
154 * Always false (all combining chars > 0xff)
155 */
156#define IS_COMBINING_CH(c) 0
157
158/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000159 * IS_EXTENDER:
160 * @c: an UNICODE value (int)
161 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000162 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000163 *
164 *
Owen Taylor3473f882001-02-23 17:55:21 +0000165 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
166 * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
167 * [#x309D-#x309E] | [#x30FC-#x30FE]
168 */
William M. Brack871611b2003-10-18 04:53:14 +0000169#define IS_EXTENDER(c) xmlIsExtenderQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000170
Daniel Veillardbed7b052001-05-19 14:59:49 +0000171/**
William M. Brack76e95df2003-10-18 16:20:14 +0000172 * IS_EXTENDER_CH:
173 * @c: an xmlChar value (usually an unsigned char)
174 *
175 * Behaves like IS_EXTENDER but with a single-byte argument
176 */
177#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
178
179/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000180 * IS_IDEOGRAPHIC:
181 * @c: an UNICODE value (int)
182 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000183 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000184 *
185 *
Owen Taylor3473f882001-02-23 17:55:21 +0000186 * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
187 */
William M. Brack871611b2003-10-18 04:53:14 +0000188#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000189
Daniel Veillardbed7b052001-05-19 14:59:49 +0000190/**
191 * IS_LETTER:
192 * @c: an UNICODE value (int)
193 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000194 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000195 *
196 *
Owen Taylor3473f882001-02-23 17:55:21 +0000197 * [84] Letter ::= BaseChar | Ideographic
198 */
199#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
200
William M. Brack76e95df2003-10-18 16:20:14 +0000201/**
202 * IS_LETTER_CH:
203 * @c: an xmlChar value (normally unsigned char)
204 *
205 * Macro behaves like IS_LETTER, but only check base chars
206 *
207 */
208#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
William M. Brackd1757ab2004-10-02 22:07:48 +0000209
210/**
William M. Brack21e4ef22005-01-02 09:53:13 +0000211 * IS_ASCII_LETTER:
William M. Brackd1757ab2004-10-02 22:07:48 +0000212 * @c: an xmlChar value
213 *
214 * Macro to check [a-zA-Z]
215 *
216 */
217#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
218 ((0x61 <= (c)) && ((c) <= 0x7a)))
219
220/**
William M. Brack21e4ef22005-01-02 09:53:13 +0000221 * IS_ASCII_DIGIT:
William M. Brackd1757ab2004-10-02 22:07:48 +0000222 * @c: an xmlChar value
223 *
224 * Macro to check [0-9]
225 *
226 */
227#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
228
Daniel Veillardbed7b052001-05-19 14:59:49 +0000229/**
230 * IS_PUBIDCHAR:
231 * @c: an UNICODE value (int)
232 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000233 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000234 *
235 *
Owen Taylor3473f882001-02-23 17:55:21 +0000236 * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
237 */
William M. Brack871611b2003-10-18 04:53:14 +0000238#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000239
Daniel Veillardbed7b052001-05-19 14:59:49 +0000240/**
William M. Brack76e95df2003-10-18 16:20:14 +0000241 * IS_PUBIDCHAR_CH:
242 * @c: an xmlChar value (normally unsigned char)
243 *
244 * Same as IS_PUBIDCHAR but for single-byte value
245 */
246#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
247
248/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000249 * SKIP_EOL:
250 * @p: and UTF8 string pointer
251 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000252 * Skips the end of line chars.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000253 */
Owen Taylor3473f882001-02-23 17:55:21 +0000254#define SKIP_EOL(p) \
255 if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
256 if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
257
Daniel Veillardbed7b052001-05-19 14:59:49 +0000258/**
259 * MOVETO_ENDTAG:
260 * @p: and UTF8 string pointer
261 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000262 * Skips to the next '>' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000263 */
Owen Taylor3473f882001-02-23 17:55:21 +0000264#define MOVETO_ENDTAG(p) \
265 while ((*p) && (*(p) != '>')) (p)++
266
Daniel Veillardbed7b052001-05-19 14:59:49 +0000267/**
268 * MOVETO_STARTTAG:
269 * @p: and UTF8 string pointer
270 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000271 * Skips to the next '<' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000272 */
Owen Taylor3473f882001-02-23 17:55:21 +0000273#define MOVETO_STARTTAG(p) \
274 while ((*p) && (*(p) != '<')) (p)++
275
276/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000277 * Global variables used for predefined strings.
Daniel Veillard22090732001-07-16 00:06:07 +0000278 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000279XMLPUBVAR const xmlChar xmlStringText[];
280XMLPUBVAR const xmlChar xmlStringTextNoenc[];
281XMLPUBVAR const xmlChar xmlStringComment[];
Owen Taylor3473f882001-02-23 17:55:21 +0000282
283/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000284 * Function to finish the work of the macros where needed.
Owen Taylor3473f882001-02-23 17:55:21 +0000285 */
William M. Brack68aca052003-10-11 15:22:13 +0000286XMLPUBFUN int XMLCALL xmlIsLetter (int c);
Owen Taylor3473f882001-02-23 17:55:21 +0000287
288/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000289 * Parser context.
Owen Taylor3473f882001-02-23 17:55:21 +0000290 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000291XMLPUBFUN xmlParserCtxtPtr XMLCALL
292 xmlCreateFileParserCtxt (const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000293XMLPUBFUN xmlParserCtxtPtr XMLCALL
Daniel Veillard61b93382003-11-03 14:28:31 +0000294 xmlCreateURLParserCtxt (const char *filename,
295 int options);
296XMLPUBFUN xmlParserCtxtPtr XMLCALL
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000297 xmlCreateMemoryParserCtxt(const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000298 int size);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000299XMLPUBFUN xmlParserCtxtPtr XMLCALL
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000300 xmlCreateEntityParserCtxt(const xmlChar *URL,
Owen Taylor3473f882001-02-23 17:55:21 +0000301 const xmlChar *ID,
302 const xmlChar *base);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000303XMLPUBFUN int XMLCALL
304 xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000305 xmlCharEncoding enc);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000306XMLPUBFUN int XMLCALL
307 xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
Daniel Veillarda840b692003-10-19 13:35:37 +0000308 xmlCharEncodingHandlerPtr handler);
309XMLPUBFUN int XMLCALL
310 xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
311 xmlParserInputPtr input,
312 xmlCharEncodingHandlerPtr handler);
Owen Taylor3473f882001-02-23 17:55:21 +0000313
Daniel Veillarda840b692003-10-19 13:35:37 +0000314#ifdef IN_LIBXML
315/* internal error reporting */
316XMLPUBFUN void XMLCALL
317 __xmlErrEncoding (xmlParserCtxtPtr ctxt,
Daniel Veillard29b17482004-08-16 00:39:03 +0000318 xmlParserErrors xmlerr,
Daniel Veillarda840b692003-10-19 13:35:37 +0000319 const char *msg,
320 const xmlChar * str1,
321 const xmlChar * str2);
322#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000323
324/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000325 * Input Streams.
Owen Taylor3473f882001-02-23 17:55:21 +0000326 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000327XMLPUBFUN xmlParserInputPtr XMLCALL
328 xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000329 const xmlChar *buffer);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000330XMLPUBFUN xmlParserInputPtr XMLCALL
331 xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000332 xmlEntityPtr entity);
Daniel Veillarda8f09ce2008-08-27 13:02:01 +0000333XMLPUBFUN int XMLCALL
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000334 xmlPushInput (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000335 xmlParserInputPtr input);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000336XMLPUBFUN xmlChar XMLCALL
337 xmlPopInput (xmlParserCtxtPtr ctxt);
338XMLPUBFUN void XMLCALL
339 xmlFreeInputStream (xmlParserInputPtr input);
340XMLPUBFUN xmlParserInputPtr XMLCALL
341 xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000342 const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000343XMLPUBFUN xmlParserInputPtr XMLCALL
344 xmlNewInputStream (xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +0000345
346/**
347 * Namespaces.
348 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000349XMLPUBFUN xmlChar * XMLCALL
350 xmlSplitQName (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000351 const xmlChar *name,
352 xmlChar **prefix);
Owen Taylor3473f882001-02-23 17:55:21 +0000353
354/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000355 * Generic production rules.
Owen Taylor3473f882001-02-23 17:55:21 +0000356 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000357XMLPUBFUN const xmlChar * XMLCALL
358 xmlParseName (xmlParserCtxtPtr ctxt);
359XMLPUBFUN xmlChar * XMLCALL
360 xmlParseNmtoken (xmlParserCtxtPtr ctxt);
361XMLPUBFUN xmlChar * XMLCALL
362 xmlParseEntityValue (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000363 xmlChar **orig);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000364XMLPUBFUN xmlChar * XMLCALL
365 xmlParseAttValue (xmlParserCtxtPtr ctxt);
366XMLPUBFUN xmlChar * XMLCALL
367 xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
368XMLPUBFUN xmlChar * XMLCALL
369 xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
370XMLPUBFUN void XMLCALL
371 xmlParseCharData (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000372 int cdata);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000373XMLPUBFUN xmlChar * XMLCALL
374 xmlParseExternalID (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000375 xmlChar **publicID,
376 int strict);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000377XMLPUBFUN void XMLCALL
378 xmlParseComment (xmlParserCtxtPtr ctxt);
379XMLPUBFUN const xmlChar * XMLCALL
380 xmlParsePITarget (xmlParserCtxtPtr ctxt);
381XMLPUBFUN void XMLCALL
382 xmlParsePI (xmlParserCtxtPtr ctxt);
383XMLPUBFUN void XMLCALL
384 xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
385XMLPUBFUN void XMLCALL
386 xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
387XMLPUBFUN int XMLCALL
388 xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000389 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000390XMLPUBFUN xmlEnumerationPtr XMLCALL
391 xmlParseNotationType (xmlParserCtxtPtr ctxt);
392XMLPUBFUN xmlEnumerationPtr XMLCALL
393 xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
394XMLPUBFUN int XMLCALL
395 xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000396 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000397XMLPUBFUN int XMLCALL
398 xmlParseAttributeType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000399 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000400XMLPUBFUN void XMLCALL
401 xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
402XMLPUBFUN xmlElementContentPtr XMLCALL
403 xmlParseElementMixedContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000404 (xmlParserCtxtPtr ctxt,
Daniel Veillardbdbe0d42003-09-14 19:56:14 +0000405 int inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000406XMLPUBFUN xmlElementContentPtr XMLCALL
407 xmlParseElementChildrenContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000408 (xmlParserCtxtPtr ctxt,
Daniel Veillardbdbe0d42003-09-14 19:56:14 +0000409 int inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000410XMLPUBFUN int XMLCALL
411 xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000412 const xmlChar *name,
Owen Taylor3473f882001-02-23 17:55:21 +0000413 xmlElementContentPtr *result);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000414XMLPUBFUN int XMLCALL
415 xmlParseElementDecl (xmlParserCtxtPtr ctxt);
416XMLPUBFUN void XMLCALL
417 xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
418XMLPUBFUN int XMLCALL
419 xmlParseCharRef (xmlParserCtxtPtr ctxt);
420XMLPUBFUN xmlEntityPtr XMLCALL
421 xmlParseEntityRef (xmlParserCtxtPtr ctxt);
422XMLPUBFUN void XMLCALL
423 xmlParseReference (xmlParserCtxtPtr ctxt);
424XMLPUBFUN void XMLCALL
425 xmlParsePEReference (xmlParserCtxtPtr ctxt);
426XMLPUBFUN void XMLCALL
427 xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
William M. Brack21e4ef22005-01-02 09:53:13 +0000428#ifdef LIBXML_SAX1_ENABLED
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000429XMLPUBFUN const xmlChar * XMLCALL
430 xmlParseAttribute (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000431 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000432XMLPUBFUN const xmlChar * XMLCALL
433 xmlParseStartTag (xmlParserCtxtPtr ctxt);
434XMLPUBFUN void XMLCALL
435 xmlParseEndTag (xmlParserCtxtPtr ctxt);
William M. Brack21e4ef22005-01-02 09:53:13 +0000436#endif /* LIBXML_SAX1_ENABLED */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000437XMLPUBFUN void XMLCALL
438 xmlParseCDSect (xmlParserCtxtPtr ctxt);
439XMLPUBFUN void XMLCALL
440 xmlParseContent (xmlParserCtxtPtr ctxt);
441XMLPUBFUN void XMLCALL
442 xmlParseElement (xmlParserCtxtPtr ctxt);
443XMLPUBFUN xmlChar * XMLCALL
444 xmlParseVersionNum (xmlParserCtxtPtr ctxt);
445XMLPUBFUN xmlChar * XMLCALL
446 xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
447XMLPUBFUN xmlChar * XMLCALL
448 xmlParseEncName (xmlParserCtxtPtr ctxt);
449XMLPUBFUN const xmlChar * XMLCALL
450 xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
451XMLPUBFUN int XMLCALL
452 xmlParseSDDecl (xmlParserCtxtPtr ctxt);
453XMLPUBFUN void XMLCALL
454 xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
455XMLPUBFUN void XMLCALL
456 xmlParseTextDecl (xmlParserCtxtPtr ctxt);
457XMLPUBFUN void XMLCALL
458 xmlParseMisc (xmlParserCtxtPtr ctxt);
459XMLPUBFUN void XMLCALL
460 xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000461 const xmlChar *ExternalID,
462 const xmlChar *SystemID);
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000463/**
464 * XML_SUBSTITUTE_NONE:
465 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000466 * If no entities need to be substituted.
Owen Taylor3473f882001-02-23 17:55:21 +0000467 */
468#define XML_SUBSTITUTE_NONE 0
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000469/**
470 * XML_SUBSTITUTE_REF:
471 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000472 * Whether general entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000473 */
Owen Taylor3473f882001-02-23 17:55:21 +0000474#define XML_SUBSTITUTE_REF 1
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000475/**
476 * XML_SUBSTITUTE_PEREF:
477 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000478 * Whether parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000479 */
Owen Taylor3473f882001-02-23 17:55:21 +0000480#define XML_SUBSTITUTE_PEREF 2
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000481/**
482 * XML_SUBSTITUTE_BOTH:
483 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000484 * Both general and parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000485 */
Owen Taylor3473f882001-02-23 17:55:21 +0000486#define XML_SUBSTITUTE_BOTH 3
487
Daniel Veillard07cb8222003-09-10 10:51:05 +0000488XMLPUBFUN xmlChar * XMLCALL
Daniel Veillard07cb8222003-09-10 10:51:05 +0000489 xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000490 const xmlChar *str,
491 int what,
492 xmlChar end,
493 xmlChar end2,
494 xmlChar end3);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000495XMLPUBFUN xmlChar * XMLCALL
496 xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
497 const xmlChar *str,
498 int len,
499 int what,
500 xmlChar end,
501 xmlChar end2,
502 xmlChar end3);
Owen Taylor3473f882001-02-23 17:55:21 +0000503
504/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000505 * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
Owen Taylor3473f882001-02-23 17:55:21 +0000506 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000507XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000508 xmlNodePtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000509XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
510XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000511 xmlParserInputPtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000512XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
513XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
514XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000515 const xmlChar *value);
Owen Taylor3473f882001-02-23 17:55:21 +0000516
517/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000518 * other commodities shared between parser.c and parserInternals.
Owen Taylor3473f882001-02-23 17:55:21 +0000519 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000520XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
521XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000522 const xmlChar *cur,
523 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000524XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000525XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
Owen Taylor3473f882001-02-23 17:55:21 +0000526
527/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000528 * Really core function shared with HTML parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000529 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000530XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000531 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000532XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000533 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000534XMLPUBFUN int XMLCALL xmlCopyChar (int len,
Owen Taylor3473f882001-02-23 17:55:21 +0000535 xmlChar *out,
536 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000537XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
538XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
Owen Taylor3473f882001-02-23 17:55:21 +0000539
540#ifdef LIBXML_HTML_ENABLED
541/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000542 * Actually comes from the HTML parser but launched from the init stuff.
Owen Taylor3473f882001-02-23 17:55:21 +0000543 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000544XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
545XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000546 const char *encoding);
Daniel Veillard7839e162002-02-20 18:54:48 +0000547#endif
Daniel Veillard8107a222002-01-13 14:10:10 +0000548
549/*
550 * Specific function to keep track of entities references
Daniel Veillard61f26172002-03-12 18:46:39 +0000551 * and used by the XSLT debugger.
Daniel Veillard8107a222002-01-13 14:10:10 +0000552 */
William M. Brack21e4ef22005-01-02 09:53:13 +0000553#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillard9d06d302002-01-22 18:15:52 +0000554/**
555 * xmlEntityReferenceFunc:
556 * @ent: the entity
557 * @firstNode: the fist node in the chunk
558 * @lastNode: the last nod in the chunk
559 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000560 * Callback function used when one needs to be able to track back the
561 * provenance of a chunk of nodes inherited from an entity replacement.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000562 */
Daniel Veillard8107a222002-01-13 14:10:10 +0000563typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
564 xmlNodePtr firstNode,
565 xmlNodePtr lastNode);
566
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000567XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
Daniel Veillard8107a222002-01-13 14:10:10 +0000568
William M. Brack21e4ef22005-01-02 09:53:13 +0000569XMLPUBFUN xmlChar * XMLCALL
570 xmlParseQuotedString (xmlParserCtxtPtr ctxt);
571XMLPUBFUN void XMLCALL
572 xmlParseNamespace (xmlParserCtxtPtr ctxt);
573XMLPUBFUN xmlChar * XMLCALL
574 xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
575XMLPUBFUN xmlChar * XMLCALL
576 xmlScanName (xmlParserCtxtPtr ctxt);
577XMLPUBFUN xmlChar * XMLCALL
578 xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
579XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
580XMLPUBFUN xmlChar * XMLCALL
581 xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
582 xmlChar **prefix);
583/**
584 * Entities
585 */
586XMLPUBFUN xmlChar * XMLCALL
587 xmlDecodeEntities (xmlParserCtxtPtr ctxt,
588 int len,
589 int what,
590 xmlChar end,
591 xmlChar end2,
592 xmlChar end3);
593XMLPUBFUN void XMLCALL
594 xmlHandleEntity (xmlParserCtxtPtr ctxt,
595 xmlEntityPtr entity);
596
597#endif /* LIBXML_LEGACY_ENABLED */
598
Daniel Veillardce9457f2003-10-05 21:33:18 +0000599#ifdef IN_LIBXML
600/*
601 * internal only
602 */
603XMLPUBFUN void XMLCALL
604 xmlErrMemory (xmlParserCtxtPtr ctxt,
605 const char *extra);
606#endif
Daniel Veillard8107a222002-01-13 14:10:10 +0000607
Owen Taylor3473f882001-02-23 17:55:21 +0000608#ifdef __cplusplus
609}
610#endif
611#endif /* __XML_PARSER_INTERNALS_H__ */