blob: 7a0eaeab2fd51b50313d52f34515fed19fce3ab3 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
2 * parser.h : Interfaces, constants and types related to the XML 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 */
8
9#ifndef __XML_PARSER_H__
10#define __XML_PARSER_H__
11
Igor Zlatkovic76874e42003-08-25 09:05:12 +000012#include <libxml/xmlversion.h>
Owen Taylor3473f882001-02-23 17:55:21 +000013#include <libxml/tree.h>
Daniel Veillard2fdbd322003-08-18 12:15:38 +000014#include <libxml/dict.h>
Daniel Veillard07cb8222003-09-10 10:51:05 +000015#include <libxml/hash.h>
Owen Taylor3473f882001-02-23 17:55:21 +000016#include <libxml/valid.h>
Owen Taylor3473f882001-02-23 17:55:21 +000017#include <libxml/entities.h>
Owen Taylor3473f882001-02-23 17:55:21 +000018
19#ifdef __cplusplus
20extern "C" {
21#endif
22
Daniel Veillard5e2dace2001-07-18 19:30:27 +000023/**
24 * XML_DEFAULT_VERSION:
25 *
26 * The default version of XML used: 1.0
Owen Taylor3473f882001-02-23 17:55:21 +000027 */
28#define XML_DEFAULT_VERSION "1.0"
29
30/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000031 * xmlParserInput:
32 *
Daniel Veillard61f26172002-03-12 18:46:39 +000033 * An xmlParserInput is an input flow for the XML processor.
Owen Taylor3473f882001-02-23 17:55:21 +000034 * Each entity parsed is associated an xmlParserInput (except the
35 * few predefined ones). This is the case both for internal entities
36 * - in which case the flow is already completely in memory - or
37 * external entities - in which case we use the buf structure for
38 * progressive reading and I18N conversions to the internal UTF-8 format.
39 */
40
Daniel Veillard9d06d302002-01-22 18:15:52 +000041/**
42 * xmlParserInputDeallocate:
43 * @str: the string to deallocate
44 *
Daniel Veillard61f26172002-03-12 18:46:39 +000045 * Callback for freeing some parser input allocations.
Daniel Veillard9d06d302002-01-22 18:15:52 +000046 */
47typedef void (* xmlParserInputDeallocate)(xmlChar *str);
Daniel Veillard5e2dace2001-07-18 19:30:27 +000048
Owen Taylor3473f882001-02-23 17:55:21 +000049struct _xmlParserInput {
50 /* Input buffer */
51 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
52
53 const char *filename; /* The file analyzed, if any */
Daniel Veillard60087f32001-10-10 09:45:09 +000054 const char *directory; /* the directory/base of the file */
Owen Taylor3473f882001-02-23 17:55:21 +000055 const xmlChar *base; /* Base of the array to parse */
56 const xmlChar *cur; /* Current char being parsed */
Daniel Veillardcbaf3992001-12-31 16:16:02 +000057 const xmlChar *end; /* end of the array to parse */
Owen Taylor3473f882001-02-23 17:55:21 +000058 int length; /* length if known */
59 int line; /* Current line */
60 int col; /* Current column */
Daniel Veillard3e59fc52003-04-18 12:34:58 +000061 /*
62 * NOTE: consumed is only tested for equality in the parser code,
63 * so even if there is an overflow this should not give troubles
64 * for parsing very large instances.
65 */
66 unsigned long consumed; /* How many xmlChars already consumed */
Owen Taylor3473f882001-02-23 17:55:21 +000067 xmlParserInputDeallocate free; /* function to deallocate the base */
68 const xmlChar *encoding; /* the encoding string for entity */
69 const xmlChar *version; /* the version string for entity */
70 int standalone; /* Was that entity marked standalone */
71};
72
73/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000074 * xmlParserNodeInfo:
75 *
Daniel Veillard61f26172002-03-12 18:46:39 +000076 * The parser can be asked to collect Node informations, i.e. at what
Owen Taylor3473f882001-02-23 17:55:21 +000077 * place in the file they were detected.
78 * NOTE: This is off by default and not very well tested.
79 */
80typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
81typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
82
83struct _xmlParserNodeInfo {
84 const struct _xmlNode* node;
85 /* Position & line # that text that created the node begins & ends on */
86 unsigned long begin_pos;
87 unsigned long begin_line;
88 unsigned long end_pos;
89 unsigned long end_line;
90};
91
92typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
93typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
94struct _xmlParserNodeInfoSeq {
95 unsigned long maximum;
96 unsigned long length;
97 xmlParserNodeInfo* buffer;
98};
99
100/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000101 * xmlParserInputState:
102 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000103 * The parser is now working also as a state based parser.
104 * The recursive one use the state info for entities processing.
Owen Taylor3473f882001-02-23 17:55:21 +0000105 */
106typedef enum {
107 XML_PARSER_EOF = -1, /* nothing is to be parsed */
108 XML_PARSER_START = 0, /* nothing has been parsed */
109 XML_PARSER_MISC, /* Misc* before int subset */
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000110 XML_PARSER_PI, /* Within a processing instruction */
Owen Taylor3473f882001-02-23 17:55:21 +0000111 XML_PARSER_DTD, /* within some DTD content */
112 XML_PARSER_PROLOG, /* Misc* after internal subset */
113 XML_PARSER_COMMENT, /* within a comment */
114 XML_PARSER_START_TAG, /* within a start tag */
115 XML_PARSER_CONTENT, /* within the content */
116 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
117 XML_PARSER_END_TAG, /* within a closing tag */
118 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
119 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
120 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
121 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
122 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
Daniel Veillard4a7ae502002-02-18 19:18:17 +0000123 XML_PARSER_IGNORE, /* within an IGNORED section */
124 XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
Owen Taylor3473f882001-02-23 17:55:21 +0000125} xmlParserInputState;
126
127/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000128 * XML_DETECT_IDS:
129 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000130 * Bit in the loadsubset context field to tell to do ID/REFs lookups.
131 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000132 */
133#define XML_DETECT_IDS 2
134
135/**
136 * XML_COMPLETE_ATTRS:
137 *
138 * Bit in the loadsubset context field to tell to do complete the
Daniel Veillard61f26172002-03-12 18:46:39 +0000139 * elements attributes lists with the ones defaulted from the DTDs.
140 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000141 */
142#define XML_COMPLETE_ATTRS 4
143
144/**
Daniel Veillardef8dd7b2003-03-23 12:02:56 +0000145 * XML_SKIP_IDS:
146 *
147 * Bit in the loadsubset context field to tell to not do ID/REFs registration.
148 * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
149 */
150#define XML_SKIP_IDS 8
151
152/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000153 * xmlParserCtxt:
154 *
Owen Taylor3473f882001-02-23 17:55:21 +0000155 * The parser context.
Daniel Veillard61f26172002-03-12 18:46:39 +0000156 * NOTE This doesn't completely define the parser state, the (current ?)
Owen Taylor3473f882001-02-23 17:55:21 +0000157 * design of the parser uses recursive function calls since this allow
158 * and easy mapping from the production rules of the specification
159 * to the actual code. The drawback is that the actual function call
160 * also reflect the parser state. However most of the parsing routines
161 * takes as the only argument the parser context pointer, so migrating
162 * to a state based parser for progressive parsing shouldn't be too hard.
163 */
Owen Taylor3473f882001-02-23 17:55:21 +0000164struct _xmlParserCtxt {
165 struct _xmlSAXHandler *sax; /* The SAX handler */
166 void *userData; /* For SAX interface only, used by DOM build */
167 xmlDocPtr myDoc; /* the document being built */
168 int wellFormed; /* is the document well formed */
169 int replaceEntities; /* shall we replace entities ? */
170 const xmlChar *version; /* the XML version string */
171 const xmlChar *encoding; /* the declared encoding, if any */
172 int standalone; /* standalone document */
173 int html; /* an HTML(1)/Docbook(2) document */
174
175 /* Input stream stack */
176 xmlParserInputPtr input; /* Current input stream */
177 int inputNr; /* Number of current input streams */
178 int inputMax; /* Max number of input streams */
179 xmlParserInputPtr *inputTab; /* stack of inputs */
180
181 /* Node analysis stack only used for DOM building */
182 xmlNodePtr node; /* Current parsed Node */
183 int nodeNr; /* Depth of the parsing stack */
184 int nodeMax; /* Max depth of the parsing stack */
185 xmlNodePtr *nodeTab; /* array of nodes */
186
187 int record_info; /* Whether node info should be kept */
188 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
189
190 int errNo; /* error code */
191
192 int hasExternalSubset; /* reference and external subset */
193 int hasPErefs; /* the internal subset has PE refs */
194 int external; /* are we parsing an external entity */
195
196 int valid; /* is the document valid */
197 int validate; /* shall we try to validate ? */
198 xmlValidCtxt vctxt; /* The validity context */
199
200 xmlParserInputState instate; /* current type of input */
201 int token; /* next char look-ahead */
202
203 char *directory; /* the data directory */
204
205 /* Node name stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000206 const xmlChar *name; /* Current parsed Node */
Owen Taylor3473f882001-02-23 17:55:21 +0000207 int nameNr; /* Depth of the parsing stack */
208 int nameMax; /* Max depth of the parsing stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000209 const xmlChar * *nameTab; /* array of nodes */
Owen Taylor3473f882001-02-23 17:55:21 +0000210
211 long nbChars; /* number of xmlChar processed */
212 long checkIndex; /* used by progressive parsing lookup */
213 int keepBlanks; /* ugly but ... */
214 int disableSAX; /* SAX callbacks are disabled */
215 int inSubset; /* Parsing is in int 1/ext 2 subset */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000216 const xmlChar * intSubName; /* name of subset */
Owen Taylor3473f882001-02-23 17:55:21 +0000217 xmlChar * extSubURI; /* URI of external subset */
218 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
219
220 /* xml:space values */
221 int * space; /* Should the parser preserve spaces */
222 int spaceNr; /* Depth of the parsing stack */
223 int spaceMax; /* Max depth of the parsing stack */
224 int * spaceTab; /* array of space infos */
225
226 int depth; /* to prevent entity substitution loops */
227 xmlParserInputPtr entity; /* used to check entities boundaries */
228 int charset; /* encoding of the in-memory content
229 actually an xmlCharEncoding */
230 int nodelen; /* Those two fields are there to */
231 int nodemem; /* Speed up large node parsing */
232 int pedantic; /* signal pedantic warnings */
233 void *_private; /* For user data, libxml won't touch it */
234
235 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000236 int linenumbers; /* set line number in element content */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000237 void *catalogs; /* document's own catalog */
Daniel Veillarddad3f682002-11-17 16:47:27 +0000238 int recovery; /* run in recovery mode */
Daniel Veillarda880b122003-04-21 21:36:41 +0000239 int progressive; /* is this a progressive parsing */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000240 xmlDictPtr dict; /* dictionnary for the parser */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000241 const xmlChar * *atts; /* array for the attributes callbacks */
Daniel Veillard6155d8a2003-08-19 15:01:28 +0000242 int maxatts; /* the size of the array */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000243 int docdict; /* use strings from dict to build tree */
Daniel Veillard0fb18932003-09-07 09:14:37 +0000244
245 /*
246 * pre-interned strings
247 */
248 const xmlChar *str_xml;
249 const xmlChar *str_xmlns;
Daniel Veillard07cb8222003-09-10 10:51:05 +0000250 const xmlChar *str_xml_ns;
Daniel Veillard0fb18932003-09-07 09:14:37 +0000251
252 /*
Daniel Veillard07cb8222003-09-10 10:51:05 +0000253 * Everything below is used only by the new SAX mode
Daniel Veillard0fb18932003-09-07 09:14:37 +0000254 */
255 int sax2; /* operating in the new SAX mode */
256 int nsNr; /* the number of inherited namespaces */
257 int nsMax; /* the size of the arrays */
258 const xmlChar * *nsTab; /* the array of prefix/namespace name */
Daniel Veillard07cb8222003-09-10 10:51:05 +0000259 int *attallocs; /* which attribute were allocated */
260 void * *pushTab; /* array of data for push */
261 xmlHashTablePtr attsDefault; /* defaulted attributes if any */
262 xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
Daniel Veillard3b7840c2003-09-11 23:42:01 +0000263 int nsWellFormed; /* is the document XML Nanespace okay */
Owen Taylor3473f882001-02-23 17:55:21 +0000264};
265
266/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000267 * xmlSAXLocator:
268 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000269 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000270 */
Owen Taylor3473f882001-02-23 17:55:21 +0000271struct _xmlSAXLocator {
272 const xmlChar *(*getPublicId)(void *ctx);
273 const xmlChar *(*getSystemId)(void *ctx);
274 int (*getLineNumber)(void *ctx);
275 int (*getColumnNumber)(void *ctx);
276};
277
278/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000279 * xmlSAXHandler:
280 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000281 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000282 * of the input generate data or structure informations.
283 */
284
Daniel Veillard9d06d302002-01-22 18:15:52 +0000285/**
286 * resolveEntitySAXFunc:
287 * @ctx: the user data (XML parser context)
288 * @publicId: The public ID of the entity
289 * @systemId: The system ID of the entity
290 *
291 * Callback:
292 * The entity loader, to control the loading of external entities,
293 * the application can either:
294 * - override this resolveEntity() callback in the SAX block
295 * - or better use the xmlSetExternalEntityLoader() function to
296 * set up it's own entity resolution routine
297 *
298 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
299 */
Owen Taylor3473f882001-02-23 17:55:21 +0000300typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000301 const xmlChar *publicId,
302 const xmlChar *systemId);
303/**
304 * internalSubsetSAXFunc:
305 * @ctx: the user data (XML parser context)
306 * @name: the root element name
307 * @ExternalID: the external ID
308 * @SystemID: the SYSTEM ID (e.g. filename or URL)
309 *
310 * Callback on internal subset declaration.
311 */
312typedef void (*internalSubsetSAXFunc) (void *ctx,
313 const xmlChar *name,
314 const xmlChar *ExternalID,
315 const xmlChar *SystemID);
316/**
317 * externalSubsetSAXFunc:
318 * @ctx: the user data (XML parser context)
319 * @name: the root element name
320 * @ExternalID: the external ID
321 * @SystemID: the SYSTEM ID (e.g. filename or URL)
322 *
323 * Callback on external subset declaration.
324 */
325typedef void (*externalSubsetSAXFunc) (void *ctx,
326 const xmlChar *name,
327 const xmlChar *ExternalID,
328 const xmlChar *SystemID);
329/**
330 * getEntitySAXFunc:
331 * @ctx: the user data (XML parser context)
332 * @name: The entity name
333 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000334 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000335 *
336 * Returns the xmlEntityPtr if found.
337 */
Owen Taylor3473f882001-02-23 17:55:21 +0000338typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000339 const xmlChar *name);
340/**
341 * getParameterEntitySAXFunc:
342 * @ctx: the user data (XML parser context)
343 * @name: The entity name
344 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000345 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000346 *
347 * Returns the xmlEntityPtr if found.
348 */
Owen Taylor3473f882001-02-23 17:55:21 +0000349typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000350 const xmlChar *name);
351/**
352 * entityDeclSAXFunc:
353 * @ctx: the user data (XML parser context)
354 * @name: the entity name
355 * @type: the entity type
356 * @publicId: The public ID of the entity
357 * @systemId: The system ID of the entity
358 * @content: the entity value (without processing).
359 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000360 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000361 */
Owen Taylor3473f882001-02-23 17:55:21 +0000362typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000363 const xmlChar *name,
364 int type,
365 const xmlChar *publicId,
366 const xmlChar *systemId,
367 xmlChar *content);
368/**
369 * notationDeclSAXFunc:
370 * @ctx: the user data (XML parser context)
371 * @name: The name of the notation
372 * @publicId: The public ID of the entity
373 * @systemId: The system ID of the entity
374 *
375 * What to do when a notation declaration has been parsed.
376 */
377typedef void (*notationDeclSAXFunc)(void *ctx,
378 const xmlChar *name,
379 const xmlChar *publicId,
380 const xmlChar *systemId);
381/**
382 * attributeDeclSAXFunc:
383 * @ctx: the user data (XML parser context)
384 * @elem: the name of the element
385 * @fullname: the attribute name
386 * @type: the attribute type
387 * @def: the type of default value
388 * @defaultValue: the attribute default value
389 * @tree: the tree of enumerated value set
390 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000391 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000392 */
393typedef void (*attributeDeclSAXFunc)(void *ctx,
394 const xmlChar *elem,
395 const xmlChar *fullname,
396 int type,
397 int def,
398 const xmlChar *defaultValue,
399 xmlEnumerationPtr tree);
400/**
401 * elementDeclSAXFunc:
402 * @ctx: the user data (XML parser context)
403 * @name: the element name
404 * @type: the element type
405 * @content: the element value tree
406 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000407 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000408 */
409typedef void (*elementDeclSAXFunc)(void *ctx,
410 const xmlChar *name,
411 int type,
412 xmlElementContentPtr content);
413/**
414 * unparsedEntityDeclSAXFunc:
415 * @ctx: the user data (XML parser context)
416 * @name: The name of the entity
417 * @publicId: The public ID of the entity
418 * @systemId: The system ID of the entity
419 * @notationName: the name of the notation
420 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000421 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000422 */
Owen Taylor3473f882001-02-23 17:55:21 +0000423typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000424 const xmlChar *name,
425 const xmlChar *publicId,
426 const xmlChar *systemId,
427 const xmlChar *notationName);
428/**
429 * setDocumentLocatorSAXFunc:
430 * @ctx: the user data (XML parser context)
431 * @loc: A SAX Locator
432 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000433 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000434 * Everything is available on the context, so this is useless in our case.
435 */
Owen Taylor3473f882001-02-23 17:55:21 +0000436typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000437 xmlSAXLocatorPtr loc);
438/**
439 * startDocumentSAXFunc:
440 * @ctx: the user data (XML parser context)
441 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000442 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000443 */
Owen Taylor3473f882001-02-23 17:55:21 +0000444typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000445/**
446 * endDocumentSAXFunc:
447 * @ctx: the user data (XML parser context)
448 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000449 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000450 */
Owen Taylor3473f882001-02-23 17:55:21 +0000451typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000452/**
453 * startElementSAXFunc:
454 * @ctx: the user data (XML parser context)
455 * @name: The element name, including namespace prefix
456 * @atts: An array of name/value attributes pairs, NULL terminated
457 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000458 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000459 */
460typedef void (*startElementSAXFunc) (void *ctx,
461 const xmlChar *name,
462 const xmlChar **atts);
463/**
464 * endElementSAXFunc:
465 * @ctx: the user data (XML parser context)
466 * @name: The element name
467 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000468 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000469 */
470typedef void (*endElementSAXFunc) (void *ctx,
471 const xmlChar *name);
472/**
473 * attributeSAXFunc:
474 * @ctx: the user data (XML parser context)
475 * @name: The attribute name, including namespace prefix
476 * @value: The attribute value
477 *
478 * Handle an attribute that has been read by the parser.
479 * The default handling is to convert the attribute into an
480 * DOM subtree and past it in a new xmlAttr element added to
481 * the element.
482 */
483typedef void (*attributeSAXFunc) (void *ctx,
484 const xmlChar *name,
485 const xmlChar *value);
486/**
487 * referenceSAXFunc:
488 * @ctx: the user data (XML parser context)
489 * @name: The entity name
490 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000491 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000492 */
493typedef void (*referenceSAXFunc) (void *ctx,
494 const xmlChar *name);
495/**
496 * charactersSAXFunc:
497 * @ctx: the user data (XML parser context)
498 * @ch: a xmlChar string
499 * @len: the number of xmlChar
500 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000501 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000502 */
503typedef void (*charactersSAXFunc) (void *ctx,
504 const xmlChar *ch,
505 int len);
506/**
507 * ignorableWhitespaceSAXFunc:
508 * @ctx: the user data (XML parser context)
509 * @ch: a xmlChar string
510 * @len: the number of xmlChar
511 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000512 * Receiving some ignorable whitespaces from the parser.
513 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000514 */
Owen Taylor3473f882001-02-23 17:55:21 +0000515typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000516 const xmlChar *ch,
517 int len);
518/**
519 * processingInstructionSAXFunc:
520 * @ctx: the user data (XML parser context)
521 * @target: the target name
522 * @data: the PI data's
523 *
524 * A processing instruction has been parsed.
525 */
Owen Taylor3473f882001-02-23 17:55:21 +0000526typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000527 const xmlChar *target,
528 const xmlChar *data);
529/**
530 * commentSAXFunc:
531 * @ctx: the user data (XML parser context)
532 * @value: the comment content
533 *
534 * A comment has been parsed.
535 */
536typedef void (*commentSAXFunc) (void *ctx,
537 const xmlChar *value);
538/**
539 * cdataBlockSAXFunc:
540 * @ctx: the user data (XML parser context)
541 * @value: The pcdata content
542 * @len: the block length
543 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000544 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000545 */
546typedef void (*cdataBlockSAXFunc) (
547 void *ctx,
548 const xmlChar *value,
549 int len);
550/**
551 * warningSAXFunc:
552 * @ctx: an XML parser context
553 * @msg: the message to display/transmit
554 * @...: extra parameters for the message display
555 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000556 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000557 */
558typedef void (*warningSAXFunc) (void *ctx,
559 const char *msg, ...);
560/**
561 * errorSAXFunc:
562 * @ctx: an XML parser context
563 * @msg: the message to display/transmit
564 * @...: extra parameters for the message display
565 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000566 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000567 */
568typedef void (*errorSAXFunc) (void *ctx,
569 const char *msg, ...);
570/**
571 * fatalErrorSAXFunc:
572 * @ctx: an XML parser context
573 * @msg: the message to display/transmit
574 * @...: extra parameters for the message display
575 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000576 * Display and format fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000577 * Note: so far fatalError() SAX callbacks are not used, error()
578 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000579 */
580typedef void (*fatalErrorSAXFunc) (void *ctx,
581 const char *msg, ...);
582/**
583 * isStandaloneSAXFunc:
584 * @ctx: the user data (XML parser context)
585 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000586 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000587 *
588 * Returns 1 if true
589 */
Owen Taylor3473f882001-02-23 17:55:21 +0000590typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000591/**
592 * hasInternalSubsetSAXFunc:
593 * @ctx: the user data (XML parser context)
594 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000595 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000596 *
597 * Returns 1 if true
598 */
Owen Taylor3473f882001-02-23 17:55:21 +0000599typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000600
Daniel Veillard9d06d302002-01-22 18:15:52 +0000601/**
602 * hasExternalSubsetSAXFunc:
603 * @ctx: the user data (XML parser context)
604 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000605 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000606 *
607 * Returns 1 if true
608 */
Owen Taylor3473f882001-02-23 17:55:21 +0000609typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
610
Daniel Veillard1af9a412003-08-20 22:54:39 +0000611/************************************************************************
612 * *
613 * The SAX version 2 API extensions *
614 * *
615 ************************************************************************/
616/**
617 * XML_SAX2_MAGIC:
618 *
619 * Special constant found in SAX2 blocks initialized fields
620 */
621#define XML_SAX2_MAGIC 0xDEEDBEAF
622
623/**
624 * startElementNsSAX2Func:
625 * @ctx: the user data (XML parser context)
626 * @localname: the local name of the element
627 * @prefix: the element namespace prefix if available
628 * @URI: the element namespace name if available
629 * @nb_namespaces: number of namespace definitions on that node
630 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
631 * @nb_attributes: the number of attributes on that node
Daniel Veillard07cb8222003-09-10 10:51:05 +0000632 * @nb_defaulted: the number of defaulted attributes. The defaulted
633 * ones are at the end of the array
634 * @attributes: pointer to the array of (localname/prefix/URI/value/end)
635 * attribute values.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000636 *
637 * SAX2 callback when an element start has been detected by the parser.
638 * It provides the namespace informations for the element, as well as
639 * the new namespace declarations on the element.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000640 */
641
642typedef void (*startElementNsSAX2Func) (void *ctx,
643 const xmlChar *localname,
644 const xmlChar *prefix,
645 const xmlChar *URI,
646 int nb_namespaces,
647 const xmlChar **namespaces,
Daniel Veillard07cb8222003-09-10 10:51:05 +0000648 int nb_attributes,
649 int nb_defaulted,
650 const xmlChar **attributes);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000651
652/**
653 * endElementNsSAX2Func:
654 * @ctx: the user data (XML parser context)
655 * @localname: the local name of the element
656 * @prefix: the element namespace prefix if available
657 * @URI: the element namespace name if available
658 *
659 * SAX2 callback when an element end has been detected by the parser.
660 * It provides the namespace informations for the element.
661 */
662
663typedef void (*endElementNsSAX2Func) (void *ctx,
664 const xmlChar *localname,
665 const xmlChar *prefix,
666 const xmlChar *URI);
667
Daniel Veillard1af9a412003-08-20 22:54:39 +0000668
Owen Taylor3473f882001-02-23 17:55:21 +0000669struct _xmlSAXHandler {
670 internalSubsetSAXFunc internalSubset;
671 isStandaloneSAXFunc isStandalone;
672 hasInternalSubsetSAXFunc hasInternalSubset;
673 hasExternalSubsetSAXFunc hasExternalSubset;
674 resolveEntitySAXFunc resolveEntity;
675 getEntitySAXFunc getEntity;
676 entityDeclSAXFunc entityDecl;
677 notationDeclSAXFunc notationDecl;
678 attributeDeclSAXFunc attributeDecl;
679 elementDeclSAXFunc elementDecl;
680 unparsedEntityDeclSAXFunc unparsedEntityDecl;
681 setDocumentLocatorSAXFunc setDocumentLocator;
682 startDocumentSAXFunc startDocument;
683 endDocumentSAXFunc endDocument;
684 startElementSAXFunc startElement;
685 endElementSAXFunc endElement;
686 referenceSAXFunc reference;
687 charactersSAXFunc characters;
688 ignorableWhitespaceSAXFunc ignorableWhitespace;
689 processingInstructionSAXFunc processingInstruction;
690 commentSAXFunc comment;
691 warningSAXFunc warning;
692 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000693 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000694 getParameterEntitySAXFunc getParameterEntity;
695 cdataBlockSAXFunc cdataBlock;
696 externalSubsetSAXFunc externalSubset;
Daniel Veillard07cb8222003-09-10 10:51:05 +0000697 unsigned int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000698 /* The following fields are extensions available only on version 2 */
699 void *_private;
700 startElementNsSAX2Func startElementNs;
701 endElementNsSAX2Func endElementNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000702};
703
704/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000705 * xmlExternalEntityLoader:
706 * @URL: The System ID of the resource requested
707 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000708 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000709 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000710 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000711 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000712 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000713 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000714typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
715 const char *ID,
716 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000717
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000718/*
Owen Taylor3473f882001-02-23 17:55:21 +0000719 * Global variables: just the default SAX interface tables and XML
720 * version infos.
721 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000722#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000723LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000724#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000725
Daniel Veillard0ba59232002-02-10 13:20:39 +0000726/*
Owen Taylor3473f882001-02-23 17:55:21 +0000727LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
728LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
729LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000730LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000731 */
Owen Taylor3473f882001-02-23 17:55:21 +0000732
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000733/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000734 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000735 */
736
Daniel Veillard0ba59232002-02-10 13:20:39 +0000737#if 0
738LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000739LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000740#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000741
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000742#ifdef __cplusplus
743}
744#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000745
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000746#include <libxml/encoding.h>
747#include <libxml/xmlIO.h>
748#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000749
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000750#ifdef __cplusplus
751extern "C" {
752#endif
753
Owen Taylor3473f882001-02-23 17:55:21 +0000754
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000755/*
Owen Taylor3473f882001-02-23 17:55:21 +0000756 * Init/Cleanup
757 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000758XMLPUBFUN void XMLCALL
759 xmlInitParser (void);
760XMLPUBFUN void XMLCALL
761 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000762
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000763/*
Owen Taylor3473f882001-02-23 17:55:21 +0000764 * Input functions
765 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000766XMLPUBFUN int XMLCALL
767 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000768 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000769XMLPUBFUN int XMLCALL
770 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000771 int len);
772
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000773/*
Owen Taylor3473f882001-02-23 17:55:21 +0000774 * xmlChar handling
775 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000776XMLPUBFUN xmlChar * XMLCALL
777 xmlStrdup (const xmlChar *cur);
778XMLPUBFUN xmlChar * XMLCALL
779 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000780 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000781XMLPUBFUN xmlChar * XMLCALL
782 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000783 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000784XMLPUBFUN xmlChar * XMLCALL
785 xmlCharStrdup (const char *cur);
786XMLPUBFUN xmlChar * XMLCALL
787 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000788 int start,
789 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000790XMLPUBFUN const xmlChar * XMLCALL
791 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000792 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000793XMLPUBFUN const xmlChar * XMLCALL
794 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000795 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000796XMLPUBFUN const xmlChar * XMLCALL
797 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000798 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000799XMLPUBFUN int XMLCALL
800 xmlStrcmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000801 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000802XMLPUBFUN int XMLCALL
803 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000804 const xmlChar *str2,
805 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000806XMLPUBFUN int XMLCALL
807 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000808 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000809XMLPUBFUN int XMLCALL
810 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000811 const xmlChar *str2,
812 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000813XMLPUBFUN int XMLCALL
814 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000815 const xmlChar *str2);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000816XMLPUBFUN int XMLCALL
817 xmlStrQEqual (const xmlChar *pref,
818 const xmlChar *name,
819 const xmlChar *str);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000820XMLPUBFUN int XMLCALL
821 xmlStrlen (const xmlChar *str);
822XMLPUBFUN xmlChar * XMLCALL
823 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000824 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000825XMLPUBFUN xmlChar * XMLCALL
826 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000827 const xmlChar *add,
828 int len);
829
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000830/*
Owen Taylor3473f882001-02-23 17:55:21 +0000831 * Basic parsing Interfaces
832 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000833XMLPUBFUN xmlDocPtr XMLCALL
834 xmlParseDoc (xmlChar *cur);
835XMLPUBFUN xmlDocPtr XMLCALL
836 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000837 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000838XMLPUBFUN xmlDocPtr XMLCALL
839 xmlParseFile (const char *filename);
840XMLPUBFUN int XMLCALL
841 xmlSubstituteEntitiesDefault(int val);
842XMLPUBFUN int XMLCALL
843 xmlKeepBlanksDefault (int val);
844XMLPUBFUN void XMLCALL
845 xmlStopParser (xmlParserCtxtPtr ctxt);
846XMLPUBFUN int XMLCALL
847 xmlPedanticParserDefault(int val);
848XMLPUBFUN int XMLCALL
849 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000850
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000851/*
Owen Taylor3473f882001-02-23 17:55:21 +0000852 * Recovery mode
853 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000854XMLPUBFUN xmlDocPtr XMLCALL
855 xmlRecoverDoc (xmlChar *cur);
856XMLPUBFUN xmlDocPtr XMLCALL
857 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000858 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000859XMLPUBFUN xmlDocPtr XMLCALL
860 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000861
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000862/*
Owen Taylor3473f882001-02-23 17:55:21 +0000863 * Less common routines and SAX interfaces
864 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000865XMLPUBFUN int XMLCALL
866 xmlParseDocument (xmlParserCtxtPtr ctxt);
867XMLPUBFUN int XMLCALL
868 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
869XMLPUBFUN xmlDocPtr XMLCALL
870 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000871 xmlChar *cur,
872 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000873XMLPUBFUN int XMLCALL
874 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000875 void *user_data,
876 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000877XMLPUBFUN int XMLCALL
878 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000879 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000880 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000881 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000882XMLPUBFUN xmlDocPtr XMLCALL
883 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000884 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000885 int size,
886 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000887XMLPUBFUN xmlDocPtr XMLCALL
888 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000889 const char *buffer,
890 int size,
891 int recovery,
892 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000893XMLPUBFUN xmlDocPtr XMLCALL
894 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000895 const char *filename,
896 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000897XMLPUBFUN xmlDocPtr XMLCALL
898 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000899 const char *filename,
900 int recovery,
901 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000902XMLPUBFUN xmlDocPtr XMLCALL
903 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000904 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000905XMLPUBFUN xmlDocPtr XMLCALL
906 xmlParseEntity (const char *filename);
907XMLPUBFUN xmlDtdPtr XMLCALL
908 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000909 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000910XMLPUBFUN xmlDtdPtr XMLCALL
911 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000912 const xmlChar *ExternalID,
913 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000914XMLPUBFUN xmlDtdPtr XMLCALL
915 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000916 xmlParserInputBufferPtr input,
917 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000918XMLPUBFUN int XMLCALL
919 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000920 xmlSAXHandlerPtr sax,
921 void *user_data,
922 int depth,
923 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000924 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000925XMLPUBFUN int XMLCALL
926 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000927 xmlSAXHandlerPtr sax,
928 void *user_data,
929 int depth,
930 const xmlChar *string,
931 xmlNodePtr *lst,
932 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000933XMLPUBFUN int XMLCALL
934 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000935 xmlSAXHandlerPtr sax,
936 void *user_data,
937 int depth,
938 const xmlChar *URL,
939 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000940 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000941XMLPUBFUN int XMLCALL
942 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000943 const xmlChar *URL,
944 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000945 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000946
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000947/*
Owen Taylor3473f882001-02-23 17:55:21 +0000948 * Parser contexts handling.
949 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000950XMLPUBFUN int XMLCALL
951 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
952XMLPUBFUN void XMLCALL
953 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
954XMLPUBFUN void XMLCALL
955 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
956XMLPUBFUN void XMLCALL
957 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000958 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000959 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000960XMLPUBFUN xmlParserCtxtPtr XMLCALL
961 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000962
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000963/*
Owen Taylor3473f882001-02-23 17:55:21 +0000964 * Reading/setting optional parsing features.
965 */
966
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000967XMLPUBFUN int XMLCALL
968 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000969 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000970XMLPUBFUN int XMLCALL
971 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000972 const char *name,
973 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000974XMLPUBFUN int XMLCALL
975 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000976 const char *name,
977 void *value);
978
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000979/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000980 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000981 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000982XMLPUBFUN xmlParserCtxtPtr XMLCALL
983 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000984 void *user_data,
985 const char *chunk,
986 int size,
987 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000988XMLPUBFUN int XMLCALL
989 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000990 const char *chunk,
991 int size,
992 int terminate);
993
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000994/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000995 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000996 */
997
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000998XMLPUBFUN xmlParserCtxtPtr XMLCALL
999 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +00001000 void *user_data,
1001 xmlInputReadCallback ioread,
1002 xmlInputCloseCallback ioclose,
1003 void *ioctx,
1004 xmlCharEncoding enc);
1005
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001006XMLPUBFUN xmlParserInputPtr XMLCALL
1007 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +00001008 xmlParserInputBufferPtr input,
1009 xmlCharEncoding enc);
1010
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001011/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001012 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001013 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001014XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001015 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1016 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001017XMLPUBFUN void XMLCALL
1018 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1019XMLPUBFUN void XMLCALL
1020 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1021XMLPUBFUN unsigned long XMLCALL
1022 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001023 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001024XMLPUBFUN void XMLCALL
1025 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001026 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001027
1028/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001029 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001030 */
1031
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001032XMLPUBFUN void XMLCALL
1033 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1034XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001035 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001036XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001037 xmlLoadExternalEntity (const char *URL,
1038 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001039 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001040
1041#ifdef __cplusplus
1042}
1043#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001044#endif /* __XML_PARSER_H__ */
1045