blob: 967f3fd1f846e23cfd8cb6946f26f376b9709e1b [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 */
Owen Taylor3473f882001-02-23 17:55:21 +0000263};
264
265/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000266 * xmlSAXLocator:
267 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000268 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000269 */
Owen Taylor3473f882001-02-23 17:55:21 +0000270struct _xmlSAXLocator {
271 const xmlChar *(*getPublicId)(void *ctx);
272 const xmlChar *(*getSystemId)(void *ctx);
273 int (*getLineNumber)(void *ctx);
274 int (*getColumnNumber)(void *ctx);
275};
276
277/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000278 * xmlSAXHandler:
279 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000280 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000281 * of the input generate data or structure informations.
282 */
283
Daniel Veillard9d06d302002-01-22 18:15:52 +0000284/**
285 * resolveEntitySAXFunc:
286 * @ctx: the user data (XML parser context)
287 * @publicId: The public ID of the entity
288 * @systemId: The system ID of the entity
289 *
290 * Callback:
291 * The entity loader, to control the loading of external entities,
292 * the application can either:
293 * - override this resolveEntity() callback in the SAX block
294 * - or better use the xmlSetExternalEntityLoader() function to
295 * set up it's own entity resolution routine
296 *
297 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
298 */
Owen Taylor3473f882001-02-23 17:55:21 +0000299typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000300 const xmlChar *publicId,
301 const xmlChar *systemId);
302/**
303 * internalSubsetSAXFunc:
304 * @ctx: the user data (XML parser context)
305 * @name: the root element name
306 * @ExternalID: the external ID
307 * @SystemID: the SYSTEM ID (e.g. filename or URL)
308 *
309 * Callback on internal subset declaration.
310 */
311typedef void (*internalSubsetSAXFunc) (void *ctx,
312 const xmlChar *name,
313 const xmlChar *ExternalID,
314 const xmlChar *SystemID);
315/**
316 * externalSubsetSAXFunc:
317 * @ctx: the user data (XML parser context)
318 * @name: the root element name
319 * @ExternalID: the external ID
320 * @SystemID: the SYSTEM ID (e.g. filename or URL)
321 *
322 * Callback on external subset declaration.
323 */
324typedef void (*externalSubsetSAXFunc) (void *ctx,
325 const xmlChar *name,
326 const xmlChar *ExternalID,
327 const xmlChar *SystemID);
328/**
329 * getEntitySAXFunc:
330 * @ctx: the user data (XML parser context)
331 * @name: The entity name
332 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000333 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000334 *
335 * Returns the xmlEntityPtr if found.
336 */
Owen Taylor3473f882001-02-23 17:55:21 +0000337typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000338 const xmlChar *name);
339/**
340 * getParameterEntitySAXFunc:
341 * @ctx: the user data (XML parser context)
342 * @name: The entity name
343 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000344 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000345 *
346 * Returns the xmlEntityPtr if found.
347 */
Owen Taylor3473f882001-02-23 17:55:21 +0000348typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000349 const xmlChar *name);
350/**
351 * entityDeclSAXFunc:
352 * @ctx: the user data (XML parser context)
353 * @name: the entity name
354 * @type: the entity type
355 * @publicId: The public ID of the entity
356 * @systemId: The system ID of the entity
357 * @content: the entity value (without processing).
358 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000359 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000360 */
Owen Taylor3473f882001-02-23 17:55:21 +0000361typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000362 const xmlChar *name,
363 int type,
364 const xmlChar *publicId,
365 const xmlChar *systemId,
366 xmlChar *content);
367/**
368 * notationDeclSAXFunc:
369 * @ctx: the user data (XML parser context)
370 * @name: The name of the notation
371 * @publicId: The public ID of the entity
372 * @systemId: The system ID of the entity
373 *
374 * What to do when a notation declaration has been parsed.
375 */
376typedef void (*notationDeclSAXFunc)(void *ctx,
377 const xmlChar *name,
378 const xmlChar *publicId,
379 const xmlChar *systemId);
380/**
381 * attributeDeclSAXFunc:
382 * @ctx: the user data (XML parser context)
383 * @elem: the name of the element
384 * @fullname: the attribute name
385 * @type: the attribute type
386 * @def: the type of default value
387 * @defaultValue: the attribute default value
388 * @tree: the tree of enumerated value set
389 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000390 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000391 */
392typedef void (*attributeDeclSAXFunc)(void *ctx,
393 const xmlChar *elem,
394 const xmlChar *fullname,
395 int type,
396 int def,
397 const xmlChar *defaultValue,
398 xmlEnumerationPtr tree);
399/**
400 * elementDeclSAXFunc:
401 * @ctx: the user data (XML parser context)
402 * @name: the element name
403 * @type: the element type
404 * @content: the element value tree
405 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000406 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000407 */
408typedef void (*elementDeclSAXFunc)(void *ctx,
409 const xmlChar *name,
410 int type,
411 xmlElementContentPtr content);
412/**
413 * unparsedEntityDeclSAXFunc:
414 * @ctx: the user data (XML parser context)
415 * @name: The name of the entity
416 * @publicId: The public ID of the entity
417 * @systemId: The system ID of the entity
418 * @notationName: the name of the notation
419 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000420 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000421 */
Owen Taylor3473f882001-02-23 17:55:21 +0000422typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000423 const xmlChar *name,
424 const xmlChar *publicId,
425 const xmlChar *systemId,
426 const xmlChar *notationName);
427/**
428 * setDocumentLocatorSAXFunc:
429 * @ctx: the user data (XML parser context)
430 * @loc: A SAX Locator
431 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000432 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000433 * Everything is available on the context, so this is useless in our case.
434 */
Owen Taylor3473f882001-02-23 17:55:21 +0000435typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000436 xmlSAXLocatorPtr loc);
437/**
438 * startDocumentSAXFunc:
439 * @ctx: the user data (XML parser context)
440 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000441 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000442 */
Owen Taylor3473f882001-02-23 17:55:21 +0000443typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000444/**
445 * endDocumentSAXFunc:
446 * @ctx: the user data (XML parser context)
447 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000448 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000449 */
Owen Taylor3473f882001-02-23 17:55:21 +0000450typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000451/**
452 * startElementSAXFunc:
453 * @ctx: the user data (XML parser context)
454 * @name: The element name, including namespace prefix
455 * @atts: An array of name/value attributes pairs, NULL terminated
456 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000457 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000458 */
459typedef void (*startElementSAXFunc) (void *ctx,
460 const xmlChar *name,
461 const xmlChar **atts);
462/**
463 * endElementSAXFunc:
464 * @ctx: the user data (XML parser context)
465 * @name: The element name
466 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000467 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000468 */
469typedef void (*endElementSAXFunc) (void *ctx,
470 const xmlChar *name);
471/**
472 * attributeSAXFunc:
473 * @ctx: the user data (XML parser context)
474 * @name: The attribute name, including namespace prefix
475 * @value: The attribute value
476 *
477 * Handle an attribute that has been read by the parser.
478 * The default handling is to convert the attribute into an
479 * DOM subtree and past it in a new xmlAttr element added to
480 * the element.
481 */
482typedef void (*attributeSAXFunc) (void *ctx,
483 const xmlChar *name,
484 const xmlChar *value);
485/**
486 * referenceSAXFunc:
487 * @ctx: the user data (XML parser context)
488 * @name: The entity name
489 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000490 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000491 */
492typedef void (*referenceSAXFunc) (void *ctx,
493 const xmlChar *name);
494/**
495 * charactersSAXFunc:
496 * @ctx: the user data (XML parser context)
497 * @ch: a xmlChar string
498 * @len: the number of xmlChar
499 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000500 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000501 */
502typedef void (*charactersSAXFunc) (void *ctx,
503 const xmlChar *ch,
504 int len);
505/**
506 * ignorableWhitespaceSAXFunc:
507 * @ctx: the user data (XML parser context)
508 * @ch: a xmlChar string
509 * @len: the number of xmlChar
510 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000511 * Receiving some ignorable whitespaces from the parser.
512 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000513 */
Owen Taylor3473f882001-02-23 17:55:21 +0000514typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000515 const xmlChar *ch,
516 int len);
517/**
518 * processingInstructionSAXFunc:
519 * @ctx: the user data (XML parser context)
520 * @target: the target name
521 * @data: the PI data's
522 *
523 * A processing instruction has been parsed.
524 */
Owen Taylor3473f882001-02-23 17:55:21 +0000525typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000526 const xmlChar *target,
527 const xmlChar *data);
528/**
529 * commentSAXFunc:
530 * @ctx: the user data (XML parser context)
531 * @value: the comment content
532 *
533 * A comment has been parsed.
534 */
535typedef void (*commentSAXFunc) (void *ctx,
536 const xmlChar *value);
537/**
538 * cdataBlockSAXFunc:
539 * @ctx: the user data (XML parser context)
540 * @value: The pcdata content
541 * @len: the block length
542 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000543 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000544 */
545typedef void (*cdataBlockSAXFunc) (
546 void *ctx,
547 const xmlChar *value,
548 int len);
549/**
550 * warningSAXFunc:
551 * @ctx: an XML parser context
552 * @msg: the message to display/transmit
553 * @...: extra parameters for the message display
554 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000555 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000556 */
557typedef void (*warningSAXFunc) (void *ctx,
558 const char *msg, ...);
559/**
560 * errorSAXFunc:
561 * @ctx: an XML parser context
562 * @msg: the message to display/transmit
563 * @...: extra parameters for the message display
564 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000565 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000566 */
567typedef void (*errorSAXFunc) (void *ctx,
568 const char *msg, ...);
569/**
570 * fatalErrorSAXFunc:
571 * @ctx: an XML parser context
572 * @msg: the message to display/transmit
573 * @...: extra parameters for the message display
574 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000575 * Display and format fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000576 * Note: so far fatalError() SAX callbacks are not used, error()
577 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000578 */
579typedef void (*fatalErrorSAXFunc) (void *ctx,
580 const char *msg, ...);
581/**
582 * isStandaloneSAXFunc:
583 * @ctx: the user data (XML parser context)
584 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000585 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000586 *
587 * Returns 1 if true
588 */
Owen Taylor3473f882001-02-23 17:55:21 +0000589typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000590/**
591 * hasInternalSubsetSAXFunc:
592 * @ctx: the user data (XML parser context)
593 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000594 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000595 *
596 * Returns 1 if true
597 */
Owen Taylor3473f882001-02-23 17:55:21 +0000598typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000599
Daniel Veillard9d06d302002-01-22 18:15:52 +0000600/**
601 * hasExternalSubsetSAXFunc:
602 * @ctx: the user data (XML parser context)
603 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000604 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000605 *
606 * Returns 1 if true
607 */
Owen Taylor3473f882001-02-23 17:55:21 +0000608typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
609
Daniel Veillard1af9a412003-08-20 22:54:39 +0000610/************************************************************************
611 * *
612 * The SAX version 2 API extensions *
613 * *
614 ************************************************************************/
615/**
616 * XML_SAX2_MAGIC:
617 *
618 * Special constant found in SAX2 blocks initialized fields
619 */
620#define XML_SAX2_MAGIC 0xDEEDBEAF
621
622/**
623 * startElementNsSAX2Func:
624 * @ctx: the user data (XML parser context)
625 * @localname: the local name of the element
626 * @prefix: the element namespace prefix if available
627 * @URI: the element namespace name if available
628 * @nb_namespaces: number of namespace definitions on that node
629 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
630 * @nb_attributes: the number of attributes on that node
Daniel Veillard07cb8222003-09-10 10:51:05 +0000631 * @nb_defaulted: the number of defaulted attributes. The defaulted
632 * ones are at the end of the array
633 * @attributes: pointer to the array of (localname/prefix/URI/value/end)
634 * attribute values.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000635 *
636 * SAX2 callback when an element start has been detected by the parser.
637 * It provides the namespace informations for the element, as well as
638 * the new namespace declarations on the element.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000639 */
640
641typedef void (*startElementNsSAX2Func) (void *ctx,
642 const xmlChar *localname,
643 const xmlChar *prefix,
644 const xmlChar *URI,
645 int nb_namespaces,
646 const xmlChar **namespaces,
Daniel Veillard07cb8222003-09-10 10:51:05 +0000647 int nb_attributes,
648 int nb_defaulted,
649 const xmlChar **attributes);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000650
651/**
652 * endElementNsSAX2Func:
653 * @ctx: the user data (XML parser context)
654 * @localname: the local name of the element
655 * @prefix: the element namespace prefix if available
656 * @URI: the element namespace name if available
657 *
658 * SAX2 callback when an element end has been detected by the parser.
659 * It provides the namespace informations for the element.
660 */
661
662typedef void (*endElementNsSAX2Func) (void *ctx,
663 const xmlChar *localname,
664 const xmlChar *prefix,
665 const xmlChar *URI);
666
Daniel Veillard1af9a412003-08-20 22:54:39 +0000667
Owen Taylor3473f882001-02-23 17:55:21 +0000668struct _xmlSAXHandler {
669 internalSubsetSAXFunc internalSubset;
670 isStandaloneSAXFunc isStandalone;
671 hasInternalSubsetSAXFunc hasInternalSubset;
672 hasExternalSubsetSAXFunc hasExternalSubset;
673 resolveEntitySAXFunc resolveEntity;
674 getEntitySAXFunc getEntity;
675 entityDeclSAXFunc entityDecl;
676 notationDeclSAXFunc notationDecl;
677 attributeDeclSAXFunc attributeDecl;
678 elementDeclSAXFunc elementDecl;
679 unparsedEntityDeclSAXFunc unparsedEntityDecl;
680 setDocumentLocatorSAXFunc setDocumentLocator;
681 startDocumentSAXFunc startDocument;
682 endDocumentSAXFunc endDocument;
683 startElementSAXFunc startElement;
684 endElementSAXFunc endElement;
685 referenceSAXFunc reference;
686 charactersSAXFunc characters;
687 ignorableWhitespaceSAXFunc ignorableWhitespace;
688 processingInstructionSAXFunc processingInstruction;
689 commentSAXFunc comment;
690 warningSAXFunc warning;
691 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000692 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000693 getParameterEntitySAXFunc getParameterEntity;
694 cdataBlockSAXFunc cdataBlock;
695 externalSubsetSAXFunc externalSubset;
Daniel Veillard07cb8222003-09-10 10:51:05 +0000696 unsigned int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000697 /* The following fields are extensions available only on version 2 */
698 void *_private;
699 startElementNsSAX2Func startElementNs;
700 endElementNsSAX2Func endElementNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000701};
702
703/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000704 * xmlExternalEntityLoader:
705 * @URL: The System ID of the resource requested
706 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000707 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000708 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000709 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000710 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000711 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000712 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000713typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
714 const char *ID,
715 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000716
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000717/*
Owen Taylor3473f882001-02-23 17:55:21 +0000718 * Global variables: just the default SAX interface tables and XML
719 * version infos.
720 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000721#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000722LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000723#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000724
Daniel Veillard0ba59232002-02-10 13:20:39 +0000725/*
Owen Taylor3473f882001-02-23 17:55:21 +0000726LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
727LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
728LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000729LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000730 */
Owen Taylor3473f882001-02-23 17:55:21 +0000731
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000732/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000733 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000734 */
735
Daniel Veillard0ba59232002-02-10 13:20:39 +0000736#if 0
737LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000738LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000739#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000740
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000741#ifdef __cplusplus
742}
743#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000744
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000745#include <libxml/encoding.h>
746#include <libxml/xmlIO.h>
747#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000748
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000749#ifdef __cplusplus
750extern "C" {
751#endif
752
Owen Taylor3473f882001-02-23 17:55:21 +0000753
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000754/*
Owen Taylor3473f882001-02-23 17:55:21 +0000755 * Init/Cleanup
756 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000757XMLPUBFUN void XMLCALL
758 xmlInitParser (void);
759XMLPUBFUN void XMLCALL
760 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000761
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000762/*
Owen Taylor3473f882001-02-23 17:55:21 +0000763 * Input functions
764 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000765XMLPUBFUN int XMLCALL
766 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000767 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000768XMLPUBFUN int XMLCALL
769 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000770 int len);
771
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000772/*
Owen Taylor3473f882001-02-23 17:55:21 +0000773 * xmlChar handling
774 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000775XMLPUBFUN xmlChar * XMLCALL
776 xmlStrdup (const xmlChar *cur);
777XMLPUBFUN xmlChar * XMLCALL
778 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000779 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000780XMLPUBFUN xmlChar * XMLCALL
781 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000782 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000783XMLPUBFUN xmlChar * XMLCALL
784 xmlCharStrdup (const char *cur);
785XMLPUBFUN xmlChar * XMLCALL
786 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000787 int start,
788 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000789XMLPUBFUN const xmlChar * XMLCALL
790 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000791 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000792XMLPUBFUN const xmlChar * XMLCALL
793 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000794 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000795XMLPUBFUN const xmlChar * XMLCALL
796 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000797 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000798XMLPUBFUN int XMLCALL
799 xmlStrcmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000800 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000801XMLPUBFUN int XMLCALL
802 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000803 const xmlChar *str2,
804 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000805XMLPUBFUN int XMLCALL
806 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000807 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000808XMLPUBFUN int XMLCALL
809 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000810 const xmlChar *str2,
811 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000812XMLPUBFUN int XMLCALL
813 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000814 const xmlChar *str2);
Daniel Veillard07cb8222003-09-10 10:51:05 +0000815XMLPUBFUN int XMLCALL
816 xmlStrQEqual (const xmlChar *pref,
817 const xmlChar *name,
818 const xmlChar *str);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000819XMLPUBFUN int XMLCALL
820 xmlStrlen (const xmlChar *str);
821XMLPUBFUN xmlChar * XMLCALL
822 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000823 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000824XMLPUBFUN xmlChar * XMLCALL
825 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000826 const xmlChar *add,
827 int len);
828
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000829/*
Owen Taylor3473f882001-02-23 17:55:21 +0000830 * Basic parsing Interfaces
831 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000832XMLPUBFUN xmlDocPtr XMLCALL
833 xmlParseDoc (xmlChar *cur);
834XMLPUBFUN xmlDocPtr XMLCALL
835 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000836 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000837XMLPUBFUN xmlDocPtr XMLCALL
838 xmlParseFile (const char *filename);
839XMLPUBFUN int XMLCALL
840 xmlSubstituteEntitiesDefault(int val);
841XMLPUBFUN int XMLCALL
842 xmlKeepBlanksDefault (int val);
843XMLPUBFUN void XMLCALL
844 xmlStopParser (xmlParserCtxtPtr ctxt);
845XMLPUBFUN int XMLCALL
846 xmlPedanticParserDefault(int val);
847XMLPUBFUN int XMLCALL
848 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000849
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000850/*
Owen Taylor3473f882001-02-23 17:55:21 +0000851 * Recovery mode
852 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000853XMLPUBFUN xmlDocPtr XMLCALL
854 xmlRecoverDoc (xmlChar *cur);
855XMLPUBFUN xmlDocPtr XMLCALL
856 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000857 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000858XMLPUBFUN xmlDocPtr XMLCALL
859 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000860
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000861/*
Owen Taylor3473f882001-02-23 17:55:21 +0000862 * Less common routines and SAX interfaces
863 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000864XMLPUBFUN int XMLCALL
865 xmlParseDocument (xmlParserCtxtPtr ctxt);
866XMLPUBFUN int XMLCALL
867 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
868XMLPUBFUN xmlDocPtr XMLCALL
869 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000870 xmlChar *cur,
871 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000872XMLPUBFUN int XMLCALL
873 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000874 void *user_data,
875 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000876XMLPUBFUN int XMLCALL
877 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000878 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000879 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000880 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000881XMLPUBFUN xmlDocPtr XMLCALL
882 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000883 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000884 int size,
885 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000886XMLPUBFUN xmlDocPtr XMLCALL
887 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000888 const char *buffer,
889 int size,
890 int recovery,
891 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000892XMLPUBFUN xmlDocPtr XMLCALL
893 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000894 const char *filename,
895 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000896XMLPUBFUN xmlDocPtr XMLCALL
897 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000898 const char *filename,
899 int recovery,
900 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000901XMLPUBFUN xmlDocPtr XMLCALL
902 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000903 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000904XMLPUBFUN xmlDocPtr XMLCALL
905 xmlParseEntity (const char *filename);
906XMLPUBFUN xmlDtdPtr XMLCALL
907 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000908 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000909XMLPUBFUN xmlDtdPtr XMLCALL
910 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000911 const xmlChar *ExternalID,
912 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000913XMLPUBFUN xmlDtdPtr XMLCALL
914 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000915 xmlParserInputBufferPtr input,
916 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000917XMLPUBFUN int XMLCALL
918 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000919 xmlSAXHandlerPtr sax,
920 void *user_data,
921 int depth,
922 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000923 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000924XMLPUBFUN int XMLCALL
925 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000926 xmlSAXHandlerPtr sax,
927 void *user_data,
928 int depth,
929 const xmlChar *string,
930 xmlNodePtr *lst,
931 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000932XMLPUBFUN int XMLCALL
933 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000934 xmlSAXHandlerPtr sax,
935 void *user_data,
936 int depth,
937 const xmlChar *URL,
938 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000939 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000940XMLPUBFUN int XMLCALL
941 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000942 const xmlChar *URL,
943 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000944 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000945
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000946/*
Owen Taylor3473f882001-02-23 17:55:21 +0000947 * Parser contexts handling.
948 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000949XMLPUBFUN int XMLCALL
950 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
951XMLPUBFUN void XMLCALL
952 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
953XMLPUBFUN void XMLCALL
954 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
955XMLPUBFUN void XMLCALL
956 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000957 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000958 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000959XMLPUBFUN xmlParserCtxtPtr XMLCALL
960 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000961
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000962/*
Owen Taylor3473f882001-02-23 17:55:21 +0000963 * Reading/setting optional parsing features.
964 */
965
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000966XMLPUBFUN int XMLCALL
967 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000968 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000969XMLPUBFUN int XMLCALL
970 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000971 const char *name,
972 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000973XMLPUBFUN int XMLCALL
974 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000975 const char *name,
976 void *value);
977
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000978/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000979 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000980 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000981XMLPUBFUN xmlParserCtxtPtr XMLCALL
982 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000983 void *user_data,
984 const char *chunk,
985 int size,
986 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000987XMLPUBFUN int XMLCALL
988 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000989 const char *chunk,
990 int size,
991 int terminate);
992
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000993/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000994 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000995 */
996
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000997XMLPUBFUN xmlParserCtxtPtr XMLCALL
998 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000999 void *user_data,
1000 xmlInputReadCallback ioread,
1001 xmlInputCloseCallback ioclose,
1002 void *ioctx,
1003 xmlCharEncoding enc);
1004
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001005XMLPUBFUN xmlParserInputPtr XMLCALL
1006 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +00001007 xmlParserInputBufferPtr input,
1008 xmlCharEncoding enc);
1009
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001010/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001011 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001012 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001013XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001014 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1015 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001016XMLPUBFUN void XMLCALL
1017 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1018XMLPUBFUN void XMLCALL
1019 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1020XMLPUBFUN unsigned long XMLCALL
1021 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001022 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001023XMLPUBFUN void XMLCALL
1024 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001025 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001026
1027/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001028 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001029 */
1030
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001031XMLPUBFUN void XMLCALL
1032 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1033XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001034 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001035XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001036 xmlLoadExternalEntity (const char *URL,
1037 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001038 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001039
1040#ifdef __cplusplus
1041}
1042#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001043#endif /* __XML_PARSER_H__ */
1044