blob: de0bebbe6e5f728c240a4cd79640f375759a1722 [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
12#include <libxml/tree.h>
13#include <libxml/valid.h>
14#include <libxml/xmlIO.h>
15#include <libxml/entities.h>
16
17
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 *
Owen Taylor3473f882001-02-23 17:55:21 +000032 * an xmlParserInput is an input flow for the XML processor.
33 * 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
40typedef void (* xmlParserInputDeallocate)(xmlChar *);
Daniel Veillard5e2dace2001-07-18 19:30:27 +000041
Owen Taylor3473f882001-02-23 17:55:21 +000042typedef struct _xmlParserInput xmlParserInput;
43typedef xmlParserInput *xmlParserInputPtr;
44struct _xmlParserInput {
45 /* Input buffer */
46 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
47
48 const char *filename; /* The file analyzed, if any */
49 const char *directory; /* the directory/base of teh file */
50 const xmlChar *base; /* Base of the array to parse */
51 const xmlChar *cur; /* Current char being parsed */
Daniel Veillard48b2f892001-02-25 16:11:03 +000052 const xmlChar *end; /* end of the arry to parse */
Owen Taylor3473f882001-02-23 17:55:21 +000053 int length; /* length if known */
54 int line; /* Current line */
55 int col; /* Current column */
56 int consumed; /* How many xmlChars already consumed */
57 xmlParserInputDeallocate free; /* function to deallocate the base */
58 const xmlChar *encoding; /* the encoding string for entity */
59 const xmlChar *version; /* the version string for entity */
60 int standalone; /* Was that entity marked standalone */
61};
62
63/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000064 * xmlParserNodeInfo:
65 *
Owen Taylor3473f882001-02-23 17:55:21 +000066 * the parser can be asked to collect Node informations, i.e. at what
67 * place in the file they were detected.
68 * NOTE: This is off by default and not very well tested.
69 */
70typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
71typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
72
73struct _xmlParserNodeInfo {
74 const struct _xmlNode* node;
75 /* Position & line # that text that created the node begins & ends on */
76 unsigned long begin_pos;
77 unsigned long begin_line;
78 unsigned long end_pos;
79 unsigned long end_line;
80};
81
82typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
83typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
84struct _xmlParserNodeInfoSeq {
85 unsigned long maximum;
86 unsigned long length;
87 xmlParserNodeInfo* buffer;
88};
89
90/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000091 * xmlParserInputState:
92 *
Owen Taylor3473f882001-02-23 17:55:21 +000093 * The parser is now working also as a state based parser
94 * The recursive one use the stagte info for entities processing
95 */
96typedef enum {
97 XML_PARSER_EOF = -1, /* nothing is to be parsed */
98 XML_PARSER_START = 0, /* nothing has been parsed */
99 XML_PARSER_MISC, /* Misc* before int subset */
100 XML_PARSER_PI, /* Whithin a processing instruction */
101 XML_PARSER_DTD, /* within some DTD content */
102 XML_PARSER_PROLOG, /* Misc* after internal subset */
103 XML_PARSER_COMMENT, /* within a comment */
104 XML_PARSER_START_TAG, /* within a start tag */
105 XML_PARSER_CONTENT, /* within the content */
106 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
107 XML_PARSER_END_TAG, /* within a closing tag */
108 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
109 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
110 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
111 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
112 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
113 XML_PARSER_IGNORE /* within an IGNORED section */
114} xmlParserInputState;
115
116/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000117 * XML_DETECT_IDS:
118 *
119 * Bit in the loadsubset context field to tell to do ID/REFs lookups
120 * Use it to initialize xmlLoadExtDtdDefaultValue
121 */
122#define XML_DETECT_IDS 2
123
124/**
125 * XML_COMPLETE_ATTRS:
126 *
127 * Bit in the loadsubset context field to tell to do complete the
128 * elements attributes lists with the ones defaulted from the DTDs
129 * Use it to initialize xmlLoadExtDtdDefaultValue
130 */
131#define XML_COMPLETE_ATTRS 4
132
133/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000134 * xmlParserCtxt:
135 *
Owen Taylor3473f882001-02-23 17:55:21 +0000136 * The parser context.
137 * NOTE This doesn't completely defines the parser state, the (current ?)
138 * design of the parser uses recursive function calls since this allow
139 * and easy mapping from the production rules of the specification
140 * to the actual code. The drawback is that the actual function call
141 * also reflect the parser state. However most of the parsing routines
142 * takes as the only argument the parser context pointer, so migrating
143 * to a state based parser for progressive parsing shouldn't be too hard.
144 */
145typedef struct _xmlParserCtxt xmlParserCtxt;
146typedef xmlParserCtxt *xmlParserCtxtPtr;
147struct _xmlParserCtxt {
148 struct _xmlSAXHandler *sax; /* The SAX handler */
149 void *userData; /* For SAX interface only, used by DOM build */
150 xmlDocPtr myDoc; /* the document being built */
151 int wellFormed; /* is the document well formed */
152 int replaceEntities; /* shall we replace entities ? */
153 const xmlChar *version; /* the XML version string */
154 const xmlChar *encoding; /* the declared encoding, if any */
155 int standalone; /* standalone document */
156 int html; /* an HTML(1)/Docbook(2) document */
157
158 /* Input stream stack */
159 xmlParserInputPtr input; /* Current input stream */
160 int inputNr; /* Number of current input streams */
161 int inputMax; /* Max number of input streams */
162 xmlParserInputPtr *inputTab; /* stack of inputs */
163
164 /* Node analysis stack only used for DOM building */
165 xmlNodePtr node; /* Current parsed Node */
166 int nodeNr; /* Depth of the parsing stack */
167 int nodeMax; /* Max depth of the parsing stack */
168 xmlNodePtr *nodeTab; /* array of nodes */
169
170 int record_info; /* Whether node info should be kept */
171 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
172
173 int errNo; /* error code */
174
175 int hasExternalSubset; /* reference and external subset */
176 int hasPErefs; /* the internal subset has PE refs */
177 int external; /* are we parsing an external entity */
178
179 int valid; /* is the document valid */
180 int validate; /* shall we try to validate ? */
181 xmlValidCtxt vctxt; /* The validity context */
182
183 xmlParserInputState instate; /* current type of input */
184 int token; /* next char look-ahead */
185
186 char *directory; /* the data directory */
187
188 /* Node name stack */
189 xmlChar *name; /* Current parsed Node */
190 int nameNr; /* Depth of the parsing stack */
191 int nameMax; /* Max depth of the parsing stack */
192 xmlChar * *nameTab; /* array of nodes */
193
194 long nbChars; /* number of xmlChar processed */
195 long checkIndex; /* used by progressive parsing lookup */
196 int keepBlanks; /* ugly but ... */
197 int disableSAX; /* SAX callbacks are disabled */
198 int inSubset; /* Parsing is in int 1/ext 2 subset */
199 xmlChar * intSubName; /* name of subset */
200 xmlChar * extSubURI; /* URI of external subset */
201 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
202
203 /* xml:space values */
204 int * space; /* Should the parser preserve spaces */
205 int spaceNr; /* Depth of the parsing stack */
206 int spaceMax; /* Max depth of the parsing stack */
207 int * spaceTab; /* array of space infos */
208
209 int depth; /* to prevent entity substitution loops */
210 xmlParserInputPtr entity; /* used to check entities boundaries */
211 int charset; /* encoding of the in-memory content
212 actually an xmlCharEncoding */
213 int nodelen; /* Those two fields are there to */
214 int nodemem; /* Speed up large node parsing */
215 int pedantic; /* signal pedantic warnings */
216 void *_private; /* For user data, libxml won't touch it */
217
218 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000219 int linenumbers; /* set line number in element content */
Owen Taylor3473f882001-02-23 17:55:21 +0000220};
221
222/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000223 * xmlSAXLocator:
224 *
Owen Taylor3473f882001-02-23 17:55:21 +0000225 * a SAX Locator.
226 */
227typedef struct _xmlSAXLocator xmlSAXLocator;
228typedef xmlSAXLocator *xmlSAXLocatorPtr;
229struct _xmlSAXLocator {
230 const xmlChar *(*getPublicId)(void *ctx);
231 const xmlChar *(*getSystemId)(void *ctx);
232 int (*getLineNumber)(void *ctx);
233 int (*getColumnNumber)(void *ctx);
234};
235
236/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000237 * xmlSAXHandler:
238 *
Owen Taylor3473f882001-02-23 17:55:21 +0000239 * a SAX handler is bunch of callbacks called by the parser when processing
240 * of the input generate data or structure informations.
241 */
242
243typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
244 const xmlChar *publicId, const xmlChar *systemId);
245typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name,
246 const xmlChar *ExternalID, const xmlChar *SystemID);
247typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name,
248 const xmlChar *ExternalID, const xmlChar *SystemID);
249typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
250 const xmlChar *name);
251typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
252 const xmlChar *name);
253typedef void (*entityDeclSAXFunc) (void *ctx,
254 const xmlChar *name, int type, const xmlChar *publicId,
255 const xmlChar *systemId, xmlChar *content);
256typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name,
257 const xmlChar *publicId, const xmlChar *systemId);
258typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem,
259 const xmlChar *name, int type, int def,
260 const xmlChar *defaultValue, xmlEnumerationPtr tree);
261typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name,
262 int type, xmlElementContentPtr content);
263typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
264 const xmlChar *name, const xmlChar *publicId,
265 const xmlChar *systemId, const xmlChar *notationName);
266typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
267 xmlSAXLocatorPtr loc);
268typedef void (*startDocumentSAXFunc) (void *ctx);
269typedef void (*endDocumentSAXFunc) (void *ctx);
270typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name,
271 const xmlChar **atts);
272typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name);
273typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name,
274 const xmlChar *value);
275typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name);
276typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch,
277 int len);
278typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
279 const xmlChar *ch, int len);
280typedef void (*processingInstructionSAXFunc) (void *ctx,
281 const xmlChar *target, const xmlChar *data);
282typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value);
283typedef void (*cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len);
284typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
285typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
286typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
287typedef int (*isStandaloneSAXFunc) (void *ctx);
288typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
289typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
290
291typedef struct _xmlSAXHandler xmlSAXHandler;
292typedef xmlSAXHandler *xmlSAXHandlerPtr;
293struct _xmlSAXHandler {
294 internalSubsetSAXFunc internalSubset;
295 isStandaloneSAXFunc isStandalone;
296 hasInternalSubsetSAXFunc hasInternalSubset;
297 hasExternalSubsetSAXFunc hasExternalSubset;
298 resolveEntitySAXFunc resolveEntity;
299 getEntitySAXFunc getEntity;
300 entityDeclSAXFunc entityDecl;
301 notationDeclSAXFunc notationDecl;
302 attributeDeclSAXFunc attributeDecl;
303 elementDeclSAXFunc elementDecl;
304 unparsedEntityDeclSAXFunc unparsedEntityDecl;
305 setDocumentLocatorSAXFunc setDocumentLocator;
306 startDocumentSAXFunc startDocument;
307 endDocumentSAXFunc endDocument;
308 startElementSAXFunc startElement;
309 endElementSAXFunc endElement;
310 referenceSAXFunc reference;
311 charactersSAXFunc characters;
312 ignorableWhitespaceSAXFunc ignorableWhitespace;
313 processingInstructionSAXFunc processingInstruction;
314 commentSAXFunc comment;
315 warningSAXFunc warning;
316 errorSAXFunc error;
317 fatalErrorSAXFunc fatalError;
318 getParameterEntitySAXFunc getParameterEntity;
319 cdataBlockSAXFunc cdataBlock;
320 externalSubsetSAXFunc externalSubset;
321};
322
323/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000324 * xmlExternalEntityLoader:
325 * @URL: The System ID of the resource requested
326 * @ID: The Public ID of the resource requested
327 * @xmlParserCtxtPtr: the XML parser context
328 *
Owen Taylor3473f882001-02-23 17:55:21 +0000329 * External entity loaders types
330 */
331typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL,
332 const char *ID,
333 xmlParserCtxtPtr context);
334
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000335/*
Owen Taylor3473f882001-02-23 17:55:21 +0000336 * Global variables: just the default SAX interface tables and XML
337 * version infos.
338 */
339LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
340
341LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
342LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
343LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000344LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Owen Taylor3473f882001-02-23 17:55:21 +0000345
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000346/*
Owen Taylor3473f882001-02-23 17:55:21 +0000347 * entity substitution default behaviour.
348 */
349
350#ifdef VMS
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000351/**
352 * xmlSubstituteEntitiesDefaultValue:
353 *
354 * global variable controlling the entity substitution default behaviour
355 */
Owen Taylor3473f882001-02-23 17:55:21 +0000356LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultVal;
357#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
358#else
359LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
360#endif
361LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
362
363
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000364/*
Owen Taylor3473f882001-02-23 17:55:21 +0000365 * Init/Cleanup
366 */
367void xmlInitParser (void);
368void xmlCleanupParser (void);
369
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000370/*
Owen Taylor3473f882001-02-23 17:55:21 +0000371 * Input functions
372 */
373int xmlParserInputRead (xmlParserInputPtr in,
374 int len);
375int xmlParserInputGrow (xmlParserInputPtr in,
376 int len);
377
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000378/*
Owen Taylor3473f882001-02-23 17:55:21 +0000379 * xmlChar handling
380 */
381xmlChar * xmlStrdup (const xmlChar *cur);
382xmlChar * xmlStrndup (const xmlChar *cur,
383 int len);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000384xmlChar * xmlCharStrndup (const char *cur,
385 int len);
386xmlChar * xmlCharStrdup (const char *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000387xmlChar * xmlStrsub (const xmlChar *str,
388 int start,
389 int len);
390const xmlChar * xmlStrchr (const xmlChar *str,
391 xmlChar val);
392const xmlChar * xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000393 const xmlChar *val);
Owen Taylor3473f882001-02-23 17:55:21 +0000394const xmlChar * xmlStrcasestr (const xmlChar *str,
395 xmlChar *val);
396int xmlStrcmp (const xmlChar *str1,
397 const xmlChar *str2);
398int xmlStrncmp (const xmlChar *str1,
399 const xmlChar *str2,
400 int len);
401int xmlStrcasecmp (const xmlChar *str1,
402 const xmlChar *str2);
403int xmlStrncasecmp (const xmlChar *str1,
404 const xmlChar *str2,
405 int len);
406int xmlStrEqual (const xmlChar *str1,
407 const xmlChar *str2);
408int xmlStrlen (const xmlChar *str);
409xmlChar * xmlStrcat (xmlChar *cur,
410 const xmlChar *add);
411xmlChar * xmlStrncat (xmlChar *cur,
412 const xmlChar *add,
413 int len);
414
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000415/*
Owen Taylor3473f882001-02-23 17:55:21 +0000416 * Basic parsing Interfaces
417 */
418xmlDocPtr xmlParseDoc (xmlChar *cur);
Daniel Veillard50822cb2001-07-26 20:05:51 +0000419xmlDocPtr xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000420 int size);
421xmlDocPtr xmlParseFile (const char *filename);
422int xmlSubstituteEntitiesDefault(int val);
423int xmlKeepBlanksDefault (int val);
424void xmlStopParser (xmlParserCtxtPtr ctxt);
425int xmlPedanticParserDefault(int val);
Daniel Veillardd9bad132001-07-23 19:39:43 +0000426int xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000427
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000428/*
Owen Taylor3473f882001-02-23 17:55:21 +0000429 * Recovery mode
430 */
431xmlDocPtr xmlRecoverDoc (xmlChar *cur);
Daniel Veillard50822cb2001-07-26 20:05:51 +0000432xmlDocPtr xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000433 int size);
434xmlDocPtr xmlRecoverFile (const char *filename);
435
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000436/*
Owen Taylor3473f882001-02-23 17:55:21 +0000437 * Less common routines and SAX interfaces
438 */
439int xmlParseDocument (xmlParserCtxtPtr ctxt);
440int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
441xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
442 xmlChar *cur,
443 int recovery);
444int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
445 void *user_data,
446 const char *filename);
447int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
448 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000449 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000450 int size);
451xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000452 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000453 int size,
454 int recovery);
455xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
456 const char *filename,
457 int recovery);
458xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
459 const char *filename);
460xmlDocPtr xmlParseEntity (const char *filename);
461xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
462 const xmlChar *SystemID);
463xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
464 const xmlChar *ExternalID,
465 const xmlChar *SystemID);
466xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
467 xmlParserInputBufferPtr input,
468 xmlCharEncoding enc);
469int xmlParseBalancedChunkMemory(xmlDocPtr doc,
470 xmlSAXHandlerPtr sax,
471 void *user_data,
472 int depth,
473 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000474 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000475int xmlParseExternalEntity (xmlDocPtr doc,
476 xmlSAXHandlerPtr sax,
477 void *user_data,
478 int depth,
479 const xmlChar *URL,
480 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000481 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000482int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
483 const xmlChar *URL,
484 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000485 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000486
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000487/*
Owen Taylor3473f882001-02-23 17:55:21 +0000488 * SAX initialization routines
489 */
490void xmlDefaultSAXHandlerInit(void);
491void htmlDefaultSAXHandlerInit(void);
492
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000493/*
Owen Taylor3473f882001-02-23 17:55:21 +0000494 * Parser contexts handling.
495 */
496void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
497void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
498void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
499void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
500 const xmlChar* buffer,
501 const char* filename);
502xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
503
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000504/*
Owen Taylor3473f882001-02-23 17:55:21 +0000505 * Reading/setting optional parsing features.
506 */
507
508int xmlGetFeaturesList (int *len,
509 const char **result);
510int xmlGetFeature (xmlParserCtxtPtr ctxt,
511 const char *name,
512 void *result);
513int xmlSetFeature (xmlParserCtxtPtr ctxt,
514 const char *name,
515 void *value);
516
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000517/*
Owen Taylor3473f882001-02-23 17:55:21 +0000518 * Interfaces for the Push mode
519 */
520xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
521 void *user_data,
522 const char *chunk,
523 int size,
524 const char *filename);
525int xmlParseChunk (xmlParserCtxtPtr ctxt,
526 const char *chunk,
527 int size,
528 int terminate);
529
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000530/*
Owen Taylor3473f882001-02-23 17:55:21 +0000531 * Special I/O mode
532 */
533
534xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
535 void *user_data,
536 xmlInputReadCallback ioread,
537 xmlInputCloseCallback ioclose,
538 void *ioctx,
539 xmlCharEncoding enc);
540
541xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
542 xmlParserInputBufferPtr input,
543 xmlCharEncoding enc);
544
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000545/*
Owen Taylor3473f882001-02-23 17:55:21 +0000546 * Node infos
547 */
548const xmlParserNodeInfo*
549 xmlParserFindNodeInfo (const xmlParserCtxt* ctxt,
550 const xmlNode* node);
551void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
552void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
553unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
554 const xmlNode* node);
555void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
556 const xmlParserNodeInfo* info);
557
558/*
559 * External entities handling actually implemented in xmlIO
560 */
561
562void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
563xmlExternalEntityLoader
564 xmlGetExternalEntityLoader(void);
565xmlParserInputPtr
566 xmlLoadExternalEntity (const char *URL,
567 const char *ID,
568 xmlParserCtxtPtr context);
569
570#ifdef __cplusplus
571}
572#endif
573
574#endif /* __XML_PARSER_H__ */
575