blob: e52013b9ae24c68983978d5ae009a7ffdb65376b [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>
Owen Taylor3473f882001-02-23 17:55:21 +000015#include <libxml/valid.h>
Owen Taylor3473f882001-02-23 17:55:21 +000016#include <libxml/entities.h>
Owen Taylor3473f882001-02-23 17:55:21 +000017
18#ifdef __cplusplus
19extern "C" {
20#endif
21
Daniel Veillard5e2dace2001-07-18 19:30:27 +000022/**
23 * XML_DEFAULT_VERSION:
24 *
25 * The default version of XML used: 1.0
Owen Taylor3473f882001-02-23 17:55:21 +000026 */
27#define XML_DEFAULT_VERSION "1.0"
28
29/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000030 * xmlParserInput:
31 *
Daniel Veillard61f26172002-03-12 18:46:39 +000032 * An xmlParserInput is an input flow for the XML processor.
Owen Taylor3473f882001-02-23 17:55:21 +000033 * Each entity parsed is associated an xmlParserInput (except the
34 * few predefined ones). This is the case both for internal entities
35 * - in which case the flow is already completely in memory - or
36 * external entities - in which case we use the buf structure for
37 * progressive reading and I18N conversions to the internal UTF-8 format.
38 */
39
Daniel Veillard9d06d302002-01-22 18:15:52 +000040/**
41 * xmlParserInputDeallocate:
42 * @str: the string to deallocate
43 *
Daniel Veillard61f26172002-03-12 18:46:39 +000044 * Callback for freeing some parser input allocations.
Daniel Veillard9d06d302002-01-22 18:15:52 +000045 */
46typedef void (* xmlParserInputDeallocate)(xmlChar *str);
Daniel Veillard5e2dace2001-07-18 19:30:27 +000047
Owen Taylor3473f882001-02-23 17:55:21 +000048struct _xmlParserInput {
49 /* Input buffer */
50 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
51
52 const char *filename; /* The file analyzed, if any */
Daniel Veillard60087f32001-10-10 09:45:09 +000053 const char *directory; /* the directory/base of the file */
Owen Taylor3473f882001-02-23 17:55:21 +000054 const xmlChar *base; /* Base of the array to parse */
55 const xmlChar *cur; /* Current char being parsed */
Daniel Veillardcbaf3992001-12-31 16:16:02 +000056 const xmlChar *end; /* end of the array to parse */
Owen Taylor3473f882001-02-23 17:55:21 +000057 int length; /* length if known */
58 int line; /* Current line */
59 int col; /* Current column */
Daniel Veillard3e59fc52003-04-18 12:34:58 +000060 /*
61 * NOTE: consumed is only tested for equality in the parser code,
62 * so even if there is an overflow this should not give troubles
63 * for parsing very large instances.
64 */
65 unsigned long consumed; /* How many xmlChars already consumed */
Owen Taylor3473f882001-02-23 17:55:21 +000066 xmlParserInputDeallocate free; /* function to deallocate the base */
67 const xmlChar *encoding; /* the encoding string for entity */
68 const xmlChar *version; /* the version string for entity */
69 int standalone; /* Was that entity marked standalone */
70};
71
72/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000073 * xmlParserNodeInfo:
74 *
Daniel Veillard61f26172002-03-12 18:46:39 +000075 * The parser can be asked to collect Node informations, i.e. at what
Owen Taylor3473f882001-02-23 17:55:21 +000076 * place in the file they were detected.
77 * NOTE: This is off by default and not very well tested.
78 */
79typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
80typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
81
82struct _xmlParserNodeInfo {
83 const struct _xmlNode* node;
84 /* Position & line # that text that created the node begins & ends on */
85 unsigned long begin_pos;
86 unsigned long begin_line;
87 unsigned long end_pos;
88 unsigned long end_line;
89};
90
91typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
92typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
93struct _xmlParserNodeInfoSeq {
94 unsigned long maximum;
95 unsigned long length;
96 xmlParserNodeInfo* buffer;
97};
98
99/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000100 * xmlParserInputState:
101 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000102 * The parser is now working also as a state based parser.
103 * The recursive one use the state info for entities processing.
Owen Taylor3473f882001-02-23 17:55:21 +0000104 */
105typedef enum {
106 XML_PARSER_EOF = -1, /* nothing is to be parsed */
107 XML_PARSER_START = 0, /* nothing has been parsed */
108 XML_PARSER_MISC, /* Misc* before int subset */
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000109 XML_PARSER_PI, /* Within a processing instruction */
Owen Taylor3473f882001-02-23 17:55:21 +0000110 XML_PARSER_DTD, /* within some DTD content */
111 XML_PARSER_PROLOG, /* Misc* after internal subset */
112 XML_PARSER_COMMENT, /* within a comment */
113 XML_PARSER_START_TAG, /* within a start tag */
114 XML_PARSER_CONTENT, /* within the content */
115 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
116 XML_PARSER_END_TAG, /* within a closing tag */
117 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
118 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
119 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
120 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
121 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
Daniel Veillard4a7ae502002-02-18 19:18:17 +0000122 XML_PARSER_IGNORE, /* within an IGNORED section */
123 XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */
Owen Taylor3473f882001-02-23 17:55:21 +0000124} xmlParserInputState;
125
126/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000127 * XML_DETECT_IDS:
128 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000129 * Bit in the loadsubset context field to tell to do ID/REFs lookups.
130 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000131 */
132#define XML_DETECT_IDS 2
133
134/**
135 * XML_COMPLETE_ATTRS:
136 *
137 * Bit in the loadsubset context field to tell to do complete the
Daniel Veillard61f26172002-03-12 18:46:39 +0000138 * elements attributes lists with the ones defaulted from the DTDs.
139 * Use it to initialize xmlLoadExtDtdDefaultValue.
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000140 */
141#define XML_COMPLETE_ATTRS 4
142
143/**
Daniel Veillardef8dd7b2003-03-23 12:02:56 +0000144 * XML_SKIP_IDS:
145 *
146 * Bit in the loadsubset context field to tell to not do ID/REFs registration.
147 * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
148 */
149#define XML_SKIP_IDS 8
150
151/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000152 * xmlParserCtxt:
153 *
Owen Taylor3473f882001-02-23 17:55:21 +0000154 * The parser context.
Daniel Veillard61f26172002-03-12 18:46:39 +0000155 * NOTE This doesn't completely define the parser state, the (current ?)
Owen Taylor3473f882001-02-23 17:55:21 +0000156 * design of the parser uses recursive function calls since this allow
157 * and easy mapping from the production rules of the specification
158 * to the actual code. The drawback is that the actual function call
159 * also reflect the parser state. However most of the parsing routines
160 * takes as the only argument the parser context pointer, so migrating
161 * to a state based parser for progressive parsing shouldn't be too hard.
162 */
Owen Taylor3473f882001-02-23 17:55:21 +0000163struct _xmlParserCtxt {
164 struct _xmlSAXHandler *sax; /* The SAX handler */
165 void *userData; /* For SAX interface only, used by DOM build */
166 xmlDocPtr myDoc; /* the document being built */
167 int wellFormed; /* is the document well formed */
168 int replaceEntities; /* shall we replace entities ? */
169 const xmlChar *version; /* the XML version string */
170 const xmlChar *encoding; /* the declared encoding, if any */
171 int standalone; /* standalone document */
172 int html; /* an HTML(1)/Docbook(2) document */
173
174 /* Input stream stack */
175 xmlParserInputPtr input; /* Current input stream */
176 int inputNr; /* Number of current input streams */
177 int inputMax; /* Max number of input streams */
178 xmlParserInputPtr *inputTab; /* stack of inputs */
179
180 /* Node analysis stack only used for DOM building */
181 xmlNodePtr node; /* Current parsed Node */
182 int nodeNr; /* Depth of the parsing stack */
183 int nodeMax; /* Max depth of the parsing stack */
184 xmlNodePtr *nodeTab; /* array of nodes */
185
186 int record_info; /* Whether node info should be kept */
187 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
188
189 int errNo; /* error code */
190
191 int hasExternalSubset; /* reference and external subset */
192 int hasPErefs; /* the internal subset has PE refs */
193 int external; /* are we parsing an external entity */
194
195 int valid; /* is the document valid */
196 int validate; /* shall we try to validate ? */
197 xmlValidCtxt vctxt; /* The validity context */
198
199 xmlParserInputState instate; /* current type of input */
200 int token; /* next char look-ahead */
201
202 char *directory; /* the data directory */
203
204 /* Node name stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000205 const xmlChar *name; /* Current parsed Node */
Owen Taylor3473f882001-02-23 17:55:21 +0000206 int nameNr; /* Depth of the parsing stack */
207 int nameMax; /* Max depth of the parsing stack */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000208 const xmlChar * *nameTab; /* array of nodes */
Owen Taylor3473f882001-02-23 17:55:21 +0000209
210 long nbChars; /* number of xmlChar processed */
211 long checkIndex; /* used by progressive parsing lookup */
212 int keepBlanks; /* ugly but ... */
213 int disableSAX; /* SAX callbacks are disabled */
214 int inSubset; /* Parsing is in int 1/ext 2 subset */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000215 const xmlChar * intSubName; /* name of subset */
Owen Taylor3473f882001-02-23 17:55:21 +0000216 xmlChar * extSubURI; /* URI of external subset */
217 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
218
219 /* xml:space values */
220 int * space; /* Should the parser preserve spaces */
221 int spaceNr; /* Depth of the parsing stack */
222 int spaceMax; /* Max depth of the parsing stack */
223 int * spaceTab; /* array of space infos */
224
225 int depth; /* to prevent entity substitution loops */
226 xmlParserInputPtr entity; /* used to check entities boundaries */
227 int charset; /* encoding of the in-memory content
228 actually an xmlCharEncoding */
229 int nodelen; /* Those two fields are there to */
230 int nodemem; /* Speed up large node parsing */
231 int pedantic; /* signal pedantic warnings */
232 void *_private; /* For user data, libxml won't touch it */
233
234 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000235 int linenumbers; /* set line number in element content */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000236 void *catalogs; /* document's own catalog */
Daniel Veillarddad3f682002-11-17 16:47:27 +0000237 int recovery; /* run in recovery mode */
Daniel Veillarda880b122003-04-21 21:36:41 +0000238 int progressive; /* is this a progressive parsing */
Daniel Veillard2fdbd322003-08-18 12:15:38 +0000239 xmlDictPtr dict; /* dictionnary for the parser */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000240 const xmlChar * *atts; /* array for the attributes callbacks */
Daniel Veillard6155d8a2003-08-19 15:01:28 +0000241 int maxatts; /* the size of the array */
Daniel Veillard40412cd2003-09-03 13:28:32 +0000242 int docdict; /* use strings from dict to build tree */
Owen Taylor3473f882001-02-23 17:55:21 +0000243};
244
245/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000246 * xmlSAXLocator:
247 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000248 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000249 */
Owen Taylor3473f882001-02-23 17:55:21 +0000250struct _xmlSAXLocator {
251 const xmlChar *(*getPublicId)(void *ctx);
252 const xmlChar *(*getSystemId)(void *ctx);
253 int (*getLineNumber)(void *ctx);
254 int (*getColumnNumber)(void *ctx);
255};
256
257/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000258 * xmlSAXHandler:
259 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000260 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000261 * of the input generate data or structure informations.
262 */
263
Daniel Veillard9d06d302002-01-22 18:15:52 +0000264/**
265 * resolveEntitySAXFunc:
266 * @ctx: the user data (XML parser context)
267 * @publicId: The public ID of the entity
268 * @systemId: The system ID of the entity
269 *
270 * Callback:
271 * The entity loader, to control the loading of external entities,
272 * the application can either:
273 * - override this resolveEntity() callback in the SAX block
274 * - or better use the xmlSetExternalEntityLoader() function to
275 * set up it's own entity resolution routine
276 *
277 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
278 */
Owen Taylor3473f882001-02-23 17:55:21 +0000279typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000280 const xmlChar *publicId,
281 const xmlChar *systemId);
282/**
283 * internalSubsetSAXFunc:
284 * @ctx: the user data (XML parser context)
285 * @name: the root element name
286 * @ExternalID: the external ID
287 * @SystemID: the SYSTEM ID (e.g. filename or URL)
288 *
289 * Callback on internal subset declaration.
290 */
291typedef void (*internalSubsetSAXFunc) (void *ctx,
292 const xmlChar *name,
293 const xmlChar *ExternalID,
294 const xmlChar *SystemID);
295/**
296 * externalSubsetSAXFunc:
297 * @ctx: the user data (XML parser context)
298 * @name: the root element name
299 * @ExternalID: the external ID
300 * @SystemID: the SYSTEM ID (e.g. filename or URL)
301 *
302 * Callback on external subset declaration.
303 */
304typedef void (*externalSubsetSAXFunc) (void *ctx,
305 const xmlChar *name,
306 const xmlChar *ExternalID,
307 const xmlChar *SystemID);
308/**
309 * getEntitySAXFunc:
310 * @ctx: the user data (XML parser context)
311 * @name: The entity name
312 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000313 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000314 *
315 * Returns the xmlEntityPtr if found.
316 */
Owen Taylor3473f882001-02-23 17:55:21 +0000317typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000318 const xmlChar *name);
319/**
320 * getParameterEntitySAXFunc:
321 * @ctx: the user data (XML parser context)
322 * @name: The entity name
323 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000324 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000325 *
326 * Returns the xmlEntityPtr if found.
327 */
Owen Taylor3473f882001-02-23 17:55:21 +0000328typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000329 const xmlChar *name);
330/**
331 * entityDeclSAXFunc:
332 * @ctx: the user data (XML parser context)
333 * @name: the entity name
334 * @type: the entity type
335 * @publicId: The public ID of the entity
336 * @systemId: The system ID of the entity
337 * @content: the entity value (without processing).
338 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000339 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000340 */
Owen Taylor3473f882001-02-23 17:55:21 +0000341typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000342 const xmlChar *name,
343 int type,
344 const xmlChar *publicId,
345 const xmlChar *systemId,
346 xmlChar *content);
347/**
348 * notationDeclSAXFunc:
349 * @ctx: the user data (XML parser context)
350 * @name: The name of the notation
351 * @publicId: The public ID of the entity
352 * @systemId: The system ID of the entity
353 *
354 * What to do when a notation declaration has been parsed.
355 */
356typedef void (*notationDeclSAXFunc)(void *ctx,
357 const xmlChar *name,
358 const xmlChar *publicId,
359 const xmlChar *systemId);
360/**
361 * attributeDeclSAXFunc:
362 * @ctx: the user data (XML parser context)
363 * @elem: the name of the element
364 * @fullname: the attribute name
365 * @type: the attribute type
366 * @def: the type of default value
367 * @defaultValue: the attribute default value
368 * @tree: the tree of enumerated value set
369 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000370 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000371 */
372typedef void (*attributeDeclSAXFunc)(void *ctx,
373 const xmlChar *elem,
374 const xmlChar *fullname,
375 int type,
376 int def,
377 const xmlChar *defaultValue,
378 xmlEnumerationPtr tree);
379/**
380 * elementDeclSAXFunc:
381 * @ctx: the user data (XML parser context)
382 * @name: the element name
383 * @type: the element type
384 * @content: the element value tree
385 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000386 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000387 */
388typedef void (*elementDeclSAXFunc)(void *ctx,
389 const xmlChar *name,
390 int type,
391 xmlElementContentPtr content);
392/**
393 * unparsedEntityDeclSAXFunc:
394 * @ctx: the user data (XML parser context)
395 * @name: The name of the entity
396 * @publicId: The public ID of the entity
397 * @systemId: The system ID of the entity
398 * @notationName: the name of the notation
399 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000400 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000401 */
Owen Taylor3473f882001-02-23 17:55:21 +0000402typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000403 const xmlChar *name,
404 const xmlChar *publicId,
405 const xmlChar *systemId,
406 const xmlChar *notationName);
407/**
408 * setDocumentLocatorSAXFunc:
409 * @ctx: the user data (XML parser context)
410 * @loc: A SAX Locator
411 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000412 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000413 * Everything is available on the context, so this is useless in our case.
414 */
Owen Taylor3473f882001-02-23 17:55:21 +0000415typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000416 xmlSAXLocatorPtr loc);
417/**
418 * startDocumentSAXFunc:
419 * @ctx: the user data (XML parser context)
420 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000421 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000422 */
Owen Taylor3473f882001-02-23 17:55:21 +0000423typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000424/**
425 * endDocumentSAXFunc:
426 * @ctx: the user data (XML parser context)
427 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000428 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000429 */
Owen Taylor3473f882001-02-23 17:55:21 +0000430typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000431/**
432 * startElementSAXFunc:
433 * @ctx: the user data (XML parser context)
434 * @name: The element name, including namespace prefix
435 * @atts: An array of name/value attributes pairs, NULL terminated
436 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000437 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000438 */
439typedef void (*startElementSAXFunc) (void *ctx,
440 const xmlChar *name,
441 const xmlChar **atts);
442/**
443 * endElementSAXFunc:
444 * @ctx: the user data (XML parser context)
445 * @name: The element name
446 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000447 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000448 */
449typedef void (*endElementSAXFunc) (void *ctx,
450 const xmlChar *name);
451/**
452 * attributeSAXFunc:
453 * @ctx: the user data (XML parser context)
454 * @name: The attribute name, including namespace prefix
455 * @value: The attribute value
456 *
457 * Handle an attribute that has been read by the parser.
458 * The default handling is to convert the attribute into an
459 * DOM subtree and past it in a new xmlAttr element added to
460 * the element.
461 */
462typedef void (*attributeSAXFunc) (void *ctx,
463 const xmlChar *name,
464 const xmlChar *value);
465/**
466 * referenceSAXFunc:
467 * @ctx: the user data (XML parser context)
468 * @name: The entity name
469 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000470 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000471 */
472typedef void (*referenceSAXFunc) (void *ctx,
473 const xmlChar *name);
474/**
475 * charactersSAXFunc:
476 * @ctx: the user data (XML parser context)
477 * @ch: a xmlChar string
478 * @len: the number of xmlChar
479 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000480 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000481 */
482typedef void (*charactersSAXFunc) (void *ctx,
483 const xmlChar *ch,
484 int len);
485/**
486 * ignorableWhitespaceSAXFunc:
487 * @ctx: the user data (XML parser context)
488 * @ch: a xmlChar string
489 * @len: the number of xmlChar
490 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000491 * Receiving some ignorable whitespaces from the parser.
492 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000493 */
Owen Taylor3473f882001-02-23 17:55:21 +0000494typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000495 const xmlChar *ch,
496 int len);
497/**
498 * processingInstructionSAXFunc:
499 * @ctx: the user data (XML parser context)
500 * @target: the target name
501 * @data: the PI data's
502 *
503 * A processing instruction has been parsed.
504 */
Owen Taylor3473f882001-02-23 17:55:21 +0000505typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000506 const xmlChar *target,
507 const xmlChar *data);
508/**
509 * commentSAXFunc:
510 * @ctx: the user data (XML parser context)
511 * @value: the comment content
512 *
513 * A comment has been parsed.
514 */
515typedef void (*commentSAXFunc) (void *ctx,
516 const xmlChar *value);
517/**
518 * cdataBlockSAXFunc:
519 * @ctx: the user data (XML parser context)
520 * @value: The pcdata content
521 * @len: the block length
522 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000523 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000524 */
525typedef void (*cdataBlockSAXFunc) (
526 void *ctx,
527 const xmlChar *value,
528 int len);
529/**
530 * warningSAXFunc:
531 * @ctx: an XML parser context
532 * @msg: the message to display/transmit
533 * @...: extra parameters for the message display
534 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000535 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000536 */
537typedef void (*warningSAXFunc) (void *ctx,
538 const char *msg, ...);
539/**
540 * errorSAXFunc:
541 * @ctx: an XML parser context
542 * @msg: the message to display/transmit
543 * @...: extra parameters for the message display
544 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000545 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000546 */
547typedef void (*errorSAXFunc) (void *ctx,
548 const char *msg, ...);
549/**
550 * fatalErrorSAXFunc:
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 fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000556 * Note: so far fatalError() SAX callbacks are not used, error()
557 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000558 */
559typedef void (*fatalErrorSAXFunc) (void *ctx,
560 const char *msg, ...);
561/**
562 * isStandaloneSAXFunc:
563 * @ctx: the user data (XML parser context)
564 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000565 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000566 *
567 * Returns 1 if true
568 */
Owen Taylor3473f882001-02-23 17:55:21 +0000569typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000570/**
571 * hasInternalSubsetSAXFunc:
572 * @ctx: the user data (XML parser context)
573 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000574 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000575 *
576 * Returns 1 if true
577 */
Owen Taylor3473f882001-02-23 17:55:21 +0000578typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000579
Daniel Veillard9d06d302002-01-22 18:15:52 +0000580/**
581 * hasExternalSubsetSAXFunc:
582 * @ctx: the user data (XML parser context)
583 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000584 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000585 *
586 * Returns 1 if true
587 */
Owen Taylor3473f882001-02-23 17:55:21 +0000588typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
589
Daniel Veillard1af9a412003-08-20 22:54:39 +0000590/************************************************************************
591 * *
592 * The SAX version 2 API extensions *
593 * *
594 ************************************************************************/
595/**
596 * XML_SAX2_MAGIC:
597 *
598 * Special constant found in SAX2 blocks initialized fields
599 */
600#define XML_SAX2_MAGIC 0xDEEDBEAF
601
602/**
603 * startElementNsSAX2Func:
604 * @ctx: the user data (XML parser context)
605 * @localname: the local name of the element
606 * @prefix: the element namespace prefix if available
607 * @URI: the element namespace name if available
608 * @nb_namespaces: number of namespace definitions on that node
609 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
610 * @nb_attributes: the number of attributes on that node
611 *
612 * SAX2 callback when an element start has been detected by the parser.
613 * It provides the namespace informations for the element, as well as
614 * the new namespace declarations on the element.
615 * The number of attributes is given in this callback but the attributes
616 * themselves will be provided as separate callbacks.
617 */
618
619typedef void (*startElementNsSAX2Func) (void *ctx,
620 const xmlChar *localname,
621 const xmlChar *prefix,
622 const xmlChar *URI,
623 int nb_namespaces,
624 const xmlChar **namespaces,
625 int nb_attributes);
626
627/**
628 * endElementNsSAX2Func:
629 * @ctx: the user data (XML parser context)
630 * @localname: the local name of the element
631 * @prefix: the element namespace prefix if available
632 * @URI: the element namespace name if available
633 *
634 * SAX2 callback when an element end has been detected by the parser.
635 * It provides the namespace informations for the element.
636 */
637
638typedef void (*endElementNsSAX2Func) (void *ctx,
639 const xmlChar *localname,
640 const xmlChar *prefix,
641 const xmlChar *URI);
642
643/**
644 * attributeNsSAX2Func:
645 * @ctx: the user data (XML parser context)
646 * @localname: the local name of the attribute
647 * @prefix: the attribute namespace prefix if available
648 * @URI: the attribute namespace name if available
649 * @value: pointer to the attribute value string
650 * @valuelen: lenght of the attribute value string in bytes
651 *
652 * SAX2 callback when an attribute has been detected by the parser.
653 * It provides the namespace informations for the attribute, as well as
654 * the value of the attribute (note that @value may not be zero terminated
655 * and use of the @valuelen is needed to find the value end).
656 */
657typedef void (*attributeNsSAX2Func) (void *ctx,
658 const xmlChar *localname,
659 const xmlChar *prefix,
660 const xmlChar *URI,
661 const xmlChar *value,
662 int valuelen);
663
Owen Taylor3473f882001-02-23 17:55:21 +0000664struct _xmlSAXHandler {
665 internalSubsetSAXFunc internalSubset;
666 isStandaloneSAXFunc isStandalone;
667 hasInternalSubsetSAXFunc hasInternalSubset;
668 hasExternalSubsetSAXFunc hasExternalSubset;
669 resolveEntitySAXFunc resolveEntity;
670 getEntitySAXFunc getEntity;
671 entityDeclSAXFunc entityDecl;
672 notationDeclSAXFunc notationDecl;
673 attributeDeclSAXFunc attributeDecl;
674 elementDeclSAXFunc elementDecl;
675 unparsedEntityDeclSAXFunc unparsedEntityDecl;
676 setDocumentLocatorSAXFunc setDocumentLocator;
677 startDocumentSAXFunc startDocument;
678 endDocumentSAXFunc endDocument;
679 startElementSAXFunc startElement;
680 endElementSAXFunc endElement;
681 referenceSAXFunc reference;
682 charactersSAXFunc characters;
683 ignorableWhitespaceSAXFunc ignorableWhitespace;
684 processingInstructionSAXFunc processingInstruction;
685 commentSAXFunc comment;
686 warningSAXFunc warning;
687 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000688 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000689 getParameterEntitySAXFunc getParameterEntity;
690 cdataBlockSAXFunc cdataBlock;
691 externalSubsetSAXFunc externalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000692 int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000693 /* The following fields are extensions available only on version 2 */
694 void *_private;
695 startElementNsSAX2Func startElementNs;
696 endElementNsSAX2Func endElementNs;
697 attributeNsSAX2Func attributeNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000698};
699
700/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000701 * xmlExternalEntityLoader:
702 * @URL: The System ID of the resource requested
703 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000704 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000705 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000706 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000707 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000708 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000709 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000710typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
711 const char *ID,
712 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000713
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000714/*
Owen Taylor3473f882001-02-23 17:55:21 +0000715 * Global variables: just the default SAX interface tables and XML
716 * version infos.
717 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000718#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000719LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000720#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000721
Daniel Veillard0ba59232002-02-10 13:20:39 +0000722/*
Owen Taylor3473f882001-02-23 17:55:21 +0000723LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
724LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
725LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000726LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000727 */
Owen Taylor3473f882001-02-23 17:55:21 +0000728
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000729/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000730 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000731 */
732
Daniel Veillard0ba59232002-02-10 13:20:39 +0000733#if 0
734LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000735LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000736#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000737
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000738#ifdef __cplusplus
739}
740#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000741
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000742#include <libxml/encoding.h>
743#include <libxml/xmlIO.h>
744#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000745
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000746#ifdef __cplusplus
747extern "C" {
748#endif
749
Owen Taylor3473f882001-02-23 17:55:21 +0000750
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000751/*
Owen Taylor3473f882001-02-23 17:55:21 +0000752 * Init/Cleanup
753 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000754XMLPUBFUN void XMLCALL
755 xmlInitParser (void);
756XMLPUBFUN void XMLCALL
757 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000758
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000759/*
Owen Taylor3473f882001-02-23 17:55:21 +0000760 * Input functions
761 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000762XMLPUBFUN int XMLCALL
763 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000764 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000765XMLPUBFUN int XMLCALL
766 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000767 int len);
768
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000769/*
Owen Taylor3473f882001-02-23 17:55:21 +0000770 * xmlChar handling
771 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000772XMLPUBFUN xmlChar * XMLCALL
773 xmlStrdup (const xmlChar *cur);
774XMLPUBFUN xmlChar * XMLCALL
775 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000776 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000777XMLPUBFUN xmlChar * XMLCALL
778 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000779 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000780XMLPUBFUN xmlChar * XMLCALL
781 xmlCharStrdup (const char *cur);
782XMLPUBFUN xmlChar * XMLCALL
783 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000784 int start,
785 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000786XMLPUBFUN const xmlChar * XMLCALL
787 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000788 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000789XMLPUBFUN const xmlChar * XMLCALL
790 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000791 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000792XMLPUBFUN const xmlChar * XMLCALL
793 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000794 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000795XMLPUBFUN int XMLCALL
796 xmlStrcmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000797 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000798XMLPUBFUN int XMLCALL
799 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000800 const xmlChar *str2,
801 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000802XMLPUBFUN int XMLCALL
803 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000804 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000805XMLPUBFUN int XMLCALL
806 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000807 const xmlChar *str2,
808 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000809XMLPUBFUN int XMLCALL
810 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000811 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000812XMLPUBFUN int XMLCALL
813 xmlStrlen (const xmlChar *str);
814XMLPUBFUN xmlChar * XMLCALL
815 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000816 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000817XMLPUBFUN xmlChar * XMLCALL
818 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000819 const xmlChar *add,
820 int len);
821
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000822/*
Owen Taylor3473f882001-02-23 17:55:21 +0000823 * Basic parsing Interfaces
824 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000825XMLPUBFUN xmlDocPtr XMLCALL
826 xmlParseDoc (xmlChar *cur);
827XMLPUBFUN xmlDocPtr XMLCALL
828 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000829 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000830XMLPUBFUN xmlDocPtr XMLCALL
831 xmlParseFile (const char *filename);
832XMLPUBFUN int XMLCALL
833 xmlSubstituteEntitiesDefault(int val);
834XMLPUBFUN int XMLCALL
835 xmlKeepBlanksDefault (int val);
836XMLPUBFUN void XMLCALL
837 xmlStopParser (xmlParserCtxtPtr ctxt);
838XMLPUBFUN int XMLCALL
839 xmlPedanticParserDefault(int val);
840XMLPUBFUN int XMLCALL
841 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000842
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000843/*
Owen Taylor3473f882001-02-23 17:55:21 +0000844 * Recovery mode
845 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000846XMLPUBFUN xmlDocPtr XMLCALL
847 xmlRecoverDoc (xmlChar *cur);
848XMLPUBFUN xmlDocPtr XMLCALL
849 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000850 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000851XMLPUBFUN xmlDocPtr XMLCALL
852 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000853
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000854/*
Owen Taylor3473f882001-02-23 17:55:21 +0000855 * Less common routines and SAX interfaces
856 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000857XMLPUBFUN int XMLCALL
858 xmlParseDocument (xmlParserCtxtPtr ctxt);
859XMLPUBFUN int XMLCALL
860 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
861XMLPUBFUN xmlDocPtr XMLCALL
862 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000863 xmlChar *cur,
864 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000865XMLPUBFUN int XMLCALL
866 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000867 void *user_data,
868 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000869XMLPUBFUN int XMLCALL
870 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000871 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000872 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000873 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000874XMLPUBFUN xmlDocPtr XMLCALL
875 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000876 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000877 int size,
878 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000879XMLPUBFUN xmlDocPtr XMLCALL
880 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000881 const char *buffer,
882 int size,
883 int recovery,
884 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000885XMLPUBFUN xmlDocPtr XMLCALL
886 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000887 const char *filename,
888 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000889XMLPUBFUN xmlDocPtr XMLCALL
890 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000891 const char *filename,
892 int recovery,
893 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000894XMLPUBFUN xmlDocPtr XMLCALL
895 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000896 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000897XMLPUBFUN xmlDocPtr XMLCALL
898 xmlParseEntity (const char *filename);
899XMLPUBFUN xmlDtdPtr XMLCALL
900 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000901 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000902XMLPUBFUN xmlDtdPtr XMLCALL
903 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000904 const xmlChar *ExternalID,
905 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000906XMLPUBFUN xmlDtdPtr XMLCALL
907 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000908 xmlParserInputBufferPtr input,
909 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000910XMLPUBFUN int XMLCALL
911 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000912 xmlSAXHandlerPtr sax,
913 void *user_data,
914 int depth,
915 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000916 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000917XMLPUBFUN int XMLCALL
918 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000919 xmlSAXHandlerPtr sax,
920 void *user_data,
921 int depth,
922 const xmlChar *string,
923 xmlNodePtr *lst,
924 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000925XMLPUBFUN int XMLCALL
926 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000927 xmlSAXHandlerPtr sax,
928 void *user_data,
929 int depth,
930 const xmlChar *URL,
931 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000932 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000933XMLPUBFUN int XMLCALL
934 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000935 const xmlChar *URL,
936 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000937 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000938
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000939/*
Owen Taylor3473f882001-02-23 17:55:21 +0000940 * Parser contexts handling.
941 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000942XMLPUBFUN int XMLCALL
943 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
944XMLPUBFUN void XMLCALL
945 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
946XMLPUBFUN void XMLCALL
947 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
948XMLPUBFUN void XMLCALL
949 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000950 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000951 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000952XMLPUBFUN xmlParserCtxtPtr XMLCALL
953 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000954
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000955/*
Owen Taylor3473f882001-02-23 17:55:21 +0000956 * Reading/setting optional parsing features.
957 */
958
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000959XMLPUBFUN int XMLCALL
960 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000961 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000962XMLPUBFUN int XMLCALL
963 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000964 const char *name,
965 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000966XMLPUBFUN int XMLCALL
967 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000968 const char *name,
969 void *value);
970
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000971/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000972 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000973 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000974XMLPUBFUN xmlParserCtxtPtr XMLCALL
975 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000976 void *user_data,
977 const char *chunk,
978 int size,
979 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000980XMLPUBFUN int XMLCALL
981 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000982 const char *chunk,
983 int size,
984 int terminate);
985
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000986/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000987 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000988 */
989
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000990XMLPUBFUN xmlParserCtxtPtr XMLCALL
991 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000992 void *user_data,
993 xmlInputReadCallback ioread,
994 xmlInputCloseCallback ioclose,
995 void *ioctx,
996 xmlCharEncoding enc);
997
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000998XMLPUBFUN xmlParserInputPtr XMLCALL
999 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +00001000 xmlParserInputBufferPtr input,
1001 xmlCharEncoding enc);
1002
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001003/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001004 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001005 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001006XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001007 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1008 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001009XMLPUBFUN void XMLCALL
1010 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1011XMLPUBFUN void XMLCALL
1012 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1013XMLPUBFUN unsigned long XMLCALL
1014 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001015 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001016XMLPUBFUN void XMLCALL
1017 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001018 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001019
1020/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001021 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001022 */
1023
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001024XMLPUBFUN void XMLCALL
1025 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1026XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001027 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001028XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001029 xmlLoadExternalEntity (const char *URL,
1030 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001031 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001032
1033#ifdef __cplusplus
1034}
1035#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001036#endif /* __XML_PARSER_H__ */
1037