blob: 7e4503d23fd2afa01d58cb45b06b1ae7a08ea1cd [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 *
27 * 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.
30 */
31XMLPUBVAR unsigned int xmlParserMaxDepth;
32
Daniel Veillardbed7b052001-05-19 14:59:49 +000033 /**
34 * XML_MAX_NAMELEN:
35 *
Owen Taylor3473f882001-02-23 17:55:21 +000036 * Identifiers can be longer, but this will be more costly
37 * at runtime.
38 */
39#define XML_MAX_NAMELEN 100
40
Daniel Veillardbed7b052001-05-19 14:59:49 +000041/**
42 * INPUT_CHUNK:
43 *
Daniel Veillard61f26172002-03-12 18:46:39 +000044 * The parser tries to always have that amount of input ready.
45 * One of the point is providing context when reporting errors.
Owen Taylor3473f882001-02-23 17:55:21 +000046 */
47#define INPUT_CHUNK 250
48
49/************************************************************************
50 * *
51 * UNICODE version of the macros. *
52 * *
53 ************************************************************************/
Daniel Veillardbed7b052001-05-19 14:59:49 +000054/**
Daniel Veillard73b013f2003-09-30 12:36:01 +000055 * IS_BYTE_CHAR:
56 * @c: an byte value (int)
57 *
58 * Macro to check the following production in the XML spec:
59 *
60 * [2] Char ::= #x9 | #xA | #xD | [#x20...]
61 * any byte character in the accepted range
62 */
William M. Brack68aca052003-10-11 15:22:13 +000063#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
Daniel Veillard73b013f2003-09-30 12:36:01 +000064
65/**
Daniel Veillardbed7b052001-05-19 14:59:49 +000066 * IS_CHAR:
67 * @c: an UNICODE value (int)
68 *
Daniel Veillard61f26172002-03-12 18:46:39 +000069 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000070 *
Owen Taylor3473f882001-02-23 17:55:21 +000071 * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
72 * | [#x10000-#x10FFFF]
73 * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
74 */
William M. Brack871611b2003-10-18 04:53:14 +000075#define IS_CHAR(c) xmlIsCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +000076
Daniel Veillardbed7b052001-05-19 14:59:49 +000077/**
William M. Brack76e95df2003-10-18 16:20:14 +000078 * IS_CHAR_CH:
79 * @c: an xmlChar (usually an unsigned char)
80 *
81 * Behaves like IS_CHAR on single-byte value
82 */
83#define IS_CHAR_CH(c) xmlIsChar_ch(c)
84
85/**
Daniel Veillardbed7b052001-05-19 14:59:49 +000086 * IS_BLANK:
87 * @c: an UNICODE value (int)
88 *
Daniel Veillard61f26172002-03-12 18:46:39 +000089 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000090 *
Owen Taylor3473f882001-02-23 17:55:21 +000091 * [3] S ::= (#x20 | #x9 | #xD | #xA)+
92 */
William M. Brack871611b2003-10-18 04:53:14 +000093#define IS_BLANK(c) xmlIsBlankQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +000094
Daniel Veillardbed7b052001-05-19 14:59:49 +000095/**
William M. Brack76e95df2003-10-18 16:20:14 +000096 * IS_BLANK_CH:
97 * @c: an xmlChar value (normally unsigned char)
98 *
99 * Behaviour same as IS_BLANK
100 */
101#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
102
103/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000104 * IS_BASECHAR:
105 * @c: an UNICODE value (int)
106 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000107 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000108 *
Owen Taylor3473f882001-02-23 17:55:21 +0000109 * [85] BaseChar ::= ... long list see REC ...
110 */
William M. Brack871611b2003-10-18 04:53:14 +0000111#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000112
Daniel Veillardbed7b052001-05-19 14:59:49 +0000113/**
114 * IS_DIGIT:
115 * @c: an UNICODE value (int)
116 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000117 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000118 *
Owen Taylor3473f882001-02-23 17:55:21 +0000119 * [88] Digit ::= ... long list see REC ...
120 */
William M. Brack871611b2003-10-18 04:53:14 +0000121#define IS_DIGIT(c) xmlIsDigitQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000122
Daniel Veillardbed7b052001-05-19 14:59:49 +0000123/**
William M. Brack76e95df2003-10-18 16:20:14 +0000124 * IS_DIGIT_CH:
125 * @c: an xmlChar value (usually an unsigned char)
126 *
127 * Behaves like IS_DIGIT but with a single byte argument
128 */
129#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
130
131/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000132 * IS_COMBINING:
133 * @c: an UNICODE value (int)
134 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000135 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000136 *
Owen Taylor3473f882001-02-23 17:55:21 +0000137 * [87] CombiningChar ::= ... long list see REC ...
138 */
William M. Brack871611b2003-10-18 04:53:14 +0000139#define IS_COMBINING(c) xmlIsCombiningQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000140
Daniel Veillardbed7b052001-05-19 14:59:49 +0000141/**
William M. Brack76e95df2003-10-18 16:20:14 +0000142 * IS_COMBINING_CH:
143 * @c: an xmlChar (usually an unsigned char)
144 *
145 * Always false (all combining chars > 0xff)
146 */
147#define IS_COMBINING_CH(c) 0
148
149/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000150 * IS_EXTENDER:
151 * @c: an UNICODE value (int)
152 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000153 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000154 *
155 *
Owen Taylor3473f882001-02-23 17:55:21 +0000156 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
157 * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
158 * [#x309D-#x309E] | [#x30FC-#x30FE]
159 */
William M. Brack871611b2003-10-18 04:53:14 +0000160#define IS_EXTENDER(c) xmlIsExtenderQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000161
Daniel Veillardbed7b052001-05-19 14:59:49 +0000162/**
William M. Brack76e95df2003-10-18 16:20:14 +0000163 * IS_EXTENDER_CH:
164 * @c: an xmlChar value (usually an unsigned char)
165 *
166 * Behaves like IS_EXTENDER but with a single-byte argument
167 */
168#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
169
170/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000171 * IS_IDEOGRAPHIC:
172 * @c: an UNICODE value (int)
173 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000174 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000175 *
176 *
Owen Taylor3473f882001-02-23 17:55:21 +0000177 * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
178 */
William M. Brack871611b2003-10-18 04:53:14 +0000179#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000180
Daniel Veillardbed7b052001-05-19 14:59:49 +0000181/**
182 * IS_LETTER:
183 * @c: an UNICODE value (int)
184 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000185 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000186 *
187 *
Owen Taylor3473f882001-02-23 17:55:21 +0000188 * [84] Letter ::= BaseChar | Ideographic
189 */
190#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
191
William M. Brack76e95df2003-10-18 16:20:14 +0000192/**
193 * IS_LETTER_CH:
194 * @c: an xmlChar value (normally unsigned char)
195 *
196 * Macro behaves like IS_LETTER, but only check base chars
197 *
198 */
199#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
Daniel Veillardbed7b052001-05-19 14:59:49 +0000200/**
201 * IS_PUBIDCHAR:
202 * @c: an UNICODE value (int)
203 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000204 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000205 *
206 *
Owen Taylor3473f882001-02-23 17:55:21 +0000207 * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
208 */
William M. Brack871611b2003-10-18 04:53:14 +0000209#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
Owen Taylor3473f882001-02-23 17:55:21 +0000210
Daniel Veillardbed7b052001-05-19 14:59:49 +0000211/**
William M. Brack76e95df2003-10-18 16:20:14 +0000212 * IS_PUBIDCHAR_CH:
213 * @c: an xmlChar value (normally unsigned char)
214 *
215 * Same as IS_PUBIDCHAR but for single-byte value
216 */
217#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
218
219/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000220 * SKIP_EOL:
221 * @p: and UTF8 string pointer
222 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000223 * Skips the end of line chars.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000224 */
Owen Taylor3473f882001-02-23 17:55:21 +0000225#define SKIP_EOL(p) \
226 if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
227 if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
228
Daniel Veillardbed7b052001-05-19 14:59:49 +0000229/**
230 * MOVETO_ENDTAG:
231 * @p: and UTF8 string pointer
232 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000233 * Skips to the next '>' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000234 */
Owen Taylor3473f882001-02-23 17:55:21 +0000235#define MOVETO_ENDTAG(p) \
236 while ((*p) && (*(p) != '>')) (p)++
237
Daniel Veillardbed7b052001-05-19 14:59:49 +0000238/**
239 * MOVETO_STARTTAG:
240 * @p: and UTF8 string pointer
241 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000242 * Skips to the next '<' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000243 */
Owen Taylor3473f882001-02-23 17:55:21 +0000244#define MOVETO_STARTTAG(p) \
245 while ((*p) && (*(p) != '<')) (p)++
246
247/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000248 * Global variables used for predefined strings.
Daniel Veillard22090732001-07-16 00:06:07 +0000249 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000250XMLPUBVAR const xmlChar xmlStringText[];
251XMLPUBVAR const xmlChar xmlStringTextNoenc[];
252XMLPUBVAR const xmlChar xmlStringComment[];
Owen Taylor3473f882001-02-23 17:55:21 +0000253
254/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000255 * Function to finish the work of the macros where needed.
Owen Taylor3473f882001-02-23 17:55:21 +0000256 */
William M. Brack68aca052003-10-11 15:22:13 +0000257XMLPUBFUN int XMLCALL xmlIsLetter (int c);
Owen Taylor3473f882001-02-23 17:55:21 +0000258
259/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000260 * Parser context.
Owen Taylor3473f882001-02-23 17:55:21 +0000261 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000262XMLPUBFUN xmlParserCtxtPtr XMLCALL
263 xmlCreateFileParserCtxt (const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000264XMLPUBFUN xmlParserCtxtPtr XMLCALL
Daniel Veillard61b93382003-11-03 14:28:31 +0000265 xmlCreateURLParserCtxt (const char *filename,
266 int options);
267XMLPUBFUN xmlParserCtxtPtr XMLCALL
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000268 xmlCreateMemoryParserCtxt(const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000269 int size);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000270XMLPUBFUN xmlParserCtxtPtr XMLCALL
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000271 xmlCreateEntityParserCtxt(const xmlChar *URL,
Owen Taylor3473f882001-02-23 17:55:21 +0000272 const xmlChar *ID,
273 const xmlChar *base);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000274XMLPUBFUN int XMLCALL
275 xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000276 xmlCharEncoding enc);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000277XMLPUBFUN int XMLCALL
278 xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
Daniel Veillarda840b692003-10-19 13:35:37 +0000279 xmlCharEncodingHandlerPtr handler);
280XMLPUBFUN int XMLCALL
281 xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
282 xmlParserInputPtr input,
283 xmlCharEncodingHandlerPtr handler);
Owen Taylor3473f882001-02-23 17:55:21 +0000284
Daniel Veillarda840b692003-10-19 13:35:37 +0000285#ifdef IN_LIBXML
286/* internal error reporting */
287XMLPUBFUN void XMLCALL
288 __xmlErrEncoding (xmlParserCtxtPtr ctxt,
289 xmlParserErrors error,
290 const char *msg,
291 const xmlChar * str1,
292 const xmlChar * str2);
293#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000294/**
295 * Entities
296 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000297XMLPUBFUN void XMLCALL
298 xmlHandleEntity (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000299 xmlEntityPtr entity);
300
301/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000302 * Input Streams.
Owen Taylor3473f882001-02-23 17:55:21 +0000303 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000304XMLPUBFUN xmlParserInputPtr XMLCALL
305 xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000306 const xmlChar *buffer);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000307XMLPUBFUN xmlParserInputPtr XMLCALL
308 xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000309 xmlEntityPtr entity);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000310XMLPUBFUN void XMLCALL
311 xmlPushInput (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000312 xmlParserInputPtr input);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000313XMLPUBFUN xmlChar XMLCALL
314 xmlPopInput (xmlParserCtxtPtr ctxt);
315XMLPUBFUN void XMLCALL
316 xmlFreeInputStream (xmlParserInputPtr input);
317XMLPUBFUN xmlParserInputPtr XMLCALL
318 xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000319 const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000320XMLPUBFUN xmlParserInputPtr XMLCALL
321 xmlNewInputStream (xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +0000322
323/**
324 * Namespaces.
325 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000326XMLPUBFUN xmlChar * XMLCALL
327 xmlSplitQName (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000328 const xmlChar *name,
329 xmlChar **prefix);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000330XMLPUBFUN xmlChar * XMLCALL
331 xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
332XMLPUBFUN xmlChar * XMLCALL
333 xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000334 xmlChar **prefix);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000335XMLPUBFUN xmlChar * XMLCALL
336 xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
337XMLPUBFUN xmlChar * XMLCALL
338 xmlParseQuotedString (xmlParserCtxtPtr ctxt);
339XMLPUBFUN void XMLCALL
340 xmlParseNamespace (xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +0000341
342/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000343 * Generic production rules.
Owen Taylor3473f882001-02-23 17:55:21 +0000344 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000345XMLPUBFUN xmlChar * XMLCALL
346 xmlScanName (xmlParserCtxtPtr ctxt);
347XMLPUBFUN const xmlChar * XMLCALL
348 xmlParseName (xmlParserCtxtPtr ctxt);
349XMLPUBFUN xmlChar * XMLCALL
350 xmlParseNmtoken (xmlParserCtxtPtr ctxt);
351XMLPUBFUN xmlChar * XMLCALL
352 xmlParseEntityValue (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000353 xmlChar **orig);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000354XMLPUBFUN xmlChar * XMLCALL
355 xmlParseAttValue (xmlParserCtxtPtr ctxt);
356XMLPUBFUN xmlChar * XMLCALL
357 xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
358XMLPUBFUN xmlChar * XMLCALL
359 xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
360XMLPUBFUN void XMLCALL
361 xmlParseCharData (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000362 int cdata);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000363XMLPUBFUN xmlChar * XMLCALL
364 xmlParseExternalID (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000365 xmlChar **publicID,
366 int strict);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000367XMLPUBFUN void XMLCALL
368 xmlParseComment (xmlParserCtxtPtr ctxt);
369XMLPUBFUN const xmlChar * XMLCALL
370 xmlParsePITarget (xmlParserCtxtPtr ctxt);
371XMLPUBFUN void XMLCALL
372 xmlParsePI (xmlParserCtxtPtr ctxt);
373XMLPUBFUN void XMLCALL
374 xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
375XMLPUBFUN void XMLCALL
376 xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
377XMLPUBFUN int XMLCALL
378 xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000379 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000380XMLPUBFUN xmlEnumerationPtr XMLCALL
381 xmlParseNotationType (xmlParserCtxtPtr ctxt);
382XMLPUBFUN xmlEnumerationPtr XMLCALL
383 xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
384XMLPUBFUN int XMLCALL
385 xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000386 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000387XMLPUBFUN int XMLCALL
388 xmlParseAttributeType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000389 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000390XMLPUBFUN void XMLCALL
391 xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
392XMLPUBFUN xmlElementContentPtr XMLCALL
393 xmlParseElementMixedContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000394 (xmlParserCtxtPtr ctxt,
Daniel Veillardbdbe0d42003-09-14 19:56:14 +0000395 int inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000396XMLPUBFUN xmlElementContentPtr XMLCALL
397 xmlParseElementChildrenContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000398 (xmlParserCtxtPtr ctxt,
Daniel Veillardbdbe0d42003-09-14 19:56:14 +0000399 int inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000400XMLPUBFUN int XMLCALL
401 xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000402 const xmlChar *name,
Owen Taylor3473f882001-02-23 17:55:21 +0000403 xmlElementContentPtr *result);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000404XMLPUBFUN int XMLCALL
405 xmlParseElementDecl (xmlParserCtxtPtr ctxt);
406XMLPUBFUN void XMLCALL
407 xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
408XMLPUBFUN int XMLCALL
409 xmlParseCharRef (xmlParserCtxtPtr ctxt);
410XMLPUBFUN xmlEntityPtr XMLCALL
411 xmlParseEntityRef (xmlParserCtxtPtr ctxt);
412XMLPUBFUN void XMLCALL
413 xmlParseReference (xmlParserCtxtPtr ctxt);
414XMLPUBFUN void XMLCALL
415 xmlParsePEReference (xmlParserCtxtPtr ctxt);
416XMLPUBFUN void XMLCALL
417 xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
418XMLPUBFUN const xmlChar * XMLCALL
419 xmlParseAttribute (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000420 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000421XMLPUBFUN const xmlChar * XMLCALL
422 xmlParseStartTag (xmlParserCtxtPtr ctxt);
423XMLPUBFUN void XMLCALL
424 xmlParseEndTag (xmlParserCtxtPtr ctxt);
425XMLPUBFUN void XMLCALL
426 xmlParseCDSect (xmlParserCtxtPtr ctxt);
427XMLPUBFUN void XMLCALL
428 xmlParseContent (xmlParserCtxtPtr ctxt);
429XMLPUBFUN void XMLCALL
430 xmlParseElement (xmlParserCtxtPtr ctxt);
431XMLPUBFUN xmlChar * XMLCALL
432 xmlParseVersionNum (xmlParserCtxtPtr ctxt);
433XMLPUBFUN xmlChar * XMLCALL
434 xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
435XMLPUBFUN xmlChar * XMLCALL
436 xmlParseEncName (xmlParserCtxtPtr ctxt);
437XMLPUBFUN const xmlChar * XMLCALL
438 xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
439XMLPUBFUN int XMLCALL
440 xmlParseSDDecl (xmlParserCtxtPtr ctxt);
441XMLPUBFUN void XMLCALL
442 xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
443XMLPUBFUN void XMLCALL
444 xmlParseTextDecl (xmlParserCtxtPtr ctxt);
445XMLPUBFUN void XMLCALL
446 xmlParseMisc (xmlParserCtxtPtr ctxt);
447XMLPUBFUN void XMLCALL
448 xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000449 const xmlChar *ExternalID,
450 const xmlChar *SystemID);
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000451/**
452 * XML_SUBSTITUTE_NONE:
453 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000454 * If no entities need to be substituted.
Owen Taylor3473f882001-02-23 17:55:21 +0000455 */
456#define XML_SUBSTITUTE_NONE 0
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000457/**
458 * XML_SUBSTITUTE_REF:
459 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000460 * Whether general entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000461 */
Owen Taylor3473f882001-02-23 17:55:21 +0000462#define XML_SUBSTITUTE_REF 1
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000463/**
464 * XML_SUBSTITUTE_PEREF:
465 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000466 * Whether parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000467 */
Owen Taylor3473f882001-02-23 17:55:21 +0000468#define XML_SUBSTITUTE_PEREF 2
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000469/**
470 * XML_SUBSTITUTE_BOTH:
471 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000472 * Both general and parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000473 */
Owen Taylor3473f882001-02-23 17:55:21 +0000474#define XML_SUBSTITUTE_BOTH 3
475
Daniel Veillard07cb8222003-09-10 10:51:05 +0000476XMLPUBFUN xmlChar * XMLCALL
477 xmlDecodeEntities (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000478 int len,
479 int what,
480 xmlChar end,
481 xmlChar end2,
482 xmlChar end3);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000483XMLPUBFUN xmlChar * XMLCALL
484 xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000485 const xmlChar *str,
486 int what,
487 xmlChar end,
488 xmlChar end2,
489 xmlChar end3);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000490XMLPUBFUN xmlChar * XMLCALL
491 xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
492 const xmlChar *str,
493 int len,
494 int what,
495 xmlChar end,
496 xmlChar end2,
497 xmlChar end3);
Owen Taylor3473f882001-02-23 17:55:21 +0000498
499/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000500 * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
Owen Taylor3473f882001-02-23 17:55:21 +0000501 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000502XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000503 xmlNodePtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000504XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
505XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000506 xmlParserInputPtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000507XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
508XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
509XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000510 const xmlChar *value);
Owen Taylor3473f882001-02-23 17:55:21 +0000511
512/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000513 * other commodities shared between parser.c and parserInternals.
Owen Taylor3473f882001-02-23 17:55:21 +0000514 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000515XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
516XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000517 const xmlChar *cur,
518 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000519XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
520XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
521XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
Owen Taylor3473f882001-02-23 17:55:21 +0000522
523/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000524 * Really core function shared with HTML parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000525 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000526XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000527 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000528XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000529 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000530XMLPUBFUN int XMLCALL xmlCopyChar (int len,
Owen Taylor3473f882001-02-23 17:55:21 +0000531 xmlChar *out,
532 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000533XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
534XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
Owen Taylor3473f882001-02-23 17:55:21 +0000535
536#ifdef LIBXML_HTML_ENABLED
537/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000538 * Actually comes from the HTML parser but launched from the init stuff.
Owen Taylor3473f882001-02-23 17:55:21 +0000539 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000540XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
541XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000542 const char *encoding);
Daniel Veillard7839e162002-02-20 18:54:48 +0000543#endif
Daniel Veillard8107a222002-01-13 14:10:10 +0000544
545/*
546 * Specific function to keep track of entities references
Daniel Veillard61f26172002-03-12 18:46:39 +0000547 * and used by the XSLT debugger.
Daniel Veillard8107a222002-01-13 14:10:10 +0000548 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000549/**
550 * xmlEntityReferenceFunc:
551 * @ent: the entity
552 * @firstNode: the fist node in the chunk
553 * @lastNode: the last nod in the chunk
554 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000555 * Callback function used when one needs to be able to track back the
556 * provenance of a chunk of nodes inherited from an entity replacement.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000557 */
Daniel Veillard8107a222002-01-13 14:10:10 +0000558typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
559 xmlNodePtr firstNode,
560 xmlNodePtr lastNode);
561
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000562XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
Daniel Veillard8107a222002-01-13 14:10:10 +0000563
Daniel Veillardce9457f2003-10-05 21:33:18 +0000564#ifdef IN_LIBXML
565/*
566 * internal only
567 */
568XMLPUBFUN void XMLCALL
569 xmlErrMemory (xmlParserCtxtPtr ctxt,
570 const char *extra);
571#endif
Daniel Veillard8107a222002-01-13 14:10:10 +0000572
Owen Taylor3473f882001-02-23 17:55:21 +0000573#ifdef __cplusplus
574}
575#endif
576#endif /* __XML_PARSER_INTERNALS_H__ */