blob: 21244da7021c3161eaf2c564bb66b3b0d0e7cd3f [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>
Owen Taylor3473f882001-02-23 17:55:21 +000016
17#ifdef __cplusplus
18extern "C" {
19#endif
20
Daniel Veillard5e2dace2001-07-18 19:30:27 +000021/**
22 * XML_DEFAULT_VERSION:
23 *
24 * The default version of XML used: 1.0
Owen Taylor3473f882001-02-23 17:55:21 +000025 */
26#define XML_DEFAULT_VERSION "1.0"
27
28/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000029 * xmlParserInput:
30 *
Owen Taylor3473f882001-02-23 17:55:21 +000031 * an xmlParserInput is an input flow for the XML processor.
32 * Each entity parsed is associated an xmlParserInput (except the
33 * few predefined ones). This is the case both for internal entities
34 * - in which case the flow is already completely in memory - or
35 * external entities - in which case we use the buf structure for
36 * progressive reading and I18N conversions to the internal UTF-8 format.
37 */
38
39typedef void (* xmlParserInputDeallocate)(xmlChar *);
Daniel Veillard5e2dace2001-07-18 19:30:27 +000040
Owen Taylor3473f882001-02-23 17:55:21 +000041typedef struct _xmlParserInput xmlParserInput;
42typedef xmlParserInput *xmlParserInputPtr;
43struct _xmlParserInput {
44 /* Input buffer */
45 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
46
47 const char *filename; /* The file analyzed, if any */
Daniel Veillard60087f32001-10-10 09:45:09 +000048 const char *directory; /* the directory/base of the file */
Owen Taylor3473f882001-02-23 17:55:21 +000049 const xmlChar *base; /* Base of the array to parse */
50 const xmlChar *cur; /* Current char being parsed */
Daniel Veillard48b2f892001-02-25 16:11:03 +000051 const xmlChar *end; /* end of the arry to parse */
Owen Taylor3473f882001-02-23 17:55:21 +000052 int length; /* length if known */
53 int line; /* Current line */
54 int col; /* Current column */
55 int consumed; /* How many xmlChars already consumed */
56 xmlParserInputDeallocate free; /* function to deallocate the base */
57 const xmlChar *encoding; /* the encoding string for entity */
58 const xmlChar *version; /* the version string for entity */
59 int standalone; /* Was that entity marked standalone */
60};
61
62/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000063 * xmlParserNodeInfo:
64 *
Owen Taylor3473f882001-02-23 17:55:21 +000065 * the parser can be asked to collect Node informations, i.e. at what
66 * place in the file they were detected.
67 * NOTE: This is off by default and not very well tested.
68 */
69typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
70typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
71
72struct _xmlParserNodeInfo {
73 const struct _xmlNode* node;
74 /* Position & line # that text that created the node begins & ends on */
75 unsigned long begin_pos;
76 unsigned long begin_line;
77 unsigned long end_pos;
78 unsigned long end_line;
79};
80
81typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
82typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
83struct _xmlParserNodeInfoSeq {
84 unsigned long maximum;
85 unsigned long length;
86 xmlParserNodeInfo* buffer;
87};
88
89/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000090 * xmlParserInputState:
91 *
Owen Taylor3473f882001-02-23 17:55:21 +000092 * The parser is now working also as a state based parser
93 * The recursive one use the stagte info for entities processing
94 */
95typedef enum {
96 XML_PARSER_EOF = -1, /* nothing is to be parsed */
97 XML_PARSER_START = 0, /* nothing has been parsed */
98 XML_PARSER_MISC, /* Misc* before int subset */
99 XML_PARSER_PI, /* Whithin a processing instruction */
100 XML_PARSER_DTD, /* within some DTD content */
101 XML_PARSER_PROLOG, /* Misc* after internal subset */
102 XML_PARSER_COMMENT, /* within a comment */
103 XML_PARSER_START_TAG, /* within a start tag */
104 XML_PARSER_CONTENT, /* within the content */
105 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
106 XML_PARSER_END_TAG, /* within a closing tag */
107 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
108 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
109 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
110 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
111 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
112 XML_PARSER_IGNORE /* within an IGNORED section */
113} xmlParserInputState;
114
115/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000116 * XML_DETECT_IDS:
117 *
118 * Bit in the loadsubset context field to tell to do ID/REFs lookups
119 * Use it to initialize xmlLoadExtDtdDefaultValue
120 */
121#define XML_DETECT_IDS 2
122
123/**
124 * XML_COMPLETE_ATTRS:
125 *
126 * Bit in the loadsubset context field to tell to do complete the
127 * elements attributes lists with the ones defaulted from the DTDs
128 * Use it to initialize xmlLoadExtDtdDefaultValue
129 */
130#define XML_COMPLETE_ATTRS 4
131
132/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000133 * xmlParserCtxt:
134 *
Owen Taylor3473f882001-02-23 17:55:21 +0000135 * The parser context.
136 * NOTE This doesn't completely defines the parser state, the (current ?)
137 * design of the parser uses recursive function calls since this allow
138 * and easy mapping from the production rules of the specification
139 * to the actual code. The drawback is that the actual function call
140 * also reflect the parser state. However most of the parsing routines
141 * takes as the only argument the parser context pointer, so migrating
142 * to a state based parser for progressive parsing shouldn't be too hard.
143 */
144typedef struct _xmlParserCtxt xmlParserCtxt;
145typedef xmlParserCtxt *xmlParserCtxtPtr;
146struct _xmlParserCtxt {
147 struct _xmlSAXHandler *sax; /* The SAX handler */
148 void *userData; /* For SAX interface only, used by DOM build */
149 xmlDocPtr myDoc; /* the document being built */
150 int wellFormed; /* is the document well formed */
151 int replaceEntities; /* shall we replace entities ? */
152 const xmlChar *version; /* the XML version string */
153 const xmlChar *encoding; /* the declared encoding, if any */
154 int standalone; /* standalone document */
155 int html; /* an HTML(1)/Docbook(2) document */
156
157 /* Input stream stack */
158 xmlParserInputPtr input; /* Current input stream */
159 int inputNr; /* Number of current input streams */
160 int inputMax; /* Max number of input streams */
161 xmlParserInputPtr *inputTab; /* stack of inputs */
162
163 /* Node analysis stack only used for DOM building */
164 xmlNodePtr node; /* Current parsed Node */
165 int nodeNr; /* Depth of the parsing stack */
166 int nodeMax; /* Max depth of the parsing stack */
167 xmlNodePtr *nodeTab; /* array of nodes */
168
169 int record_info; /* Whether node info should be kept */
170 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
171
172 int errNo; /* error code */
173
174 int hasExternalSubset; /* reference and external subset */
175 int hasPErefs; /* the internal subset has PE refs */
176 int external; /* are we parsing an external entity */
177
178 int valid; /* is the document valid */
179 int validate; /* shall we try to validate ? */
180 xmlValidCtxt vctxt; /* The validity context */
181
182 xmlParserInputState instate; /* current type of input */
183 int token; /* next char look-ahead */
184
185 char *directory; /* the data directory */
186
187 /* Node name stack */
188 xmlChar *name; /* Current parsed Node */
189 int nameNr; /* Depth of the parsing stack */
190 int nameMax; /* Max depth of the parsing stack */
191 xmlChar * *nameTab; /* array of nodes */
192
193 long nbChars; /* number of xmlChar processed */
194 long checkIndex; /* used by progressive parsing lookup */
195 int keepBlanks; /* ugly but ... */
196 int disableSAX; /* SAX callbacks are disabled */
197 int inSubset; /* Parsing is in int 1/ext 2 subset */
198 xmlChar * intSubName; /* name of subset */
199 xmlChar * extSubURI; /* URI of external subset */
200 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
201
202 /* xml:space values */
203 int * space; /* Should the parser preserve spaces */
204 int spaceNr; /* Depth of the parsing stack */
205 int spaceMax; /* Max depth of the parsing stack */
206 int * spaceTab; /* array of space infos */
207
208 int depth; /* to prevent entity substitution loops */
209 xmlParserInputPtr entity; /* used to check entities boundaries */
210 int charset; /* encoding of the in-memory content
211 actually an xmlCharEncoding */
212 int nodelen; /* Those two fields are there to */
213 int nodemem; /* Speed up large node parsing */
214 int pedantic; /* signal pedantic warnings */
215 void *_private; /* For user data, libxml won't touch it */
216
217 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000218 int linenumbers; /* set line number in element content */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000219 void *catalogs; /* document's own catalog */
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;
Daniel Veillardd0463562001-10-13 09:15:48 +0000321 int initialized;
Owen Taylor3473f882001-02-23 17:55:21 +0000322};
323
324/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000325 * xmlExternalEntityLoader:
326 * @URL: The System ID of the resource requested
327 * @ID: The Public ID of the resource requested
328 * @xmlParserCtxtPtr: the XML parser context
329 *
Owen Taylor3473f882001-02-23 17:55:21 +0000330 * External entity loaders types
331 */
332typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL,
333 const char *ID,
334 xmlParserCtxtPtr context);
335
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000336/*
Owen Taylor3473f882001-02-23 17:55:21 +0000337 * Global variables: just the default SAX interface tables and XML
338 * version infos.
339 */
340LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
341
342LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
343LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
344LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
Daniel Veillardeae522a2001-04-23 13:41:34 +0000345LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
Owen Taylor3473f882001-02-23 17:55:21 +0000346
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000347/*
Owen Taylor3473f882001-02-23 17:55:21 +0000348 * entity substitution default behaviour.
349 */
350
351#ifdef VMS
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000352/**
353 * xmlSubstituteEntitiesDefaultValue:
354 *
355 * global variable controlling the entity substitution default behaviour
356 */
Owen Taylor3473f882001-02-23 17:55:21 +0000357LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultVal;
358#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
359#else
360LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
361#endif
362LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
363
364
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000365/*
Owen Taylor3473f882001-02-23 17:55:21 +0000366 * Init/Cleanup
367 */
368void xmlInitParser (void);
369void xmlCleanupParser (void);
370
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000371/*
Owen Taylor3473f882001-02-23 17:55:21 +0000372 * Input functions
373 */
374int xmlParserInputRead (xmlParserInputPtr in,
375 int len);
376int xmlParserInputGrow (xmlParserInputPtr in,
377 int len);
378
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000379/*
Owen Taylor3473f882001-02-23 17:55:21 +0000380 * xmlChar handling
381 */
382xmlChar * xmlStrdup (const xmlChar *cur);
383xmlChar * xmlStrndup (const xmlChar *cur,
384 int len);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000385xmlChar * xmlCharStrndup (const char *cur,
386 int len);
387xmlChar * xmlCharStrdup (const char *cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000388xmlChar * xmlStrsub (const xmlChar *str,
389 int start,
390 int len);
391const xmlChar * xmlStrchr (const xmlChar *str,
392 xmlChar val);
393const xmlChar * xmlStrstr (const xmlChar *str,
Daniel Veillard77044732001-06-29 21:31:07 +0000394 const xmlChar *val);
Owen Taylor3473f882001-02-23 17:55:21 +0000395const xmlChar * xmlStrcasestr (const xmlChar *str,
396 xmlChar *val);
397int xmlStrcmp (const xmlChar *str1,
398 const xmlChar *str2);
399int xmlStrncmp (const xmlChar *str1,
400 const xmlChar *str2,
401 int len);
402int xmlStrcasecmp (const xmlChar *str1,
403 const xmlChar *str2);
404int xmlStrncasecmp (const xmlChar *str1,
405 const xmlChar *str2,
406 int len);
407int xmlStrEqual (const xmlChar *str1,
408 const xmlChar *str2);
409int xmlStrlen (const xmlChar *str);
410xmlChar * xmlStrcat (xmlChar *cur,
411 const xmlChar *add);
412xmlChar * xmlStrncat (xmlChar *cur,
413 const xmlChar *add,
414 int len);
415
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000416/*
Owen Taylor3473f882001-02-23 17:55:21 +0000417 * Basic parsing Interfaces
418 */
419xmlDocPtr xmlParseDoc (xmlChar *cur);
Daniel Veillard50822cb2001-07-26 20:05:51 +0000420xmlDocPtr xmlParseMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000421 int size);
422xmlDocPtr xmlParseFile (const char *filename);
423int xmlSubstituteEntitiesDefault(int val);
424int xmlKeepBlanksDefault (int val);
425void xmlStopParser (xmlParserCtxtPtr ctxt);
426int xmlPedanticParserDefault(int val);
Daniel Veillardd9bad132001-07-23 19:39:43 +0000427int xmlLineNumbersDefault (int val);
Owen Taylor3473f882001-02-23 17:55:21 +0000428
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000429/*
Owen Taylor3473f882001-02-23 17:55:21 +0000430 * Recovery mode
431 */
432xmlDocPtr xmlRecoverDoc (xmlChar *cur);
Daniel Veillard50822cb2001-07-26 20:05:51 +0000433xmlDocPtr xmlRecoverMemory (const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000434 int size);
435xmlDocPtr xmlRecoverFile (const char *filename);
436
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000437/*
Owen Taylor3473f882001-02-23 17:55:21 +0000438 * Less common routines and SAX interfaces
439 */
440int xmlParseDocument (xmlParserCtxtPtr ctxt);
441int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
442xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
443 xmlChar *cur,
444 int recovery);
445int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
446 void *user_data,
447 const char *filename);
448int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
449 void *user_data,
Daniel Veillardfd7ddca2001-05-16 10:57:35 +0000450 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000451 int size);
452xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
Daniel Veillard50822cb2001-07-26 20:05:51 +0000453 const char *buffer,
Owen Taylor3473f882001-02-23 17:55:21 +0000454 int size,
455 int recovery);
456xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
457 const char *filename,
458 int recovery);
Daniel Veillarda293c322001-10-02 13:54:14 +0000459xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
460 const char *filename,
461 int recovery,
462 void *data);
Owen Taylor3473f882001-02-23 17:55:21 +0000463xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
464 const char *filename);
465xmlDocPtr xmlParseEntity (const char *filename);
466xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
467 const xmlChar *SystemID);
468xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
469 const xmlChar *ExternalID,
470 const xmlChar *SystemID);
471xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
472 xmlParserInputBufferPtr input,
473 xmlCharEncoding enc);
474int xmlParseBalancedChunkMemory(xmlDocPtr doc,
475 xmlSAXHandlerPtr sax,
476 void *user_data,
477 int depth,
478 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000479 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000480int xmlParseExternalEntity (xmlDocPtr doc,
481 xmlSAXHandlerPtr sax,
482 void *user_data,
483 int depth,
484 const xmlChar *URL,
485 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000486 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000487int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
488 const xmlChar *URL,
489 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000490 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000491
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000492/*
Owen Taylor3473f882001-02-23 17:55:21 +0000493 * SAX initialization routines
494 */
495void xmlDefaultSAXHandlerInit(void);
496void htmlDefaultSAXHandlerInit(void);
497
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000498/*
Owen Taylor3473f882001-02-23 17:55:21 +0000499 * Parser contexts handling.
500 */
501void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
502void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
503void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
504void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
505 const xmlChar* buffer,
506 const char* filename);
507xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
508
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000509/*
Owen Taylor3473f882001-02-23 17:55:21 +0000510 * Reading/setting optional parsing features.
511 */
512
513int xmlGetFeaturesList (int *len,
514 const char **result);
515int xmlGetFeature (xmlParserCtxtPtr ctxt,
516 const char *name,
517 void *result);
518int xmlSetFeature (xmlParserCtxtPtr ctxt,
519 const char *name,
520 void *value);
521
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000522/*
Owen Taylor3473f882001-02-23 17:55:21 +0000523 * Interfaces for the Push mode
524 */
525xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
526 void *user_data,
527 const char *chunk,
528 int size,
529 const char *filename);
530int xmlParseChunk (xmlParserCtxtPtr ctxt,
531 const char *chunk,
532 int size,
533 int terminate);
534
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000535/*
Owen Taylor3473f882001-02-23 17:55:21 +0000536 * Special I/O mode
537 */
538
539xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
540 void *user_data,
541 xmlInputReadCallback ioread,
542 xmlInputCloseCallback ioclose,
543 void *ioctx,
544 xmlCharEncoding enc);
545
546xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
547 xmlParserInputBufferPtr input,
548 xmlCharEncoding enc);
549
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000550/*
Owen Taylor3473f882001-02-23 17:55:21 +0000551 * Node infos
552 */
553const xmlParserNodeInfo*
554 xmlParserFindNodeInfo (const xmlParserCtxt* ctxt,
555 const xmlNode* node);
556void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
557void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
558unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
559 const xmlNode* node);
560void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
561 const xmlParserNodeInfo* info);
562
563/*
564 * External entities handling actually implemented in xmlIO
565 */
566
567void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
568xmlExternalEntityLoader
569 xmlGetExternalEntityLoader(void);
570xmlParserInputPtr
571 xmlLoadExternalEntity (const char *URL,
572 const char *ID,
573 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000574
575#ifdef __cplusplus
576}
577#endif
578
Daniel Veillard64a411c2001-10-15 12:32:07 +0000579#include <libxml/globals.h>
580
Owen Taylor3473f882001-02-23 17:55:21 +0000581#endif /* __XML_PARSER_H__ */
582