blob: 8ab2033c7ac4d1e881906efc4328bb5a65d74997 [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 */
Daniel Veillard0fb18932003-09-07 09:14:37 +0000243
244 /*
245 * pre-interned strings
246 */
247 const xmlChar *str_xml;
248 const xmlChar *str_xmlns;
249
250 /*
251 * Everything below is related to the new SAX mode
252 */
253 int sax2; /* operating in the new SAX mode */
254 int nsNr; /* the number of inherited namespaces */
255 int nsMax; /* the size of the arrays */
256 const xmlChar * *nsTab; /* the array of prefix/namespace name */
Owen Taylor3473f882001-02-23 17:55:21 +0000257};
258
259/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000260 * xmlSAXLocator:
261 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000262 * A SAX Locator.
Owen Taylor3473f882001-02-23 17:55:21 +0000263 */
Owen Taylor3473f882001-02-23 17:55:21 +0000264struct _xmlSAXLocator {
265 const xmlChar *(*getPublicId)(void *ctx);
266 const xmlChar *(*getSystemId)(void *ctx);
267 int (*getLineNumber)(void *ctx);
268 int (*getColumnNumber)(void *ctx);
269};
270
271/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000272 * xmlSAXHandler:
273 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000274 * A SAX handler is bunch of callbacks called by the parser when processing
Owen Taylor3473f882001-02-23 17:55:21 +0000275 * of the input generate data or structure informations.
276 */
277
Daniel Veillard9d06d302002-01-22 18:15:52 +0000278/**
279 * resolveEntitySAXFunc:
280 * @ctx: the user data (XML parser context)
281 * @publicId: The public ID of the entity
282 * @systemId: The system ID of the entity
283 *
284 * Callback:
285 * The entity loader, to control the loading of external entities,
286 * the application can either:
287 * - override this resolveEntity() callback in the SAX block
288 * - or better use the xmlSetExternalEntityLoader() function to
289 * set up it's own entity resolution routine
290 *
291 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
292 */
Owen Taylor3473f882001-02-23 17:55:21 +0000293typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000294 const xmlChar *publicId,
295 const xmlChar *systemId);
296/**
297 * internalSubsetSAXFunc:
298 * @ctx: the user data (XML parser context)
299 * @name: the root element name
300 * @ExternalID: the external ID
301 * @SystemID: the SYSTEM ID (e.g. filename or URL)
302 *
303 * Callback on internal subset declaration.
304 */
305typedef void (*internalSubsetSAXFunc) (void *ctx,
306 const xmlChar *name,
307 const xmlChar *ExternalID,
308 const xmlChar *SystemID);
309/**
310 * externalSubsetSAXFunc:
311 * @ctx: the user data (XML parser context)
312 * @name: the root element name
313 * @ExternalID: the external ID
314 * @SystemID: the SYSTEM ID (e.g. filename or URL)
315 *
316 * Callback on external subset declaration.
317 */
318typedef void (*externalSubsetSAXFunc) (void *ctx,
319 const xmlChar *name,
320 const xmlChar *ExternalID,
321 const xmlChar *SystemID);
322/**
323 * getEntitySAXFunc:
324 * @ctx: the user data (XML parser context)
325 * @name: The entity name
326 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000327 * Get an entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000328 *
329 * Returns the xmlEntityPtr if found.
330 */
Owen Taylor3473f882001-02-23 17:55:21 +0000331typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000332 const xmlChar *name);
333/**
334 * getParameterEntitySAXFunc:
335 * @ctx: the user data (XML parser context)
336 * @name: The entity name
337 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000338 * Get a parameter entity by name.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000339 *
340 * Returns the xmlEntityPtr if found.
341 */
Owen Taylor3473f882001-02-23 17:55:21 +0000342typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000343 const xmlChar *name);
344/**
345 * entityDeclSAXFunc:
346 * @ctx: the user data (XML parser context)
347 * @name: the entity name
348 * @type: the entity type
349 * @publicId: The public ID of the entity
350 * @systemId: The system ID of the entity
351 * @content: the entity value (without processing).
352 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000353 * An entity definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000354 */
Owen Taylor3473f882001-02-23 17:55:21 +0000355typedef void (*entityDeclSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000356 const xmlChar *name,
357 int type,
358 const xmlChar *publicId,
359 const xmlChar *systemId,
360 xmlChar *content);
361/**
362 * notationDeclSAXFunc:
363 * @ctx: the user data (XML parser context)
364 * @name: The name of the notation
365 * @publicId: The public ID of the entity
366 * @systemId: The system ID of the entity
367 *
368 * What to do when a notation declaration has been parsed.
369 */
370typedef void (*notationDeclSAXFunc)(void *ctx,
371 const xmlChar *name,
372 const xmlChar *publicId,
373 const xmlChar *systemId);
374/**
375 * attributeDeclSAXFunc:
376 * @ctx: the user data (XML parser context)
377 * @elem: the name of the element
378 * @fullname: the attribute name
379 * @type: the attribute type
380 * @def: the type of default value
381 * @defaultValue: the attribute default value
382 * @tree: the tree of enumerated value set
383 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000384 * An attribute definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000385 */
386typedef void (*attributeDeclSAXFunc)(void *ctx,
387 const xmlChar *elem,
388 const xmlChar *fullname,
389 int type,
390 int def,
391 const xmlChar *defaultValue,
392 xmlEnumerationPtr tree);
393/**
394 * elementDeclSAXFunc:
395 * @ctx: the user data (XML parser context)
396 * @name: the element name
397 * @type: the element type
398 * @content: the element value tree
399 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000400 * An element definition has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000401 */
402typedef void (*elementDeclSAXFunc)(void *ctx,
403 const xmlChar *name,
404 int type,
405 xmlElementContentPtr content);
406/**
407 * unparsedEntityDeclSAXFunc:
408 * @ctx: the user data (XML parser context)
409 * @name: The name of the entity
410 * @publicId: The public ID of the entity
411 * @systemId: The system ID of the entity
412 * @notationName: the name of the notation
413 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000414 * What to do when an unparsed entity declaration is parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000415 */
Owen Taylor3473f882001-02-23 17:55:21 +0000416typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000417 const xmlChar *name,
418 const xmlChar *publicId,
419 const xmlChar *systemId,
420 const xmlChar *notationName);
421/**
422 * setDocumentLocatorSAXFunc:
423 * @ctx: the user data (XML parser context)
424 * @loc: A SAX Locator
425 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000426 * Receive the document locator at startup, actually xmlDefaultSAXLocator.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000427 * Everything is available on the context, so this is useless in our case.
428 */
Owen Taylor3473f882001-02-23 17:55:21 +0000429typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000430 xmlSAXLocatorPtr loc);
431/**
432 * startDocumentSAXFunc:
433 * @ctx: the user data (XML parser context)
434 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000435 * Called when the document start being processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000436 */
Owen Taylor3473f882001-02-23 17:55:21 +0000437typedef void (*startDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000438/**
439 * endDocumentSAXFunc:
440 * @ctx: the user data (XML parser context)
441 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000442 * Called when the document end has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000443 */
Owen Taylor3473f882001-02-23 17:55:21 +0000444typedef void (*endDocumentSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000445/**
446 * startElementSAXFunc:
447 * @ctx: the user data (XML parser context)
448 * @name: The element name, including namespace prefix
449 * @atts: An array of name/value attributes pairs, NULL terminated
450 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000451 * Called when an opening tag has been processed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000452 */
453typedef void (*startElementSAXFunc) (void *ctx,
454 const xmlChar *name,
455 const xmlChar **atts);
456/**
457 * endElementSAXFunc:
458 * @ctx: the user data (XML parser context)
459 * @name: The element name
460 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000461 * Called when the end of an element has been detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000462 */
463typedef void (*endElementSAXFunc) (void *ctx,
464 const xmlChar *name);
465/**
466 * attributeSAXFunc:
467 * @ctx: the user data (XML parser context)
468 * @name: The attribute name, including namespace prefix
469 * @value: The attribute value
470 *
471 * Handle an attribute that has been read by the parser.
472 * The default handling is to convert the attribute into an
473 * DOM subtree and past it in a new xmlAttr element added to
474 * the element.
475 */
476typedef void (*attributeSAXFunc) (void *ctx,
477 const xmlChar *name,
478 const xmlChar *value);
479/**
480 * referenceSAXFunc:
481 * @ctx: the user data (XML parser context)
482 * @name: The entity name
483 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000484 * Called when an entity reference is detected.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000485 */
486typedef void (*referenceSAXFunc) (void *ctx,
487 const xmlChar *name);
488/**
489 * charactersSAXFunc:
490 * @ctx: the user data (XML parser context)
491 * @ch: a xmlChar string
492 * @len: the number of xmlChar
493 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000494 * Receiving some chars from the parser.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000495 */
496typedef void (*charactersSAXFunc) (void *ctx,
497 const xmlChar *ch,
498 int len);
499/**
500 * ignorableWhitespaceSAXFunc:
501 * @ctx: the user data (XML parser context)
502 * @ch: a xmlChar string
503 * @len: the number of xmlChar
504 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000505 * Receiving some ignorable whitespaces from the parser.
506 * UNUSED: by default the DOM building will use characters.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000507 */
Owen Taylor3473f882001-02-23 17:55:21 +0000508typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000509 const xmlChar *ch,
510 int len);
511/**
512 * processingInstructionSAXFunc:
513 * @ctx: the user data (XML parser context)
514 * @target: the target name
515 * @data: the PI data's
516 *
517 * A processing instruction has been parsed.
518 */
Owen Taylor3473f882001-02-23 17:55:21 +0000519typedef void (*processingInstructionSAXFunc) (void *ctx,
Daniel Veillard9d06d302002-01-22 18:15:52 +0000520 const xmlChar *target,
521 const xmlChar *data);
522/**
523 * commentSAXFunc:
524 * @ctx: the user data (XML parser context)
525 * @value: the comment content
526 *
527 * A comment has been parsed.
528 */
529typedef void (*commentSAXFunc) (void *ctx,
530 const xmlChar *value);
531/**
532 * cdataBlockSAXFunc:
533 * @ctx: the user data (XML parser context)
534 * @value: The pcdata content
535 * @len: the block length
536 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000537 * Called when a pcdata block has been parsed.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000538 */
539typedef void (*cdataBlockSAXFunc) (
540 void *ctx,
541 const xmlChar *value,
542 int len);
543/**
544 * warningSAXFunc:
545 * @ctx: an XML parser context
546 * @msg: the message to display/transmit
547 * @...: extra parameters for the message display
548 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000549 * Display and format a warning messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000550 */
551typedef void (*warningSAXFunc) (void *ctx,
552 const char *msg, ...);
553/**
554 * errorSAXFunc:
555 * @ctx: an XML parser context
556 * @msg: the message to display/transmit
557 * @...: extra parameters for the message display
558 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000559 * Display and format an error messages, callback.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000560 */
561typedef void (*errorSAXFunc) (void *ctx,
562 const char *msg, ...);
563/**
564 * fatalErrorSAXFunc:
565 * @ctx: an XML parser context
566 * @msg: the message to display/transmit
567 * @...: extra parameters for the message display
568 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000569 * Display and format fatal error messages, callback.
Daniel Veillard0821b152002-11-12 20:57:47 +0000570 * Note: so far fatalError() SAX callbacks are not used, error()
571 * get all the callbacks for errors.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000572 */
573typedef void (*fatalErrorSAXFunc) (void *ctx,
574 const char *msg, ...);
575/**
576 * isStandaloneSAXFunc:
577 * @ctx: the user data (XML parser context)
578 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000579 * Is this document tagged standalone?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000580 *
581 * Returns 1 if true
582 */
Owen Taylor3473f882001-02-23 17:55:21 +0000583typedef int (*isStandaloneSAXFunc) (void *ctx);
Daniel Veillard9d06d302002-01-22 18:15:52 +0000584/**
585 * hasInternalSubsetSAXFunc:
586 * @ctx: the user data (XML parser context)
587 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000588 * Does this document has an internal subset.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000589 *
590 * Returns 1 if true
591 */
Owen Taylor3473f882001-02-23 17:55:21 +0000592typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
Daniel Veillard1af9a412003-08-20 22:54:39 +0000593
Daniel Veillard9d06d302002-01-22 18:15:52 +0000594/**
595 * hasExternalSubsetSAXFunc:
596 * @ctx: the user data (XML parser context)
597 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000598 * Does this document has an external subset?
Daniel Veillard9d06d302002-01-22 18:15:52 +0000599 *
600 * Returns 1 if true
601 */
Owen Taylor3473f882001-02-23 17:55:21 +0000602typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
603
Daniel Veillard1af9a412003-08-20 22:54:39 +0000604/************************************************************************
605 * *
606 * The SAX version 2 API extensions *
607 * *
608 ************************************************************************/
609/**
610 * XML_SAX2_MAGIC:
611 *
612 * Special constant found in SAX2 blocks initialized fields
613 */
614#define XML_SAX2_MAGIC 0xDEEDBEAF
615
616/**
617 * startElementNsSAX2Func:
618 * @ctx: the user data (XML parser context)
619 * @localname: the local name of the element
620 * @prefix: the element namespace prefix if available
621 * @URI: the element namespace name if available
622 * @nb_namespaces: number of namespace definitions on that node
623 * @namespaces: pointer to the array of prefix/URI pairs namespace definitions
624 * @nb_attributes: the number of attributes on that node
625 *
626 * SAX2 callback when an element start has been detected by the parser.
627 * It provides the namespace informations for the element, as well as
628 * the new namespace declarations on the element.
629 * The number of attributes is given in this callback but the attributes
630 * themselves will be provided as separate callbacks.
631 */
632
633typedef void (*startElementNsSAX2Func) (void *ctx,
634 const xmlChar *localname,
635 const xmlChar *prefix,
636 const xmlChar *URI,
637 int nb_namespaces,
638 const xmlChar **namespaces,
639 int nb_attributes);
640
641/**
642 * endElementNsSAX2Func:
643 * @ctx: the user data (XML parser context)
644 * @localname: the local name of the element
645 * @prefix: the element namespace prefix if available
646 * @URI: the element namespace name if available
647 *
648 * SAX2 callback when an element end has been detected by the parser.
649 * It provides the namespace informations for the element.
650 */
651
652typedef void (*endElementNsSAX2Func) (void *ctx,
653 const xmlChar *localname,
654 const xmlChar *prefix,
655 const xmlChar *URI);
656
657/**
658 * attributeNsSAX2Func:
659 * @ctx: the user data (XML parser context)
660 * @localname: the local name of the attribute
661 * @prefix: the attribute namespace prefix if available
662 * @URI: the attribute namespace name if available
663 * @value: pointer to the attribute value string
664 * @valuelen: lenght of the attribute value string in bytes
665 *
666 * SAX2 callback when an attribute has been detected by the parser.
667 * It provides the namespace informations for the attribute, as well as
668 * the value of the attribute (note that @value may not be zero terminated
669 * and use of the @valuelen is needed to find the value end).
670 */
671typedef void (*attributeNsSAX2Func) (void *ctx,
672 const xmlChar *localname,
673 const xmlChar *prefix,
674 const xmlChar *URI,
675 const xmlChar *value,
676 int valuelen);
677
Owen Taylor3473f882001-02-23 17:55:21 +0000678struct _xmlSAXHandler {
679 internalSubsetSAXFunc internalSubset;
680 isStandaloneSAXFunc isStandalone;
681 hasInternalSubsetSAXFunc hasInternalSubset;
682 hasExternalSubsetSAXFunc hasExternalSubset;
683 resolveEntitySAXFunc resolveEntity;
684 getEntitySAXFunc getEntity;
685 entityDeclSAXFunc entityDecl;
686 notationDeclSAXFunc notationDecl;
687 attributeDeclSAXFunc attributeDecl;
688 elementDeclSAXFunc elementDecl;
689 unparsedEntityDeclSAXFunc unparsedEntityDecl;
690 setDocumentLocatorSAXFunc setDocumentLocator;
691 startDocumentSAXFunc startDocument;
692 endDocumentSAXFunc endDocument;
693 startElementSAXFunc startElement;
694 endElementSAXFunc endElement;
695 referenceSAXFunc reference;
696 charactersSAXFunc characters;
697 ignorableWhitespaceSAXFunc ignorableWhitespace;
698 processingInstructionSAXFunc processingInstruction;
699 commentSAXFunc comment;
700 warningSAXFunc warning;
701 errorSAXFunc error;
Daniel Veillard0821b152002-11-12 20:57:47 +0000702 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
Owen Taylor3473f882001-02-23 17:55:21 +0000703 getParameterEntitySAXFunc getParameterEntity;
704 cdataBlockSAXFunc cdataBlock;
705 externalSubsetSAXFunc externalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000706 int initialized;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000707 /* The following fields are extensions available only on version 2 */
708 void *_private;
709 startElementNsSAX2Func startElementNs;
710 endElementNsSAX2Func endElementNs;
711 attributeNsSAX2Func attributeNs;
Owen Taylor3473f882001-02-23 17:55:21 +0000712};
713
714/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000715 * xmlExternalEntityLoader:
716 * @URL: The System ID of the resource requested
717 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000718 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000719 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000720 * External entity loaders types.
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000721 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000722 * Returns the entity input parser.
Owen Taylor3473f882001-02-23 17:55:21 +0000723 */
Daniel Veillard9d06d302002-01-22 18:15:52 +0000724typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
725 const char *ID,
726 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000727
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000728/*
Owen Taylor3473f882001-02-23 17:55:21 +0000729 * Global variables: just the default SAX interface tables and XML
730 * version infos.
731 */
Daniel Veillard0ba59232002-02-10 13:20:39 +0000732#if 0
Owen Taylor3473f882001-02-23 17:55:21 +0000733LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000734#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000735
Daniel Veillard0ba59232002-02-10 13:20:39 +0000736/*
Owen Taylor3473f882001-02-23 17:55:21 +0000737LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
738LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
739LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000740LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000741 */
Owen Taylor3473f882001-02-23 17:55:21 +0000742
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000743/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000744 * Entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000745 */
746
Daniel Veillard0ba59232002-02-10 13:20:39 +0000747#if 0
748LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
Owen Taylor3473f882001-02-23 17:55:21 +0000749LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
Daniel Veillard0ba59232002-02-10 13:20:39 +0000750#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000751
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000752#ifdef __cplusplus
753}
754#endif
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000755
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000756#include <libxml/encoding.h>
757#include <libxml/xmlIO.h>
758#include <libxml/globals.h>
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000759
Daniel Veillard6c4ffaf2002-02-11 08:54:05 +0000760#ifdef __cplusplus
761extern "C" {
762#endif
763
Owen Taylor3473f882001-02-23 17:55:21 +0000764
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000765/*
Owen Taylor3473f882001-02-23 17:55:21 +0000766 * Init/Cleanup
767 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000768XMLPUBFUN void XMLCALL
769 xmlInitParser (void);
770XMLPUBFUN void XMLCALL
771 xmlCleanupParser (void);
Owen Taylor3473f882001-02-23 17:55:21 +0000772
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000773/*
Owen Taylor3473f882001-02-23 17:55:21 +0000774 * Input functions
775 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000776XMLPUBFUN int XMLCALL
777 xmlParserInputRead (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000778 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000779XMLPUBFUN int XMLCALL
780 xmlParserInputGrow (xmlParserInputPtr in,
Owen Taylor3473f882001-02-23 17:55:21 +0000781 int len);
782
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000783/*
Owen Taylor3473f882001-02-23 17:55:21 +0000784 * xmlChar handling
785 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000786XMLPUBFUN xmlChar * XMLCALL
787 xmlStrdup (const xmlChar *cur);
788XMLPUBFUN xmlChar * XMLCALL
789 xmlStrndup (const xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000790 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000791XMLPUBFUN xmlChar * XMLCALL
792 xmlCharStrndup (const char *cur,
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000793 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000794XMLPUBFUN xmlChar * XMLCALL
795 xmlCharStrdup (const char *cur);
796XMLPUBFUN xmlChar * XMLCALL
797 xmlStrsub (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000798 int start,
799 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000800XMLPUBFUN const xmlChar * XMLCALL
801 xmlStrchr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000802 xmlChar val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000803XMLPUBFUN const xmlChar * XMLCALL
804 xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000805 const xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000806XMLPUBFUN const xmlChar * XMLCALL
807 xmlStrcasestr (const xmlChar *str,
Owen Taylor3473f882001-02-23 17:55:21 +0000808 xmlChar *val);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000809XMLPUBFUN int XMLCALL
810 xmlStrcmp (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 xmlStrncmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000814 const xmlChar *str2,
815 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000816XMLPUBFUN int XMLCALL
817 xmlStrcasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000818 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000819XMLPUBFUN int XMLCALL
820 xmlStrncasecmp (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000821 const xmlChar *str2,
822 int len);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000823XMLPUBFUN int XMLCALL
824 xmlStrEqual (const xmlChar *str1,
Owen Taylor3473f882001-02-23 17:55:21 +0000825 const xmlChar *str2);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000826XMLPUBFUN int XMLCALL
827 xmlStrlen (const xmlChar *str);
828XMLPUBFUN xmlChar * XMLCALL
829 xmlStrcat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000830 const xmlChar *add);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000831XMLPUBFUN xmlChar * XMLCALL
832 xmlStrncat (xmlChar *cur,
Owen Taylor3473f882001-02-23 17:55:21 +0000833 const xmlChar *add,
834 int len);
835
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000836/*
Owen Taylor3473f882001-02-23 17:55:21 +0000837 * Basic parsing Interfaces
838 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000839XMLPUBFUN xmlDocPtr XMLCALL
840 xmlParseDoc (xmlChar *cur);
841XMLPUBFUN xmlDocPtr XMLCALL
842 xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000843 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000844XMLPUBFUN xmlDocPtr XMLCALL
845 xmlParseFile (const char *filename);
846XMLPUBFUN int XMLCALL
847 xmlSubstituteEntitiesDefault(int val);
848XMLPUBFUN int XMLCALL
849 xmlKeepBlanksDefault (int val);
850XMLPUBFUN void XMLCALL
851 xmlStopParser (xmlParserCtxtPtr ctxt);
852XMLPUBFUN int XMLCALL
853 xmlPedanticParserDefault(int val);
854XMLPUBFUN int XMLCALL
855 xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000856
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000857/*
Owen Taylor3473f882001-02-23 17:55:21 +0000858 * Recovery mode
859 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000860XMLPUBFUN xmlDocPtr XMLCALL
861 xmlRecoverDoc (xmlChar *cur);
862XMLPUBFUN xmlDocPtr XMLCALL
863 xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000864 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000865XMLPUBFUN xmlDocPtr XMLCALL
866 xmlRecoverFile (const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000867
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000868/*
Owen Taylor3473f882001-02-23 17:55:21 +0000869 * Less common routines and SAX interfaces
870 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000871XMLPUBFUN int XMLCALL
872 xmlParseDocument (xmlParserCtxtPtr ctxt);
873XMLPUBFUN int XMLCALL
874 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
875XMLPUBFUN xmlDocPtr XMLCALL
876 xmlSAXParseDoc (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000877 xmlChar *cur,
878 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000879XMLPUBFUN int XMLCALL
880 xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000881 void *user_data,
882 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000883XMLPUBFUN int XMLCALL
884 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000885 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000886 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000887 int size);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000888XMLPUBFUN xmlDocPtr XMLCALL
889 xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000890 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000891 int size,
892 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000893XMLPUBFUN xmlDocPtr XMLCALL
894 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
Daniel Veillard8606bbb2002-11-12 12:36:52 +0000895 const char *buffer,
896 int size,
897 int recovery,
898 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000899XMLPUBFUN xmlDocPtr XMLCALL
900 xmlSAXParseFile (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000901 const char *filename,
902 int recovery);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000903XMLPUBFUN xmlDocPtr XMLCALL
904 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
Daniel Veillarda293c322001-10-02 13:54:14 +0000905 const char *filename,
906 int recovery,
907 void *data);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000908XMLPUBFUN xmlDocPtr XMLCALL
909 xmlSAXParseEntity (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000910 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000911XMLPUBFUN xmlDocPtr XMLCALL
912 xmlParseEntity (const char *filename);
913XMLPUBFUN xmlDtdPtr XMLCALL
914 xmlParseDTD (const xmlChar *ExternalID,
Owen Taylor3473f882001-02-23 17:55:21 +0000915 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000916XMLPUBFUN xmlDtdPtr XMLCALL
917 xmlSAXParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000918 const xmlChar *ExternalID,
919 const xmlChar *SystemID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000920XMLPUBFUN xmlDtdPtr XMLCALL
921 xmlIOParseDTD (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000922 xmlParserInputBufferPtr input,
923 xmlCharEncoding enc);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000924XMLPUBFUN int XMLCALL
925 xmlParseBalancedChunkMemory(xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000926 xmlSAXHandlerPtr sax,
927 void *user_data,
928 int depth,
929 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000930 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000931XMLPUBFUN int XMLCALL
932 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
Daniel Veillard58e44c92002-08-02 22:19:49 +0000933 xmlSAXHandlerPtr sax,
934 void *user_data,
935 int depth,
936 const xmlChar *string,
937 xmlNodePtr *lst,
938 int recover);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000939XMLPUBFUN int XMLCALL
940 xmlParseExternalEntity (xmlDocPtr doc,
Owen Taylor3473f882001-02-23 17:55:21 +0000941 xmlSAXHandlerPtr sax,
942 void *user_data,
943 int depth,
944 const xmlChar *URL,
945 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000946 xmlNodePtr *lst);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000947XMLPUBFUN int XMLCALL
948 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
Owen Taylor3473f882001-02-23 17:55:21 +0000949 const xmlChar *URL,
950 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000951 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000952
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000953/*
Owen Taylor3473f882001-02-23 17:55:21 +0000954 * Parser contexts handling.
955 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000956XMLPUBFUN int XMLCALL
957 xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
958XMLPUBFUN void XMLCALL
959 xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
960XMLPUBFUN void XMLCALL
961 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
962XMLPUBFUN void XMLCALL
963 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000964 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000965 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000966XMLPUBFUN xmlParserCtxtPtr XMLCALL
967 xmlCreateDocParserCtxt (xmlChar *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000968
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000969/*
Owen Taylor3473f882001-02-23 17:55:21 +0000970 * Reading/setting optional parsing features.
971 */
972
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000973XMLPUBFUN int XMLCALL
974 xmlGetFeaturesList (int *len,
Owen Taylor3473f882001-02-23 17:55:21 +0000975 const char **result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000976XMLPUBFUN int XMLCALL
977 xmlGetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000978 const char *name,
979 void *result);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000980XMLPUBFUN int XMLCALL
981 xmlSetFeature (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000982 const char *name,
983 void *value);
984
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000985/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000986 * Interfaces for the Push mode.
Owen Taylor3473f882001-02-23 17:55:21 +0000987 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000988XMLPUBFUN xmlParserCtxtPtr XMLCALL
989 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +0000990 void *user_data,
991 const char *chunk,
992 int size,
993 const char *filename);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000994XMLPUBFUN int XMLCALL
995 xmlParseChunk (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000996 const char *chunk,
997 int size,
998 int terminate);
999
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001000/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001001 * Special I/O mode.
Owen Taylor3473f882001-02-23 17:55:21 +00001002 */
1003
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001004XMLPUBFUN xmlParserCtxtPtr XMLCALL
1005 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
Owen Taylor3473f882001-02-23 17:55:21 +00001006 void *user_data,
1007 xmlInputReadCallback ioread,
1008 xmlInputCloseCallback ioclose,
1009 void *ioctx,
1010 xmlCharEncoding enc);
1011
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001012XMLPUBFUN xmlParserInputPtr XMLCALL
1013 xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +00001014 xmlParserInputBufferPtr input,
1015 xmlCharEncoding enc);
1016
Daniel Veillardf69bb4b2001-05-19 13:24:56 +00001017/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001018 * Node infos.
Owen Taylor3473f882001-02-23 17:55:21 +00001019 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001020XMLPUBFUN const xmlParserNodeInfo* XMLCALL
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001021 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
1022 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001023XMLPUBFUN void XMLCALL
1024 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1025XMLPUBFUN void XMLCALL
1026 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
1027XMLPUBFUN unsigned long XMLCALL
1028 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001029 const xmlNodePtr node);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001030XMLPUBFUN void XMLCALL
1031 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +00001032 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +00001033
1034/*
Daniel Veillard61f26172002-03-12 18:46:39 +00001035 * External entities handling actually implemented in xmlIO.
Owen Taylor3473f882001-02-23 17:55:21 +00001036 */
1037
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001038XMLPUBFUN void XMLCALL
1039 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
1040XMLPUBFUN xmlExternalEntityLoader XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001041 xmlGetExternalEntityLoader(void);
Igor Zlatkovic76874e42003-08-25 09:05:12 +00001042XMLPUBFUN xmlParserInputPtr XMLCALL
Owen Taylor3473f882001-02-23 17:55:21 +00001043 xmlLoadExternalEntity (const char *URL,
1044 const char *ID,
Daniel Veillard9d06d302002-01-22 18:15:52 +00001045 xmlParserCtxtPtr ctxt);
Owen Taylor3473f882001-02-23 17:55:21 +00001046
1047#ifdef __cplusplus
1048}
1049#endif
Owen Taylor3473f882001-02-23 17:55:21 +00001050#endif /* __XML_PARSER_H__ */
1051