blob: 470451aa80984c4869df8aed68d5b5f58d8d2273 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
2 * parserInternals.h : internals routines exported by the parser.
3 *
4 * See Copyright for the status of this software.
5 *
Daniel Veillardc5d64342001-06-24 12:13:24 +00006 * daniel@veillard.com
Owen Taylor3473f882001-02-23 17:55:21 +00007 *
Owen Taylor3473f882001-02-23 17:55:21 +00008 */
9
10#ifndef __XML_PARSER_INTERNALS_H__
11#define __XML_PARSER_INTERNALS_H__
12
Igor Zlatkovic76874e42003-08-25 09:05:12 +000013#include <libxml/xmlversion.h>
Owen Taylor3473f882001-02-23 17:55:21 +000014#include <libxml/parser.h>
Daniel Veillard56a4cb82001-03-24 17:00:36 +000015#include <libxml/HTMLparser.h>
Owen Taylor3473f882001-02-23 17:55:21 +000016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
Daniel Veillardbed7b052001-05-19 14:59:49 +000021 /**
22 * XML_MAX_NAMELEN:
23 *
Owen Taylor3473f882001-02-23 17:55:21 +000024 * Identifiers can be longer, but this will be more costly
25 * at runtime.
26 */
27#define XML_MAX_NAMELEN 100
28
Daniel Veillardbed7b052001-05-19 14:59:49 +000029/**
30 * INPUT_CHUNK:
31 *
Daniel Veillard61f26172002-03-12 18:46:39 +000032 * The parser tries to always have that amount of input ready.
33 * One of the point is providing context when reporting errors.
Owen Taylor3473f882001-02-23 17:55:21 +000034 */
35#define INPUT_CHUNK 250
36
37/************************************************************************
38 * *
39 * UNICODE version of the macros. *
40 * *
41 ************************************************************************/
Daniel Veillardbed7b052001-05-19 14:59:49 +000042/**
43 * IS_CHAR:
44 * @c: an UNICODE value (int)
45 *
Daniel Veillard61f26172002-03-12 18:46:39 +000046 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000047 *
Owen Taylor3473f882001-02-23 17:55:21 +000048 * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
49 * | [#x10000-#x10FFFF]
50 * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
51 */
52#define IS_CHAR(c) \
53 ((((c) >= 0x20) && ((c) <= 0xD7FF)) || \
54 ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
55 (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
56 (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
57
Daniel Veillardbed7b052001-05-19 14:59:49 +000058/**
59 * IS_BLANK:
60 * @c: an UNICODE value (int)
61 *
Daniel Veillard61f26172002-03-12 18:46:39 +000062 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000063 *
Owen Taylor3473f882001-02-23 17:55:21 +000064 * [3] S ::= (#x20 | #x9 | #xD | #xA)+
65 */
66#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
67 ((c) == 0x0D))
68
Daniel Veillardbed7b052001-05-19 14:59:49 +000069/**
70 * IS_BASECHAR:
71 * @c: an UNICODE value (int)
72 *
Daniel Veillard61f26172002-03-12 18:46:39 +000073 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000074 *
Owen Taylor3473f882001-02-23 17:55:21 +000075 * [85] BaseChar ::= ... long list see REC ...
76 */
77#define IS_BASECHAR(c) xmlIsBaseChar(c)
78
Daniel Veillardbed7b052001-05-19 14:59:49 +000079/**
80 * IS_DIGIT:
81 * @c: an UNICODE value (int)
82 *
Daniel Veillard61f26172002-03-12 18:46:39 +000083 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000084 *
Owen Taylor3473f882001-02-23 17:55:21 +000085 * [88] Digit ::= ... long list see REC ...
86 */
87#define IS_DIGIT(c) xmlIsDigit(c)
88
Daniel Veillardbed7b052001-05-19 14:59:49 +000089/**
90 * IS_COMBINING:
91 * @c: an UNICODE value (int)
92 *
Daniel Veillard61f26172002-03-12 18:46:39 +000093 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +000094 *
Owen Taylor3473f882001-02-23 17:55:21 +000095 * [87] CombiningChar ::= ... long list see REC ...
96 */
97#define IS_COMBINING(c) xmlIsCombining(c)
98
Daniel Veillardbed7b052001-05-19 14:59:49 +000099/**
100 * IS_EXTENDER:
101 * @c: an UNICODE value (int)
102 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000103 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000104 *
105 *
Owen Taylor3473f882001-02-23 17:55:21 +0000106 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
107 * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
108 * [#x309D-#x309E] | [#x30FC-#x30FE]
109 */
110#define IS_EXTENDER(c) xmlIsExtender(c)
111
Daniel Veillardbed7b052001-05-19 14:59:49 +0000112/**
113 * IS_IDEOGRAPHIC:
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 *
118 *
Owen Taylor3473f882001-02-23 17:55:21 +0000119 * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
120 */
121#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)
122
Daniel Veillardbed7b052001-05-19 14:59:49 +0000123/**
124 * IS_LETTER:
125 * @c: an UNICODE value (int)
126 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000127 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000128 *
129 *
Owen Taylor3473f882001-02-23 17:55:21 +0000130 * [84] Letter ::= BaseChar | Ideographic
131 */
132#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
133
134
Daniel Veillardbed7b052001-05-19 14:59:49 +0000135/**
136 * IS_PUBIDCHAR:
137 * @c: an UNICODE value (int)
138 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000139 * Macro to check the following production in the XML spec:
Daniel Veillardbed7b052001-05-19 14:59:49 +0000140 *
141 *
Owen Taylor3473f882001-02-23 17:55:21 +0000142 * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
143 */
144#define IS_PUBIDCHAR(c) xmlIsPubidChar(c)
145
Daniel Veillardbed7b052001-05-19 14:59:49 +0000146/**
147 * SKIP_EOL:
148 * @p: and UTF8 string pointer
149 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000150 * Skips the end of line chars.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000151 */
Owen Taylor3473f882001-02-23 17:55:21 +0000152#define SKIP_EOL(p) \
153 if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
154 if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
155
Daniel Veillardbed7b052001-05-19 14:59:49 +0000156/**
157 * MOVETO_ENDTAG:
158 * @p: and UTF8 string pointer
159 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000160 * Skips to the next '>' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000161 */
Owen Taylor3473f882001-02-23 17:55:21 +0000162#define MOVETO_ENDTAG(p) \
163 while ((*p) && (*(p) != '>')) (p)++
164
Daniel Veillardbed7b052001-05-19 14:59:49 +0000165/**
166 * MOVETO_STARTTAG:
167 * @p: and UTF8 string pointer
168 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000169 * Skips to the next '<' char.
Daniel Veillardbed7b052001-05-19 14:59:49 +0000170 */
Owen Taylor3473f882001-02-23 17:55:21 +0000171#define MOVETO_STARTTAG(p) \
172 while ((*p) && (*(p) != '<')) (p)++
173
174/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000175 * Global variables used for predefined strings.
Daniel Veillard22090732001-07-16 00:06:07 +0000176 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000177XMLPUBVAR const xmlChar xmlStringText[];
178XMLPUBVAR const xmlChar xmlStringTextNoenc[];
179XMLPUBVAR const xmlChar xmlStringComment[];
Owen Taylor3473f882001-02-23 17:55:21 +0000180
181/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000182 * Function to finish the work of the macros where needed.
Owen Taylor3473f882001-02-23 17:55:21 +0000183 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000184XMLPUBFUN int XMLCALL xmlIsBaseChar (int c);
185XMLPUBFUN int XMLCALL xmlIsBlank (int c);
186XMLPUBFUN int XMLCALL xmlIsPubidChar (int c);
187XMLPUBFUN int XMLCALL xmlIsLetter (int c);
188XMLPUBFUN int XMLCALL xmlIsDigit (int c);
189XMLPUBFUN int XMLCALL xmlIsIdeographic(int c);
190XMLPUBFUN int XMLCALL xmlIsExtender (int c);
191XMLPUBFUN int XMLCALL xmlIsCombining (int c);
192XMLPUBFUN int XMLCALL xmlIsChar (int c);
Owen Taylor3473f882001-02-23 17:55:21 +0000193
194/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000195 * Parser context.
Owen Taylor3473f882001-02-23 17:55:21 +0000196 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000197XMLPUBFUN xmlParserCtxtPtr XMLCALL
198 xmlCreateFileParserCtxt (const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000199XMLPUBFUN xmlParserCtxtPtr XMLCALL
200 xmlCreateMemoryParserCtxt(const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000201 int size);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000202XMLPUBFUN xmlParserCtxtPtr XMLCALL
203 xmlNewParserCtxt (void);
204XMLPUBFUN xmlParserCtxtPtr XMLCALL
205 xmlCreateEntityParserCtxt(const xmlChar *URL,
Owen Taylor3473f882001-02-23 17:55:21 +0000206 const xmlChar *ID,
207 const xmlChar *base);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000208XMLPUBFUN int XMLCALL
209 xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000210 xmlCharEncoding enc);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000211XMLPUBFUN int XMLCALL
212 xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000213 xmlCharEncodingHandlerPtr handler);
Owen Taylor3473f882001-02-23 17:55:21 +0000214
215/**
216 * Entities
217 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000218XMLPUBFUN void XMLCALL
219 xmlHandleEntity (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000220 xmlEntityPtr entity);
221
222/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000223 * Input Streams.
Owen Taylor3473f882001-02-23 17:55:21 +0000224 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000225XMLPUBFUN xmlParserInputPtr XMLCALL
226 xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000227 const xmlChar *buffer);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000228XMLPUBFUN xmlParserInputPtr XMLCALL
229 xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000230 xmlEntityPtr entity);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000231XMLPUBFUN void XMLCALL
232 xmlPushInput (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000233 xmlParserInputPtr input);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000234XMLPUBFUN xmlChar XMLCALL
235 xmlPopInput (xmlParserCtxtPtr ctxt);
236XMLPUBFUN void XMLCALL
237 xmlFreeInputStream (xmlParserInputPtr input);
238XMLPUBFUN xmlParserInputPtr XMLCALL
239 xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000240 const char *filename);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000241XMLPUBFUN xmlParserInputPtr XMLCALL
242 xmlNewInputStream (xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +0000243
244/**
245 * Namespaces.
246 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000247XMLPUBFUN xmlChar * XMLCALL
248 xmlSplitQName (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000249 const xmlChar *name,
250 xmlChar **prefix);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000251XMLPUBFUN xmlChar * XMLCALL
252 xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
253XMLPUBFUN xmlChar * XMLCALL
254 xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000255 xmlChar **prefix);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000256XMLPUBFUN xmlChar * XMLCALL
257 xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
258XMLPUBFUN xmlChar * XMLCALL
259 xmlParseQuotedString (xmlParserCtxtPtr ctxt);
260XMLPUBFUN void XMLCALL
261 xmlParseNamespace (xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +0000262
263/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000264 * Generic production rules.
Owen Taylor3473f882001-02-23 17:55:21 +0000265 */
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000266XMLPUBFUN xmlChar * XMLCALL
267 xmlScanName (xmlParserCtxtPtr ctxt);
268XMLPUBFUN const xmlChar * XMLCALL
269 xmlParseName (xmlParserCtxtPtr ctxt);
270XMLPUBFUN xmlChar * XMLCALL
271 xmlParseNmtoken (xmlParserCtxtPtr ctxt);
272XMLPUBFUN xmlChar * XMLCALL
273 xmlParseEntityValue (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000274 xmlChar **orig);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000275XMLPUBFUN xmlChar * XMLCALL
276 xmlParseAttValue (xmlParserCtxtPtr ctxt);
277XMLPUBFUN xmlChar * XMLCALL
278 xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
279XMLPUBFUN xmlChar * XMLCALL
280 xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
281XMLPUBFUN void XMLCALL
282 xmlParseCharData (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000283 int cdata);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000284XMLPUBFUN xmlChar * XMLCALL
285 xmlParseExternalID (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000286 xmlChar **publicID,
287 int strict);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000288XMLPUBFUN void XMLCALL
289 xmlParseComment (xmlParserCtxtPtr ctxt);
290XMLPUBFUN const xmlChar * XMLCALL
291 xmlParsePITarget (xmlParserCtxtPtr ctxt);
292XMLPUBFUN void XMLCALL
293 xmlParsePI (xmlParserCtxtPtr ctxt);
294XMLPUBFUN void XMLCALL
295 xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
296XMLPUBFUN void XMLCALL
297 xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
298XMLPUBFUN int XMLCALL
299 xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000300 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000301XMLPUBFUN xmlEnumerationPtr XMLCALL
302 xmlParseNotationType (xmlParserCtxtPtr ctxt);
303XMLPUBFUN xmlEnumerationPtr XMLCALL
304 xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
305XMLPUBFUN int XMLCALL
306 xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000307 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000308XMLPUBFUN int XMLCALL
309 xmlParseAttributeType (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000310 xmlEnumerationPtr *tree);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000311XMLPUBFUN void XMLCALL
312 xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
313XMLPUBFUN xmlElementContentPtr XMLCALL
314 xmlParseElementMixedContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000315 (xmlParserCtxtPtr ctxt,
316 xmlParserInputPtr inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000317XMLPUBFUN xmlElementContentPtr XMLCALL
318 xmlParseElementChildrenContentDecl
Daniel Veillard8dc16a62002-02-19 21:08:48 +0000319 (xmlParserCtxtPtr ctxt,
320 xmlParserInputPtr inputchk);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000321XMLPUBFUN int XMLCALL
322 xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000323 const xmlChar *name,
Owen Taylor3473f882001-02-23 17:55:21 +0000324 xmlElementContentPtr *result);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000325XMLPUBFUN int XMLCALL
326 xmlParseElementDecl (xmlParserCtxtPtr ctxt);
327XMLPUBFUN void XMLCALL
328 xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
329XMLPUBFUN int XMLCALL
330 xmlParseCharRef (xmlParserCtxtPtr ctxt);
331XMLPUBFUN xmlEntityPtr XMLCALL
332 xmlParseEntityRef (xmlParserCtxtPtr ctxt);
333XMLPUBFUN void XMLCALL
334 xmlParseReference (xmlParserCtxtPtr ctxt);
335XMLPUBFUN void XMLCALL
336 xmlParsePEReference (xmlParserCtxtPtr ctxt);
337XMLPUBFUN void XMLCALL
338 xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
339XMLPUBFUN const xmlChar * XMLCALL
340 xmlParseAttribute (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000341 xmlChar **value);
Igor Zlatkovic93f984a2003-08-25 10:34:41 +0000342XMLPUBFUN const xmlChar * XMLCALL
343 xmlParseStartTag (xmlParserCtxtPtr ctxt);
344XMLPUBFUN void XMLCALL
345 xmlParseEndTag (xmlParserCtxtPtr ctxt);
346XMLPUBFUN void XMLCALL
347 xmlParseCDSect (xmlParserCtxtPtr ctxt);
348XMLPUBFUN void XMLCALL
349 xmlParseContent (xmlParserCtxtPtr ctxt);
350XMLPUBFUN void XMLCALL
351 xmlParseElement (xmlParserCtxtPtr ctxt);
352XMLPUBFUN xmlChar * XMLCALL
353 xmlParseVersionNum (xmlParserCtxtPtr ctxt);
354XMLPUBFUN xmlChar * XMLCALL
355 xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
356XMLPUBFUN xmlChar * XMLCALL
357 xmlParseEncName (xmlParserCtxtPtr ctxt);
358XMLPUBFUN const xmlChar * XMLCALL
359 xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
360XMLPUBFUN int XMLCALL
361 xmlParseSDDecl (xmlParserCtxtPtr ctxt);
362XMLPUBFUN void XMLCALL
363 xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
364XMLPUBFUN void XMLCALL
365 xmlParseTextDecl (xmlParserCtxtPtr ctxt);
366XMLPUBFUN void XMLCALL
367 xmlParseMisc (xmlParserCtxtPtr ctxt);
368XMLPUBFUN void XMLCALL
369 xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000370 const xmlChar *ExternalID,
371 const xmlChar *SystemID);
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000372/**
373 * XML_SUBSTITUTE_NONE:
374 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000375 * If no entities need to be substituted.
Owen Taylor3473f882001-02-23 17:55:21 +0000376 */
377#define XML_SUBSTITUTE_NONE 0
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000378/**
379 * XML_SUBSTITUTE_REF:
380 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000381 * Whether general entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000382 */
Owen Taylor3473f882001-02-23 17:55:21 +0000383#define XML_SUBSTITUTE_REF 1
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000384/**
385 * XML_SUBSTITUTE_PEREF:
386 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000387 * Whether parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000388 */
Owen Taylor3473f882001-02-23 17:55:21 +0000389#define XML_SUBSTITUTE_PEREF 2
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000390/**
391 * XML_SUBSTITUTE_BOTH:
392 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000393 * Both general and parameter entities need to be substituted.
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000394 */
Owen Taylor3473f882001-02-23 17:55:21 +0000395#define XML_SUBSTITUTE_BOTH 3
396
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000397XMLPUBFUN xmlChar * XMLCALL xmlDecodeEntities (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000398 int len,
399 int what,
400 xmlChar end,
401 xmlChar end2,
402 xmlChar end3);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000403XMLPUBFUN xmlChar * XMLCALL xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000404 const xmlChar *str,
405 int what,
406 xmlChar end,
407 xmlChar end2,
408 xmlChar end3);
409
410/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000411 * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
Owen Taylor3473f882001-02-23 17:55:21 +0000412 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000413XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000414 xmlNodePtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000415XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
416XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000417 xmlParserInputPtr value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000418XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
419XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
420XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000421 const xmlChar *value);
Owen Taylor3473f882001-02-23 17:55:21 +0000422
423/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000424 * other commodities shared between parser.c and parserInternals.
Owen Taylor3473f882001-02-23 17:55:21 +0000425 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000426XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
427XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000428 const xmlChar *cur,
429 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000430XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
431XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
432XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
Owen Taylor3473f882001-02-23 17:55:21 +0000433
434/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000435 * Really core function shared with HTML parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000436 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000437XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000438 int *len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000439XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000440 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000441XMLPUBFUN int XMLCALL xmlCopyChar (int len,
Owen Taylor3473f882001-02-23 17:55:21 +0000442 xmlChar *out,
443 int val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000444XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
445XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
Owen Taylor3473f882001-02-23 17:55:21 +0000446
447#ifdef LIBXML_HTML_ENABLED
448/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000449 * Actually comes from the HTML parser but launched from the init stuff.
Owen Taylor3473f882001-02-23 17:55:21 +0000450 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000451XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
452XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000453 const char *encoding);
Daniel Veillard7839e162002-02-20 18:54:48 +0000454#endif
Daniel Veillard8107a222002-01-13 14:10:10 +0000455
456/*
457 * Specific function to keep track of entities references
Daniel Veillard61f26172002-03-12 18:46:39 +0000458 * and used by the XSLT debugger.
Daniel Veillard8107a222002-01-13 14:10:10 +0000459 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000460/**
461 * xmlEntityReferenceFunc:
462 * @ent: the entity
463 * @firstNode: the fist node in the chunk
464 * @lastNode: the last nod in the chunk
465 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000466 * Callback function used when one needs to be able to track back the
467 * provenance of a chunk of nodes inherited from an entity replacement.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000468 */
Daniel Veillard8107a222002-01-13 14:10:10 +0000469typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
470 xmlNodePtr firstNode,
471 xmlNodePtr lastNode);
472
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000473XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
Daniel Veillard8107a222002-01-13 14:10:10 +0000474
475
Owen Taylor3473f882001-02-23 17:55:21 +0000476#ifdef __cplusplus
477}
478#endif
479#endif /* __XML_PARSER_INTERNALS_H__ */