blob: 74e3185061d8cf32d5f452fee6748b290c978290 [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 */
Daniel Veillardbdbe0d42003-09-14 19:56:14 +000071 int id; /* an unique identifier for the entity */
Owen Taylor3473f882001-02-23 17:55:21 +000072};
73
74/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000075 * xmlParserNodeInfo:
76 *
Daniel Veillard61f26172002-03-12 18:46:39 +000077 * The parser can be asked to collect Node informations, i.e. at what
Owen Taylor3473f882001-02-23 17:55:21 +000078 * place in the file they were detected.
79 * NOTE: This is off by default and not very well tested.
80 */
81typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
82typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
83
84struct _xmlParserNodeInfo {
85 const struct _xmlNode* node;
86 /* Position & line # that text that created the node begins & ends on */
87 unsigned long begin_pos;
88 unsigned long begin_line;
89 unsigned long end_pos;
90 unsigned long end_line;
91};
92
93typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
94typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
95struct _xmlParserNodeInfoSeq {
96 unsigned long maximum;
97 unsigned long length;
98 xmlParserNodeInfo* buffer;
99};
100
101/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000102 * xmlParserInputState:
103 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000104 * The parser is now working also as a state based parser.
105 * The recursive one use the state info for entities processing.
Owen Taylor3473f882001-02-23 17:55:21 +0000106 */
107typedef enum {
108 XML_PARSER_EOF = -1, /* nothing is to be parsed */
109 XML_PARSER_START = 0, /* nothing has been parsed */
110 XML_PARSER_MISC, /* Misc* before int subset */
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000111 XML_PARSER_PI, /* Within a processing instruction */
Owen Taylor3473f882001-02-23 17:55:21 +0000112 XML_PARSER_DTD, /* within some DTD content */
113 XML_PARSER_PROLOG, /* Misc* after internal subset */
114 XML_PARSER_COMMENT, /* within a comment */
115 XML_PARSER_START_TAG, /* within a start tag */
116 XML_PARSER_CONTENT, /* within the content */
117 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
118 XML_PARSER_END_TAG, /* within a closing tag */
119 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
120 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
121 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
122 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
123 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
Daniel Veillard4a7ae502002-02-18 19:18:17 +0000124 XML_PARSER_IGNORE, /* within an IGNORED section */
125 XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
Owen Taylor3473f882001-02-23 17:55:21 +0000126} xmlParserInputState;
127
128/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000129 * XML_DETECT_IDS:
130 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000131 * Bit in the loadsubset context field to tell to do ID/REFs lookups.
132 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000133 */
134#define XML_DETECT_IDS 2
135
136/**
137 * XML_COMPLETE_ATTRS:
138 *
139 * Bit in the loadsubset context field to tell to do complete the
Daniel Veillard61f26172002-03-12 18:46:39 +0000140 * elements attributes lists with the ones defaulted from the DTDs.
141 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000142 */
143#define XML_COMPLETE_ATTRS 4
144
145/**
Daniel Veillardef8dd7b2003-03-23 12:02:56 +0000146 * XML_SKIP_IDS:
147 *
148 * Bit in the loadsubset context field to tell to not do ID/REFs registration.
149 * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
150 */
151#define XML_SKIP_IDS 8
152
153/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000154 * xmlParserCtxt:
155 *
Owen Taylor3473f882001-02-23 17:55:21 +0000156 * The parser context.
Daniel Veillard61f26172002-03-12 18:46:39 +0000157 * NOTE This doesn't completely define the parser state, the (current ?)
Owen Taylor3473f882001-02-23 17:55:21 +0000158 * design of the parser uses recursive function calls since this allow
159 * and easy mapping from the production rules of the specification
160 * to the actual code. The drawback is that the actual function call
161 * also reflect the parser state. However most of the parsing routines
162 * takes as the only argument the parser context pointer, so migrating
163 * to a state based parser for progressive parsing shouldn't be too hard.
164 */
Owen Taylor3473f882001-02-23 17:55:21 +0000165struct _xmlParserCtxt {
166 struct _xmlSAXHandler *sax; /* The SAX handler */
167 void *userData; /* For SAX interface only, used by DOM build */
168 xmlDocPtr myDoc; /* the document being built */
169 int wellFormed; /* is the document well formed */
170 int replaceEntities; /* shall we replace entities ? */
171 const xmlChar *version; /* the XML version string */
172 const xmlChar *encoding; /* the declared encoding, if any */
173 int standalone; /* standalone document */
174 int html; /* an HTML(1)/Docbook(2) document */
175
176 /* Input stream stack */
177 xmlParserInputPtr input; /* Current input stream */
178 int inputNr; /* Number of current input streams */
179 int inputMax; /* Max number of input streams */
180 xmlParserInputPtr *inputTab; /* stack of inputs */
181
182 /* Node analysis stack only used for DOM building */
183 xmlNodePtr node; /* Current parsed Node */
184 int nodeNr; /* Depth of the parsing stack */
185 int nodeMax; /* Max depth of the parsing stack */
186 xmlNodePtr *nodeTab; /* array of nodes */
187
188 int record_info; /* Whether node info should be kept */
189 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
190
191 int errNo; /* error code */
192
193 int hasExternalSubset; /* reference and external subset */
194 int hasPErefs; /* the internal subset has PE refs */
195 int external; /* are we parsing an external entity */
196
197 int valid; /* is the document valid */
198 int validate; /* shall we try to validate ? */
199 xmlValidCtxt vctxt; /* The validity context */
200
201 xmlParserInputState instate; /* current type of input */
202 int token; /* next char look-ahead */
203
204 char *directory; /* the data directory */
205
206 /* Node name stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000207 const xmlChar *name; /* Current parsed Node */
Owen Taylor3473f882001-02-23 17:55:21 +0000208 int nameNr; /* Depth of the parsing stack */
209 int nameMax; /* Max depth of the parsing stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000210 const xmlChar * *nameTab; /* array of nodes */
Owen Taylor3473f882001-02-23 17:55:21 +0000211
212 long nbChars; /* number of xmlChar processed */
213 long checkIndex; /* used by progressive parsing lookup */
214 int keepBlanks; /* ugly but ... */
215 int disableSAX; /* SAX callbacks are disabled */
216 int inSubset; /* Parsing is in int 1/ext 2 subset */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000217 const xmlChar * intSubName; /* name of subset */
Owen Taylor3473f882001-02-23 17:55:21 +0000218 xmlChar * extSubURI; /* URI of external subset */
219 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
220
221 /* xml:space values */
222 int * space; /* Should the parser preserve spaces */
223 int spaceNr; /* Depth of the parsing stack */
224 int spaceMax; /* Max depth of the parsing stack */
225 int * spaceTab; /* array of space infos */
226
227 int depth; /* to prevent entity substitution loops */
228 xmlParserInputPtr entity; /* used to check entities boundaries */
229 int charset; /* encoding of the in-memory content
230 actually an xmlCharEncoding */
231 int nodelen; /* Those two fields are there to */
232 int nodemem; /* Speed up large node parsing */
233 int pedantic; /* signal pedantic warnings */
234 void *_private; /* For user data, libxml won't touch it */
235
236 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000237 int linenumbers; /* set line number in element content */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000238 void *catalogs; /* document's own catalog */
Daniel Veillarddad3f682002-11-17 16:47:27 +0000239 int recovery; /* run in recovery mode */
Daniel Veillarda880b122003-04-21 21:36:41 +0000240 int progressive; /* is this a progressive parsing */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000241 xmlDictPtr dict; /* dictionnary for the parser */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000242 const xmlChar * *atts; /* array for the attributes callbacks */
Daniel Veillard6155d8a2003-08-19 15:01:28 +0000243 int maxatts; /* the size of the array */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000244 int docdict; /* use strings from dict to build tree */
Daniel Veillard0fb18932003-09-07 09:14:37 +0000245
246 /*
247 * pre-interned strings
248 */
249 const xmlChar *str_xml;
250 const xmlChar *str_xmlns;
Daniel Veillard07cb8222003-09-10 10:51:05 +0000251 const xmlChar *str_xml_ns;
Daniel Veillard0fb18932003-09-07 09:14:37 +0000252
253 /*
Daniel Veillard07cb8222003-09-10 10:51:05 +0000254 * Everything below is used only by the new SAX mode
Daniel Veillard0fb18932003-09-07 09:14:37 +0000255 */
256 int sax2; /* operating in the new SAX mode */
257 int nsNr; /* the number of inherited namespaces */
258 int nsMax; /* the size of the arrays */
259 const xmlChar * *nsTab; /* the array of prefix/namespace name */
Daniel Veillard07cb8222003-09-10 10:51:05 +0000260 int *attallocs; /* which attribute were allocated */
261 void * *pushTab; /* array of data for push */
262 xmlHashTablePtr attsDefault; /* defaulted attributes if any */
263 xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
Daniel Veillard3b7840c2003-09-11 23:42:01 +0000264 int nsWellFormed; /* is the document XML Nanespace okay */
Daniel Veillard8a44e592003-09-15 14:50:06 +0000265
266 /*
267 * Those fields are needed only for treaming parsing so far
268 */
269 int dictNames; /* Use dictionary names for the tree */
270 xmlNodePtr freeElems; /* List of freed element nodes */
271 xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
Owen Taylor3473f882001-02-23 17:55:21 +0000272};
273
274/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000275 * xmlSAXLocator:
276 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000277 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000278 */
Owen Taylor3473f882001-02-23 17:55:21 +0000279struct _xmlSAXLocator {
280 const xmlChar *(*getPublicId)(void *ctx);
281 const xmlChar *(*getSystemId)(void *ctx);
282 int (*getLineNumber)(void *ctx);
283 int (*getColumnNumber)(void *ctx);
284};
285
286/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000287 * xmlSAXHandler:
288 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000289 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000290 * of the input generate data or structure informations.
291 */
292
Daniel Veillard9d06d302002-01-22 18:15:52 +0000293/**
294 * resolveEntitySAXFunc:
295 * @ctx: the user data (XML parser context)
296 * @publicId: The public ID of the entity
297 * @systemId: The system ID of the entity
298 *
299 * Callback:
300 * The entity loader, to control the loading of external entities,
301 * the application can either:
302 * - override this resolveEntity() callback in the SAX block
303 * - or better use the xmlSetExternalEntityLoader() function to
304 * set up it's own entity resolution routine
305 *
306 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
307 */
Owen Taylor3473f882001-02-23 17:55:21 +0000308typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000309 const xmlChar *publicId,
310 const xmlChar *systemId);
311/**
312 * internalSubsetSAXFunc:
313 * @ctx: the user data (XML parser context)
314 * @name: the root element name
315 * @ExternalID: the external ID
316 * @SystemID: the SYSTEM ID (e.g. filename or URL)
317 *
318 * Callback on internal subset declaration.
319 */
320typedef void (*internalSubsetSAXFunc) (void *ctx,
321 const xmlChar *name,
322 const xmlChar *ExternalID,
323 const xmlChar *SystemID);
324/**
325 * externalSubsetSAXFunc:
326 * @ctx: the user data (XML parser context)
327 * @name: the root element name
328 * @ExternalID: the external ID
329 * @SystemID: the SYSTEM ID (e.g. filename or URL)
330 *
331 * Callback on external subset declaration.
332 */
333typedef void (*externalSubsetSAXFunc) (void *ctx,
334 const xmlChar *name,
335 const xmlChar *ExternalID,
336 const xmlChar *SystemID);
337/**
338 * getEntitySAXFunc:
339 * @ctx: the user data (XML parser context)
340 * @name: The entity name
341 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000342 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000343 *
344 * Returns the xmlEntityPtr if found.
345 */
Owen Taylor3473f882001-02-23 17:55:21 +0000346typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000347 const xmlChar *name);
348/**
349 * getParameterEntitySAXFunc:
350 * @ctx: the user data (XML parser context)
351 * @name: The entity name
352 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000353 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000354 *
355 * Returns the xmlEntityPtr if found.
356 */
Owen Taylor3473f882001-02-23 17:55:21 +0000357typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000358 const xmlChar *name);
359/**
360 * entityDeclSAXFunc:
361 * @ctx: the user data (XML parser context)
362 * @name: the entity name
363 * @type: the entity type
364 * @publicId: The public ID of the entity
365 * @systemId: The system ID of the entity
366 * @content: the entity value (without processing).
367 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000368 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000369 */
Owen Taylor3473f882001-02-23 17:55:21 +0000370typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000371 const xmlChar *name,
372 int type,
373 const xmlChar *publicId,
374 const xmlChar *systemId,
375 xmlChar *content);
376/**
377 * notationDeclSAXFunc:
378 * @ctx: the user data (XML parser context)
379 * @name: The name of the notation
380 * @publicId: The public ID of the entity
381 * @systemId: The system ID of the entity
382 *
383 * What to do when a notation declaration has been parsed.
384 */
385typedef void (*notationDeclSAXFunc)(void *ctx,
386 const xmlChar *name,
387 const xmlChar *publicId,
388 const xmlChar *systemId);
389/**
390 * attributeDeclSAXFunc:
391 * @ctx: the user data (XML parser context)
392 * @elem: the name of the element
393 * @fullname: the attribute name
394 * @type: the attribute type
395 * @def: the type of default value
396 * @defaultValue: the attribute default value
397 * @tree: the tree of enumerated value set
398 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000399 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000400 */
401typedef void (*attributeDeclSAXFunc)(void *ctx,
402 const xmlChar *elem,
403 const xmlChar *fullname,
404 int type,
405 int def,
406 const xmlChar *defaultValue,
407 xmlEnumerationPtr tree);
408/**
409 * elementDeclSAXFunc:
410 * @ctx: the user data (XML parser context)
411 * @name: the element name
412 * @type: the element type
413 * @content: the element value tree
414 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000415 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000416 */
417typedef void (*elementDeclSAXFunc)(void *ctx,
418 const xmlChar *name,
419 int type,
420 xmlElementContentPtr content);
421/**
422 * unparsedEntityDeclSAXFunc:
423 * @ctx: the user data (XML parser context)
424 * @name: The name of the entity
425 * @publicId: The public ID of the entity
426 * @systemId: The system ID of the entity
427 * @notationName: the name of the notation
428 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000429 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000430 */
Owen Taylor3473f882001-02-23 17:55:21 +0000431typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000432 const xmlChar *name,
433 const xmlChar *publicId,
434 const xmlChar *systemId,
435 const xmlChar *notationName);
436/**
437 * setDocumentLocatorSAXFunc:
438 * @ctx: the user data (XML parser context)
439 * @loc: A SAX Locator
440 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000441 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000442 * Everything is available on the context, so this is useless in our case.
443 */
Owen Taylor3473f882001-02-23 17:55:21 +0000444typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000445 xmlSAXLocatorPtr loc);
446/**
447 * startDocumentSAXFunc:
448 * @ctx: the user data (XML parser context)
449 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000450 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000451 */
Owen Taylor3473f882001-02-23 17:55:21 +0000452typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000453/**
454 * endDocumentSAXFunc:
455 * @ctx: the user data (XML parser context)
456 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000457 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000458 */
Owen Taylor3473f882001-02-23 17:55:21 +0000459typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000460/**
461 * startElementSAXFunc:
462 * @ctx: the user data (XML parser context)
463 * @name: The element name, including namespace prefix
464 * @atts: An array of name/value attributes pairs, NULL terminated
465 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000466 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000467 */
468typedef void (*startElementSAXFunc) (void *ctx,
469 const xmlChar *name,
470 const xmlChar **atts);
471/**
472 * endElementSAXFunc:
473 * @ctx: the user data (XML parser context)
474 * @name: The element name
475 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000476 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000477 */
478typedef void (*endElementSAXFunc) (void *ctx,
479 const xmlChar *name);
480/**
481 * attributeSAXFunc:
482 * @ctx: the user data (XML parser context)
483 * @name: The attribute name, including namespace prefix
484 * @value: The attribute value
485 *
486 * Handle an attribute that has been read by the parser.
487 * The default handling is to convert the attribute into an
488 * DOM subtree and past it in a new xmlAttr element added to
489 * the element.
490 */
491typedef void (*attributeSAXFunc) (void *ctx,
492 const xmlChar *name,
493 const xmlChar *value);
494/**
495 * referenceSAXFunc:
496 * @ctx: the user data (XML parser context)
497 * @name: The entity name
498 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000499 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000500 */
501typedef void (*referenceSAXFunc) (void *ctx,
502 const xmlChar *name);
503/**
504 * charactersSAXFunc:
505 * @ctx: the user data (XML parser context)
506 * @ch: a xmlChar string
507 * @len: the number of xmlChar
508 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000509 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000510 */
511typedef void (*charactersSAXFunc) (void *ctx,
512 const xmlChar *ch,
513 int len);
514/**
515 * ignorableWhitespaceSAXFunc:
516 * @ctx: the user data (XML parser context)
517 * @ch: a xmlChar string
518 * @len: the number of xmlChar
519 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000520 * Receiving some ignorable whitespaces from the parser.
521 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000522 */
Owen Taylor3473f882001-02-23 17:55:21 +0000523typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000524 const xmlChar *ch,
525 int len);
526/**
527 * processingInstructionSAXFunc:
528 * @ctx: the user data (XML parser context)
529 * @target: the target name
530 * @data: the PI data's
531 *
532 * A processing instruction has been parsed.
533 */
Owen Taylor3473f882001-02-23 17:55:21 +0000534typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000535 const xmlChar *target,
536 const xmlChar *data);
537/**
538 * commentSAXFunc:
539 * @ctx: the user data (XML parser context)
540 * @value: the comment content
541 *
542 * A comment has been parsed.
543 */
544typedef void (*commentSAXFunc) (void *ctx,
545 const xmlChar *value);
546/**
547 * cdataBlockSAXFunc:
548 * @ctx: the user data (XML parser context)
549 * @value: The pcdata content
550 * @len: the block length
551 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000552 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000553 */
554typedef void (*cdataBlockSAXFunc) (
555 void *ctx,
556 const xmlChar *value,
557 int len);
558/**
559 * warningSAXFunc:
560 * @ctx: an XML parser context
561 * @msg: the message to display/transmit
562 * @...: extra parameters for the message display
563 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000564 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000565 */
566typedef void (*warningSAXFunc) (void *ctx,
567 const char *msg, ...);
568/**
569 * errorSAXFunc:
570 * @ctx: an XML parser context
571 * @msg: the message to display/transmit
572 * @...: extra parameters for the message display
573 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000574 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000575 */
576typedef void (*errorSAXFunc) (void *ctx,
577 const char *msg, ...);
578/**
579 * fatalErrorSAXFunc:
580 * @ctx: an XML parser context
581 * @msg: the message to display/transmit
582 * @...: extra parameters for the message display
583 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000584 * Display and format fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000585 * Note: so far fatalError() SAX callbacks are not used, error()
586 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000587 */
588typedef void (*fatalErrorSAXFunc) (void *ctx,
589 const char *msg, ...);
590/**
591 * isStandaloneSAXFunc:
592 * @ctx: the user data (XML parser context)
593 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000594 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000595 *
596 * Returns 1 if true
597 */
Owen Taylor3473f882001-02-23 17:55:21 +0000598typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000599/**
600 * hasInternalSubsetSAXFunc:
601 * @ctx: the user data (XML parser context)
602 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000603 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000604 *
605 * Returns 1 if true
606 */
Owen Taylor3473f882001-02-23 17:55:21 +0000607typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000608
Daniel Veillard9d06d302002-01-22 18:15:52 +0000609/**
610 * hasExternalSubsetSAXFunc:
611 * @ctx: the user data (XML parser context)
612 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000613 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000614 *
615 * Returns 1 if true
616 */
Owen Taylor3473f882001-02-23 17:55:21 +0000617typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
618
Daniel Veillard1af9a412003-08-20 22:54:39 +0000619/************************************************************************
620 * *
621 * The SAX version 2 API extensions *
622 * *
623 ************************************************************************/
624/**
625 * XML_SAX2_MAGIC:
626 *
627 * Special constant found in SAX2 blocks initialized fields
628 */
629#define XML_SAX2_MAGIC 0xDEEDBEAF
630
631/**
632 * startElementNsSAX2Func:
633 * @ctx: the user data (XML parser context)
634 * @localname: the local name of the element
635 * @prefix: the element namespace prefix if available
636 * @URI: the element namespace name if available
637 * @nb_namespaces: number of namespace definitions on that node
638 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
639 * @nb_attributes: the number of attributes on that node
Daniel Veillard07cb8222003-09-10 10:51:05 +0000640 * @nb_defaulted: the number of defaulted attributes. The defaulted
641 * ones are at the end of the array
642 * @attributes: pointer to the array of (localname/prefix/URI/value/end)
643 * attribute values.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000644 *
645 * SAX2 callback when an element start has been detected by the parser.
646 * It provides the namespace informations for the element, as well as
647 * the new namespace declarations on the element.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000648 */
649
650typedef void (*startElementNsSAX2Func) (void *ctx,
651 const xmlChar *localname,
652 const xmlChar *prefix,
653 const xmlChar *URI,
654 int nb_namespaces,
655 const xmlChar **namespaces,
Daniel Veillard07cb8222003-09-10 10:51:05 +0000656 int nb_attributes,
657 int nb_defaulted,
658 const xmlChar **attributes);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000659
660/**
661 * endElementNsSAX2Func:
662 * @ctx: the user data (XML parser context)
663 * @localname: the local name of the element
664 * @prefix: the element namespace prefix if available
665 * @URI: the element namespace name if available
666 *
667 * SAX2 callback when an element end has been detected by the parser.
668 * It provides the namespace informations for the element.
669 */
670
671typedef void (*endElementNsSAX2Func) (void *ctx,
672 const xmlChar *localname,
673 const xmlChar *prefix,
674 const xmlChar *URI);
675
Daniel Veillard1af9a412003-08-20 22:54:39 +0000676
Owen Taylor3473f882001-02-23 17:55:21 +0000677struct _xmlSAXHandler {
678 internalSubsetSAXFunc internalSubset;
679 isStandaloneSAXFunc isStandalone;
680 hasInternalSubsetSAXFunc hasInternalSubset;
681 hasExternalSubsetSAXFunc hasExternalSubset;
682 resolveEntitySAXFunc resolveEntity;
683 getEntitySAXFunc getEntity;
684 entityDeclSAXFunc entityDecl;
685 notationDeclSAXFunc notationDecl;
686 attributeDeclSAXFunc attributeDecl;
687 elementDeclSAXFunc elementDecl;
688 unparsedEntityDeclSAXFunc unparsedEntityDecl;
689 setDocumentLocatorSAXFunc setDocumentLocator;
690 startDocumentSAXFunc startDocument;
691 endDocumentSAXFunc endDocument;
692 startElementSAXFunc startElement;
693 endElementSAXFunc endElement;
694 referenceSAXFunc reference;
695 charactersSAXFunc characters;
696 ignorableWhitespaceSAXFunc ignorableWhitespace;
697 processingInstructionSAXFunc processingInstruction;
698 commentSAXFunc comment;
699 warningSAXFunc warning;
700 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000701 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000702 getParameterEntitySAXFunc getParameterEntity;
703 cdataBlockSAXFunc cdataBlock;
704 externalSubsetSAXFunc externalSubset;
Daniel Veillard07cb8222003-09-10 10:51:05 +0000705 unsigned int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000706 /* The following fields are extensions available only on version 2 */
707 void *_private;
708 startElementNsSAX2Func startElementNs;
709 endElementNsSAX2Func endElementNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000710};
711
712/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000713 * xmlExternalEntityLoader:
714 * @URL: The System ID of the resource requested
715 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000716 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000717 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000718 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000719 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000720 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000721 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000722typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
723 const char *ID,
724 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000725
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000726/*
Owen Taylor3473f882001-02-23 17:55:21 +0000727 * Global variables: just the default SAX interface tables and XML
728 * version infos.
729 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000730#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000731LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000732#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000733
Daniel Veillard0ba59232002-02-10 13:20:39 +0000734/*
Owen Taylor3473f882001-02-23 17:55:21 +0000735LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
736LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
737LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000738LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000739 */
Owen Taylor3473f882001-02-23 17:55:21 +0000740
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000741/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000742 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000743 */
744
Daniel Veillard0ba59232002-02-10 13:20:39 +0000745#if 0
746LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000747LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000748#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000749
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000750#ifdef __cplusplus
751}
752#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000753
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000754#include <libxml/encoding.h>
755#include <libxml/xmlIO.h>
756#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000757
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000758#ifdef __cplusplus
759extern "C" {
760#endif
761
Owen Taylor3473f882001-02-23 17:55:21 +0000762
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000763/*
Owen Taylor3473f882001-02-23 17:55:21 +0000764 * Init/Cleanup
765 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000766XMLPUBFUN void XMLCALL
767 xmlInitParser (void);
768XMLPUBFUN void XMLCALL
769 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000770
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000771/*
Owen Taylor3473f882001-02-23 17:55:21 +0000772 * Input functions
773 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000774XMLPUBFUN int XMLCALL
775 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000776 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000777XMLPUBFUN int XMLCALL
778 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000779 int len);
780
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000781/*
Owen Taylor3473f882001-02-23 17:55:21 +0000782 * xmlChar handling
783 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000784XMLPUBFUN xmlChar * XMLCALL
785 xmlStrdup (const xmlChar *cur);
786XMLPUBFUN xmlChar * XMLCALL
787 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000788 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000789XMLPUBFUN xmlChar * XMLCALL
790 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000791 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000792XMLPUBFUN xmlChar * XMLCALL
793 xmlCharStrdup (const char *cur);
794XMLPUBFUN xmlChar * XMLCALL
795 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000796 int start,
797 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000798XMLPUBFUN const xmlChar * XMLCALL
799 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000800 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000801XMLPUBFUN const xmlChar * XMLCALL
802 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000803 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000804XMLPUBFUN const xmlChar * XMLCALL
805 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000806 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000807XMLPUBFUN int XMLCALL
808 xmlStrcmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000809 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000810XMLPUBFUN int XMLCALL
811 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000812 const xmlChar *str2,
813 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000814XMLPUBFUN int XMLCALL
815 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000816 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000817XMLPUBFUN int XMLCALL
818 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000819 const xmlChar *str2,
820 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000821XMLPUBFUN int XMLCALL
822 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000823 const xmlChar *str2);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000824XMLPUBFUN int XMLCALL
825 xmlStrQEqual (const xmlChar *pref,
826 const xmlChar *name,
827 const xmlChar *str);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000828XMLPUBFUN int XMLCALL
829 xmlStrlen (const xmlChar *str);
830XMLPUBFUN xmlChar * XMLCALL
831 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000832 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000833XMLPUBFUN xmlChar * XMLCALL
834 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000835 const xmlChar *add,
836 int len);
837
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000838/*
Owen Taylor3473f882001-02-23 17:55:21 +0000839 * Basic parsing Interfaces
840 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000841XMLPUBFUN xmlDocPtr XMLCALL
842 xmlParseDoc (xmlChar *cur);
843XMLPUBFUN xmlDocPtr XMLCALL
844 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000845 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000846XMLPUBFUN xmlDocPtr XMLCALL
847 xmlParseFile (const char *filename);
848XMLPUBFUN int XMLCALL
849 xmlSubstituteEntitiesDefault(int val);
850XMLPUBFUN int XMLCALL
851 xmlKeepBlanksDefault (int val);
852XMLPUBFUN void XMLCALL
853 xmlStopParser (xmlParserCtxtPtr ctxt);
854XMLPUBFUN int XMLCALL
855 xmlPedanticParserDefault(int val);
856XMLPUBFUN int XMLCALL
857 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000858
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000859/*
Owen Taylor3473f882001-02-23 17:55:21 +0000860 * Recovery mode
861 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000862XMLPUBFUN xmlDocPtr XMLCALL
863 xmlRecoverDoc (xmlChar *cur);
864XMLPUBFUN xmlDocPtr XMLCALL
865 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000866 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000867XMLPUBFUN xmlDocPtr XMLCALL
868 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000869
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000870/*
Owen Taylor3473f882001-02-23 17:55:21 +0000871 * Less common routines and SAX interfaces
872 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000873XMLPUBFUN int XMLCALL
874 xmlParseDocument (xmlParserCtxtPtr ctxt);
875XMLPUBFUN int XMLCALL
876 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
877XMLPUBFUN xmlDocPtr XMLCALL
878 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000879 xmlChar *cur,
880 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000881XMLPUBFUN int XMLCALL
882 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000883 void *user_data,
884 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000885XMLPUBFUN int XMLCALL
886 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000887 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000888 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000889 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000890XMLPUBFUN xmlDocPtr XMLCALL
891 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000892 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000893 int size,
894 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000895XMLPUBFUN xmlDocPtr XMLCALL
896 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000897 const char *buffer,
898 int size,
899 int recovery,
900 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000901XMLPUBFUN xmlDocPtr XMLCALL
902 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000903 const char *filename,
904 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000905XMLPUBFUN xmlDocPtr XMLCALL
906 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000907 const char *filename,
908 int recovery,
909 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000910XMLPUBFUN xmlDocPtr XMLCALL
911 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000912 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000913XMLPUBFUN xmlDocPtr XMLCALL
914 xmlParseEntity (const char *filename);
915XMLPUBFUN xmlDtdPtr XMLCALL
916 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000917 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000918XMLPUBFUN xmlDtdPtr XMLCALL
919 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000920 const xmlChar *ExternalID,
921 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000922XMLPUBFUN xmlDtdPtr XMLCALL
923 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000924 xmlParserInputBufferPtr input,
925 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000926XMLPUBFUN int XMLCALL
927 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000928 xmlSAXHandlerPtr sax,
929 void *user_data,
930 int depth,
931 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000932 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000933XMLPUBFUN int XMLCALL
934 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000935 xmlSAXHandlerPtr sax,
936 void *user_data,
937 int depth,
938 const xmlChar *string,
939 xmlNodePtr *lst,
940 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000941XMLPUBFUN int XMLCALL
942 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000943 xmlSAXHandlerPtr sax,
944 void *user_data,
945 int depth,
946 const xmlChar *URL,
947 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000948 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000949XMLPUBFUN int XMLCALL
950 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000951 const xmlChar *URL,
952 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000953 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000954
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000955/*
Owen Taylor3473f882001-02-23 17:55:21 +0000956 * Parser contexts handling.
957 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000958XMLPUBFUN int XMLCALL
959 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
960XMLPUBFUN void XMLCALL
961 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
962XMLPUBFUN void XMLCALL
963 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
964XMLPUBFUN void XMLCALL
965 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000966 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000967 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000968XMLPUBFUN xmlParserCtxtPtr XMLCALL
969 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000970
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000971/*
Owen Taylor3473f882001-02-23 17:55:21 +0000972 * Reading/setting optional parsing features.
973 */
974
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000975XMLPUBFUN int XMLCALL
976 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000977 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000978XMLPUBFUN int XMLCALL
979 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000980 const char *name,
981 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000982XMLPUBFUN int XMLCALL
983 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000984 const char *name,
985 void *value);
986
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000987/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000988 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000989 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000990XMLPUBFUN xmlParserCtxtPtr XMLCALL
991 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000992 void *user_data,
993 const char *chunk,
994 int size,
995 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000996XMLPUBFUN int XMLCALL
997 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000998 const char *chunk,
999 int size,
1000 int terminate);
1001
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001002/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001003 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +00001004 */
1005
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001006XMLPUBFUN xmlParserCtxtPtr XMLCALL
1007 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +00001008 void *user_data,
1009 xmlInputReadCallback ioread,
1010 xmlInputCloseCallback ioclose,
1011 void *ioctx,
1012 xmlCharEncoding enc);
1013
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001014XMLPUBFUN xmlParserInputPtr XMLCALL
1015 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +00001016 xmlParserInputBufferPtr input,
1017 xmlCharEncoding enc);
1018
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001019/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001020 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001021 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001022XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001023 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1024 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001025XMLPUBFUN void XMLCALL
1026 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1027XMLPUBFUN void XMLCALL
1028 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1029XMLPUBFUN unsigned long XMLCALL
1030 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001031 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001032XMLPUBFUN void XMLCALL
1033 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001034 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001035
1036/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001037 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001038 */
1039
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001040XMLPUBFUN void XMLCALL
1041 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1042XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001043 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001044XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001045 xmlLoadExternalEntity (const char *URL,
1046 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001047 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001048
1049#ifdef __cplusplus
1050}
1051#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001052#endif /* __XML_PARSER_H__ */
1053