blob: cb555ef4f21dc9c0a28d88b06877137670b9083c [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 Veillard6155d8a2003-08-19 15:01:28 +0000240 const xmlChar * *atts; /* array for the attributes callbacks */
241 int maxatts; /* the size of the array */
Owen Taylor3473f882001-02-23 17:55:21 +0000242};
243
244/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000245 * xmlSAXLocator:
246 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000247 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000248 */
Owen Taylor3473f882001-02-23 17:55:21 +0000249struct _xmlSAXLocator {
250 const xmlChar *(*getPublicId)(void *ctx);
251 const xmlChar *(*getSystemId)(void *ctx);
252 int (*getLineNumber)(void *ctx);
253 int (*getColumnNumber)(void *ctx);
254};
255
256/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000257 * xmlSAXHandler:
258 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000259 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000260 * of the input generate data or structure informations.
261 */
262
Daniel Veillard9d06d302002-01-22 18:15:52 +0000263/**
264 * resolveEntitySAXFunc:
265 * @ctx: the user data (XML parser context)
266 * @publicId: The public ID of the entity
267 * @systemId: The system ID of the entity
268 *
269 * Callback:
270 * The entity loader, to control the loading of external entities,
271 * the application can either:
272 * - override this resolveEntity() callback in the SAX block
273 * - or better use the xmlSetExternalEntityLoader() function to
274 * set up it's own entity resolution routine
275 *
276 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
277 */
Owen Taylor3473f882001-02-23 17:55:21 +0000278typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000279 const xmlChar *publicId,
280 const xmlChar *systemId);
281/**
282 * internalSubsetSAXFunc:
283 * @ctx: the user data (XML parser context)
284 * @name: the root element name
285 * @ExternalID: the external ID
286 * @SystemID: the SYSTEM ID (e.g. filename or URL)
287 *
288 * Callback on internal subset declaration.
289 */
290typedef void (*internalSubsetSAXFunc) (void *ctx,
291 const xmlChar *name,
292 const xmlChar *ExternalID,
293 const xmlChar *SystemID);
294/**
295 * externalSubsetSAXFunc:
296 * @ctx: the user data (XML parser context)
297 * @name: the root element name
298 * @ExternalID: the external ID
299 * @SystemID: the SYSTEM ID (e.g. filename or URL)
300 *
301 * Callback on external subset declaration.
302 */
303typedef void (*externalSubsetSAXFunc) (void *ctx,
304 const xmlChar *name,
305 const xmlChar *ExternalID,
306 const xmlChar *SystemID);
307/**
308 * getEntitySAXFunc:
309 * @ctx: the user data (XML parser context)
310 * @name: The entity name
311 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000312 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000313 *
314 * Returns the xmlEntityPtr if found.
315 */
Owen Taylor3473f882001-02-23 17:55:21 +0000316typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000317 const xmlChar *name);
318/**
319 * getParameterEntitySAXFunc:
320 * @ctx: the user data (XML parser context)
321 * @name: The entity name
322 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000323 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000324 *
325 * Returns the xmlEntityPtr if found.
326 */
Owen Taylor3473f882001-02-23 17:55:21 +0000327typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000328 const xmlChar *name);
329/**
330 * entityDeclSAXFunc:
331 * @ctx: the user data (XML parser context)
332 * @name: the entity name
333 * @type: the entity type
334 * @publicId: The public ID of the entity
335 * @systemId: The system ID of the entity
336 * @content: the entity value (without processing).
337 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000338 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000339 */
Owen Taylor3473f882001-02-23 17:55:21 +0000340typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000341 const xmlChar *name,
342 int type,
343 const xmlChar *publicId,
344 const xmlChar *systemId,
345 xmlChar *content);
346/**
347 * notationDeclSAXFunc:
348 * @ctx: the user data (XML parser context)
349 * @name: The name of the notation
350 * @publicId: The public ID of the entity
351 * @systemId: The system ID of the entity
352 *
353 * What to do when a notation declaration has been parsed.
354 */
355typedef void (*notationDeclSAXFunc)(void *ctx,
356 const xmlChar *name,
357 const xmlChar *publicId,
358 const xmlChar *systemId);
359/**
360 * attributeDeclSAXFunc:
361 * @ctx: the user data (XML parser context)
362 * @elem: the name of the element
363 * @fullname: the attribute name
364 * @type: the attribute type
365 * @def: the type of default value
366 * @defaultValue: the attribute default value
367 * @tree: the tree of enumerated value set
368 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000369 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000370 */
371typedef void (*attributeDeclSAXFunc)(void *ctx,
372 const xmlChar *elem,
373 const xmlChar *fullname,
374 int type,
375 int def,
376 const xmlChar *defaultValue,
377 xmlEnumerationPtr tree);
378/**
379 * elementDeclSAXFunc:
380 * @ctx: the user data (XML parser context)
381 * @name: the element name
382 * @type: the element type
383 * @content: the element value tree
384 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000385 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000386 */
387typedef void (*elementDeclSAXFunc)(void *ctx,
388 const xmlChar *name,
389 int type,
390 xmlElementContentPtr content);
391/**
392 * unparsedEntityDeclSAXFunc:
393 * @ctx: the user data (XML parser context)
394 * @name: The name of the entity
395 * @publicId: The public ID of the entity
396 * @systemId: The system ID of the entity
397 * @notationName: the name of the notation
398 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000399 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000400 */
Owen Taylor3473f882001-02-23 17:55:21 +0000401typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000402 const xmlChar *name,
403 const xmlChar *publicId,
404 const xmlChar *systemId,
405 const xmlChar *notationName);
406/**
407 * setDocumentLocatorSAXFunc:
408 * @ctx: the user data (XML parser context)
409 * @loc: A SAX Locator
410 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000411 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000412 * Everything is available on the context, so this is useless in our case.
413 */
Owen Taylor3473f882001-02-23 17:55:21 +0000414typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000415 xmlSAXLocatorPtr loc);
416/**
417 * startDocumentSAXFunc:
418 * @ctx: the user data (XML parser context)
419 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000420 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000421 */
Owen Taylor3473f882001-02-23 17:55:21 +0000422typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000423/**
424 * endDocumentSAXFunc:
425 * @ctx: the user data (XML parser context)
426 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000427 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000428 */
Owen Taylor3473f882001-02-23 17:55:21 +0000429typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000430/**
431 * startElementSAXFunc:
432 * @ctx: the user data (XML parser context)
433 * @name: The element name, including namespace prefix
434 * @atts: An array of name/value attributes pairs, NULL terminated
435 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000436 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000437 */
438typedef void (*startElementSAXFunc) (void *ctx,
439 const xmlChar *name,
440 const xmlChar **atts);
441/**
442 * endElementSAXFunc:
443 * @ctx: the user data (XML parser context)
444 * @name: The element name
445 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000446 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000447 */
448typedef void (*endElementSAXFunc) (void *ctx,
449 const xmlChar *name);
450/**
451 * attributeSAXFunc:
452 * @ctx: the user data (XML parser context)
453 * @name: The attribute name, including namespace prefix
454 * @value: The attribute value
455 *
456 * Handle an attribute that has been read by the parser.
457 * The default handling is to convert the attribute into an
458 * DOM subtree and past it in a new xmlAttr element added to
459 * the element.
460 */
461typedef void (*attributeSAXFunc) (void *ctx,
462 const xmlChar *name,
463 const xmlChar *value);
464/**
465 * referenceSAXFunc:
466 * @ctx: the user data (XML parser context)
467 * @name: The entity name
468 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000469 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000470 */
471typedef void (*referenceSAXFunc) (void *ctx,
472 const xmlChar *name);
473/**
474 * charactersSAXFunc:
475 * @ctx: the user data (XML parser context)
476 * @ch: a xmlChar string
477 * @len: the number of xmlChar
478 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000479 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000480 */
481typedef void (*charactersSAXFunc) (void *ctx,
482 const xmlChar *ch,
483 int len);
484/**
485 * ignorableWhitespaceSAXFunc:
486 * @ctx: the user data (XML parser context)
487 * @ch: a xmlChar string
488 * @len: the number of xmlChar
489 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000490 * Receiving some ignorable whitespaces from the parser.
491 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000492 */
Owen Taylor3473f882001-02-23 17:55:21 +0000493typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000494 const xmlChar *ch,
495 int len);
496/**
497 * processingInstructionSAXFunc:
498 * @ctx: the user data (XML parser context)
499 * @target: the target name
500 * @data: the PI data's
501 *
502 * A processing instruction has been parsed.
503 */
Owen Taylor3473f882001-02-23 17:55:21 +0000504typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000505 const xmlChar *target,
506 const xmlChar *data);
507/**
508 * commentSAXFunc:
509 * @ctx: the user data (XML parser context)
510 * @value: the comment content
511 *
512 * A comment has been parsed.
513 */
514typedef void (*commentSAXFunc) (void *ctx,
515 const xmlChar *value);
516/**
517 * cdataBlockSAXFunc:
518 * @ctx: the user data (XML parser context)
519 * @value: The pcdata content
520 * @len: the block length
521 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000522 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000523 */
524typedef void (*cdataBlockSAXFunc) (
525 void *ctx,
526 const xmlChar *value,
527 int len);
528/**
529 * warningSAXFunc:
530 * @ctx: an XML parser context
531 * @msg: the message to display/transmit
532 * @...: extra parameters for the message display
533 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000534 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000535 */
536typedef void (*warningSAXFunc) (void *ctx,
537 const char *msg, ...);
538/**
539 * errorSAXFunc:
540 * @ctx: an XML parser context
541 * @msg: the message to display/transmit
542 * @...: extra parameters for the message display
543 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000544 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000545 */
546typedef void (*errorSAXFunc) (void *ctx,
547 const char *msg, ...);
548/**
549 * fatalErrorSAXFunc:
550 * @ctx: an XML parser context
551 * @msg: the message to display/transmit
552 * @...: extra parameters for the message display
553 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000554 * Display and format fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000555 * Note: so far fatalError() SAX callbacks are not used, error()
556 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000557 */
558typedef void (*fatalErrorSAXFunc) (void *ctx,
559 const char *msg, ...);
560/**
561 * isStandaloneSAXFunc:
562 * @ctx: the user data (XML parser context)
563 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000564 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000565 *
566 * Returns 1 if true
567 */
Owen Taylor3473f882001-02-23 17:55:21 +0000568typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000569/**
570 * hasInternalSubsetSAXFunc:
571 * @ctx: the user data (XML parser context)
572 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000573 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000574 *
575 * Returns 1 if true
576 */
Owen Taylor3473f882001-02-23 17:55:21 +0000577typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000578
Daniel Veillard9d06d302002-01-22 18:15:52 +0000579/**
580 * hasExternalSubsetSAXFunc:
581 * @ctx: the user data (XML parser context)
582 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000583 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000584 *
585 * Returns 1 if true
586 */
Owen Taylor3473f882001-02-23 17:55:21 +0000587typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
588
Daniel Veillard1af9a412003-08-20 22:54:39 +0000589/************************************************************************
590 * *
591 * The SAX version 2 API extensions *
592 * *
593 ************************************************************************/
594/**
595 * XML_SAX2_MAGIC:
596 *
597 * Special constant found in SAX2 blocks initialized fields
598 */
599#define XML_SAX2_MAGIC 0xDEEDBEAF
600
601/**
602 * startElementNsSAX2Func:
603 * @ctx: the user data (XML parser context)
604 * @localname: the local name of the element
605 * @prefix: the element namespace prefix if available
606 * @URI: the element namespace name if available
607 * @nb_namespaces: number of namespace definitions on that node
608 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
609 * @nb_attributes: the number of attributes on that node
610 *
611 * SAX2 callback when an element start has been detected by the parser.
612 * It provides the namespace informations for the element, as well as
613 * the new namespace declarations on the element.
614 * The number of attributes is given in this callback but the attributes
615 * themselves will be provided as separate callbacks.
616 */
617
618typedef void (*startElementNsSAX2Func) (void *ctx,
619 const xmlChar *localname,
620 const xmlChar *prefix,
621 const xmlChar *URI,
622 int nb_namespaces,
623 const xmlChar **namespaces,
624 int nb_attributes);
625
626/**
627 * endElementNsSAX2Func:
628 * @ctx: the user data (XML parser context)
629 * @localname: the local name of the element
630 * @prefix: the element namespace prefix if available
631 * @URI: the element namespace name if available
632 *
633 * SAX2 callback when an element end has been detected by the parser.
634 * It provides the namespace informations for the element.
635 */
636
637typedef void (*endElementNsSAX2Func) (void *ctx,
638 const xmlChar *localname,
639 const xmlChar *prefix,
640 const xmlChar *URI);
641
642/**
643 * attributeNsSAX2Func:
644 * @ctx: the user data (XML parser context)
645 * @localname: the local name of the attribute
646 * @prefix: the attribute namespace prefix if available
647 * @URI: the attribute namespace name if available
648 * @value: pointer to the attribute value string
649 * @valuelen: lenght of the attribute value string in bytes
650 *
651 * SAX2 callback when an attribute has been detected by the parser.
652 * It provides the namespace informations for the attribute, as well as
653 * the value of the attribute (note that @value may not be zero terminated
654 * and use of the @valuelen is needed to find the value end).
655 */
656typedef void (*attributeNsSAX2Func) (void *ctx,
657 const xmlChar *localname,
658 const xmlChar *prefix,
659 const xmlChar *URI,
660 const xmlChar *value,
661 int valuelen);
662
Owen Taylor3473f882001-02-23 17:55:21 +0000663struct _xmlSAXHandler {
664 internalSubsetSAXFunc internalSubset;
665 isStandaloneSAXFunc isStandalone;
666 hasInternalSubsetSAXFunc hasInternalSubset;
667 hasExternalSubsetSAXFunc hasExternalSubset;
668 resolveEntitySAXFunc resolveEntity;
669 getEntitySAXFunc getEntity;
670 entityDeclSAXFunc entityDecl;
671 notationDeclSAXFunc notationDecl;
672 attributeDeclSAXFunc attributeDecl;
673 elementDeclSAXFunc elementDecl;
674 unparsedEntityDeclSAXFunc unparsedEntityDecl;
675 setDocumentLocatorSAXFunc setDocumentLocator;
676 startDocumentSAXFunc startDocument;
677 endDocumentSAXFunc endDocument;
678 startElementSAXFunc startElement;
679 endElementSAXFunc endElement;
680 referenceSAXFunc reference;
681 charactersSAXFunc characters;
682 ignorableWhitespaceSAXFunc ignorableWhitespace;
683 processingInstructionSAXFunc processingInstruction;
684 commentSAXFunc comment;
685 warningSAXFunc warning;
686 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000687 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000688 getParameterEntitySAXFunc getParameterEntity;
689 cdataBlockSAXFunc cdataBlock;
690 externalSubsetSAXFunc externalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000691 int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000692 /* The following fields are extensions available only on version 2 */
693 void *_private;
694 startElementNsSAX2Func startElementNs;
695 endElementNsSAX2Func endElementNs;
696 attributeNsSAX2Func attributeNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000697};
698
699/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000700 * xmlExternalEntityLoader:
701 * @URL: The System ID of the resource requested
702 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000703 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000704 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000705 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000706 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000707 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000708 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000709typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
710 const char *ID,
711 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000712
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000713/*
Owen Taylor3473f882001-02-23 17:55:21 +0000714 * Global variables: just the default SAX interface tables and XML
715 * version infos.
716 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000717#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000718LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000719#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000720
Daniel Veillard0ba59232002-02-10 13:20:39 +0000721/*
Owen Taylor3473f882001-02-23 17:55:21 +0000722LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
723LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
724LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000725LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000726 */
Owen Taylor3473f882001-02-23 17:55:21 +0000727
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000728/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000729 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000730 */
731
Daniel Veillard0ba59232002-02-10 13:20:39 +0000732#if 0
733LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000734LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000735#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000736
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000737#ifdef __cplusplus
738}
739#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000740
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000741#include <libxml/encoding.h>
742#include <libxml/xmlIO.h>
743#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000744
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000745#ifdef __cplusplus
746extern "C" {
747#endif
748
Owen Taylor3473f882001-02-23 17:55:21 +0000749
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000750/*
Owen Taylor3473f882001-02-23 17:55:21 +0000751 * Init/Cleanup
752 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000753XMLPUBFUN void XMLCALL
754 xmlInitParser (void);
755XMLPUBFUN void XMLCALL
756 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000757
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000758/*
Owen Taylor3473f882001-02-23 17:55:21 +0000759 * Input functions
760 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000761XMLPUBFUN int XMLCALL
762 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000763 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000764XMLPUBFUN int XMLCALL
765 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000766 int len);
767
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000768/*
Owen Taylor3473f882001-02-23 17:55:21 +0000769 * xmlChar handling
770 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000771XMLPUBFUN xmlChar * XMLCALL
772 xmlStrdup (const xmlChar *cur);
773XMLPUBFUN xmlChar * XMLCALL
774 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000775 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000776XMLPUBFUN xmlChar * XMLCALL
777 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000778 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000779XMLPUBFUN xmlChar * XMLCALL
780 xmlCharStrdup (const char *cur);
781XMLPUBFUN xmlChar * XMLCALL
782 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000783 int start,
784 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000785XMLPUBFUN const xmlChar * XMLCALL
786 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000787 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000788XMLPUBFUN const xmlChar * XMLCALL
789 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000790 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000791XMLPUBFUN const xmlChar * XMLCALL
792 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000793 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000794XMLPUBFUN int XMLCALL
795 xmlStrcmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000796 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000797XMLPUBFUN int XMLCALL
798 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000799 const xmlChar *str2,
800 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000801XMLPUBFUN int XMLCALL
802 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000803 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000804XMLPUBFUN int XMLCALL
805 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000806 const xmlChar *str2,
807 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000808XMLPUBFUN int XMLCALL
809 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000810 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000811XMLPUBFUN int XMLCALL
812 xmlStrlen (const xmlChar *str);
813XMLPUBFUN xmlChar * XMLCALL
814 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000815 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000816XMLPUBFUN xmlChar * XMLCALL
817 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000818 const xmlChar *add,
819 int len);
820
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000821/*
Owen Taylor3473f882001-02-23 17:55:21 +0000822 * Basic parsing Interfaces
823 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000824XMLPUBFUN xmlDocPtr XMLCALL
825 xmlParseDoc (xmlChar *cur);
826XMLPUBFUN xmlDocPtr XMLCALL
827 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000828 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000829XMLPUBFUN xmlDocPtr XMLCALL
830 xmlParseFile (const char *filename);
831XMLPUBFUN int XMLCALL
832 xmlSubstituteEntitiesDefault(int val);
833XMLPUBFUN int XMLCALL
834 xmlKeepBlanksDefault (int val);
835XMLPUBFUN void XMLCALL
836 xmlStopParser (xmlParserCtxtPtr ctxt);
837XMLPUBFUN int XMLCALL
838 xmlPedanticParserDefault(int val);
839XMLPUBFUN int XMLCALL
840 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000841
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000842/*
Owen Taylor3473f882001-02-23 17:55:21 +0000843 * Recovery mode
844 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000845XMLPUBFUN xmlDocPtr XMLCALL
846 xmlRecoverDoc (xmlChar *cur);
847XMLPUBFUN xmlDocPtr XMLCALL
848 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000849 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000850XMLPUBFUN xmlDocPtr XMLCALL
851 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000852
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000853/*
Owen Taylor3473f882001-02-23 17:55:21 +0000854 * Less common routines and SAX interfaces
855 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000856XMLPUBFUN int XMLCALL
857 xmlParseDocument (xmlParserCtxtPtr ctxt);
858XMLPUBFUN int XMLCALL
859 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
860XMLPUBFUN xmlDocPtr XMLCALL
861 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000862 xmlChar *cur,
863 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000864XMLPUBFUN int XMLCALL
865 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000866 void *user_data,
867 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000868XMLPUBFUN int XMLCALL
869 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000870 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000871 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000872 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000873XMLPUBFUN xmlDocPtr XMLCALL
874 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000875 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000876 int size,
877 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000878XMLPUBFUN xmlDocPtr XMLCALL
879 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000880 const char *buffer,
881 int size,
882 int recovery,
883 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000884XMLPUBFUN xmlDocPtr XMLCALL
885 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000886 const char *filename,
887 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000888XMLPUBFUN xmlDocPtr XMLCALL
889 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000890 const char *filename,
891 int recovery,
892 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000893XMLPUBFUN xmlDocPtr XMLCALL
894 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000895 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000896XMLPUBFUN xmlDocPtr XMLCALL
897 xmlParseEntity (const char *filename);
898XMLPUBFUN xmlDtdPtr XMLCALL
899 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000900 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000901XMLPUBFUN xmlDtdPtr XMLCALL
902 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000903 const xmlChar *ExternalID,
904 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000905XMLPUBFUN xmlDtdPtr XMLCALL
906 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000907 xmlParserInputBufferPtr input,
908 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000909XMLPUBFUN int XMLCALL
910 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000911 xmlSAXHandlerPtr sax,
912 void *user_data,
913 int depth,
914 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000915 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000916XMLPUBFUN int XMLCALL
917 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000918 xmlSAXHandlerPtr sax,
919 void *user_data,
920 int depth,
921 const xmlChar *string,
922 xmlNodePtr *lst,
923 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000924XMLPUBFUN int XMLCALL
925 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000926 xmlSAXHandlerPtr sax,
927 void *user_data,
928 int depth,
929 const xmlChar *URL,
930 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000931 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000932XMLPUBFUN int XMLCALL
933 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000934 const xmlChar *URL,
935 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000936 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000937
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000938/*
Owen Taylor3473f882001-02-23 17:55:21 +0000939 * Parser contexts handling.
940 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000941XMLPUBFUN int XMLCALL
942 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
943XMLPUBFUN void XMLCALL
944 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
945XMLPUBFUN void XMLCALL
946 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
947XMLPUBFUN void XMLCALL
948 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000949 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000950 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000951XMLPUBFUN xmlParserCtxtPtr XMLCALL
952 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000953
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000954/*
Owen Taylor3473f882001-02-23 17:55:21 +0000955 * Reading/setting optional parsing features.
956 */
957
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000958XMLPUBFUN int XMLCALL
959 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000960 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000961XMLPUBFUN int XMLCALL
962 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000963 const char *name,
964 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000965XMLPUBFUN int XMLCALL
966 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000967 const char *name,
968 void *value);
969
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000970/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000971 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000972 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000973XMLPUBFUN xmlParserCtxtPtr XMLCALL
974 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000975 void *user_data,
976 const char *chunk,
977 int size,
978 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000979XMLPUBFUN int XMLCALL
980 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000981 const char *chunk,
982 int size,
983 int terminate);
984
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000985/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000986 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000987 */
988
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000989XMLPUBFUN xmlParserCtxtPtr XMLCALL
990 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000991 void *user_data,
992 xmlInputReadCallback ioread,
993 xmlInputCloseCallback ioclose,
994 void *ioctx,
995 xmlCharEncoding enc);
996
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000997XMLPUBFUN xmlParserInputPtr XMLCALL
998 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000999 xmlParserInputBufferPtr input,
1000 xmlCharEncoding enc);
1001
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001002/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001003 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001004 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001005XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001006 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1007 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001008XMLPUBFUN void XMLCALL
1009 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1010XMLPUBFUN void XMLCALL
1011 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1012XMLPUBFUN unsigned long XMLCALL
1013 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001014 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001015XMLPUBFUN void XMLCALL
1016 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001017 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001018
1019/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001020 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001021 */
1022
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001023XMLPUBFUN void XMLCALL
1024 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1025XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001026 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001027XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001028 xmlLoadExternalEntity (const char *URL,
1029 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001030 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001031
1032#ifdef __cplusplus
1033}
1034#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001035#endif /* __XML_PARSER_H__ */
1036