blob: 8800fe970ee6a2d71c6d27632dcf2f82646ce021 [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>
Owen Taylor3473f882001-02-23 17:55:21 +000014#include <libxml/entities.h>
Daniel Veillard8bdb91d2001-10-31 17:52:43 +000015#include <libxml/encoding.h>
16#include <libxml/xmlIO.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 *
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 +000042struct _xmlParserInput {
43 /* Input buffer */
44 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
45
46 const char *filename; /* The file analyzed, if any */
Daniel Veillard60087f32001-10-10 09:45:09 +000047 const char *directory; /* the directory/base of the file */
Owen Taylor3473f882001-02-23 17:55:21 +000048 const xmlChar *base; /* Base of the array to parse */
49 const xmlChar *cur; /* Current char being parsed */
Daniel Veillardcbaf3992001-12-31 16:16:02 +000050 const xmlChar *end; /* end of the array to parse */
Owen Taylor3473f882001-02-23 17:55:21 +000051 int length; /* length if known */
52 int line; /* Current line */
53 int col; /* Current column */
54 int consumed; /* How many xmlChars already consumed */
55 xmlParserInputDeallocate free; /* function to deallocate the base */
56 const xmlChar *encoding; /* the encoding string for entity */
57 const xmlChar *version; /* the version string for entity */
58 int standalone; /* Was that entity marked standalone */
59};
60
61/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000062 * xmlParserNodeInfo:
63 *
Owen Taylor3473f882001-02-23 17:55:21 +000064 * the parser can be asked to collect Node informations, i.e. at what
65 * place in the file they were detected.
66 * NOTE: This is off by default and not very well tested.
67 */
68typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
69typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
70
71struct _xmlParserNodeInfo {
72 const struct _xmlNode* node;
73 /* Position & line # that text that created the node begins & ends on */
74 unsigned long begin_pos;
75 unsigned long begin_line;
76 unsigned long end_pos;
77 unsigned long end_line;
78};
79
80typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
81typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
82struct _xmlParserNodeInfoSeq {
83 unsigned long maximum;
84 unsigned long length;
85 xmlParserNodeInfo* buffer;
86};
87
88/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +000089 * xmlParserInputState:
90 *
Owen Taylor3473f882001-02-23 17:55:21 +000091 * The parser is now working also as a state based parser
Daniel Veillardcbaf3992001-12-31 16:16:02 +000092 * The recursive one use the state info for entities processing
Owen Taylor3473f882001-02-23 17:55:21 +000093 */
94typedef enum {
95 XML_PARSER_EOF = -1, /* nothing is to be parsed */
96 XML_PARSER_START = 0, /* nothing has been parsed */
97 XML_PARSER_MISC, /* Misc* before int subset */
Daniel Veillardcbaf3992001-12-31 16:16:02 +000098 XML_PARSER_PI, /* Within a processing instruction */
Owen Taylor3473f882001-02-23 17:55:21 +000099 XML_PARSER_DTD, /* within some DTD content */
100 XML_PARSER_PROLOG, /* Misc* after internal subset */
101 XML_PARSER_COMMENT, /* within a comment */
102 XML_PARSER_START_TAG, /* within a start tag */
103 XML_PARSER_CONTENT, /* within the content */
104 XML_PARSER_CDATA_SECTION, /* within a CDATA section */
105 XML_PARSER_END_TAG, /* within a closing tag */
106 XML_PARSER_ENTITY_DECL, /* within an entity declaration */
107 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
108 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
109 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
110 XML_PARSER_EPILOG, /* the Misc* after the last end tag */
111 XML_PARSER_IGNORE /* within an IGNORED section */
112} xmlParserInputState;
113
114/**
Daniel Veillardd16df9f2001-05-23 13:44:21 +0000115 * XML_DETECT_IDS:
116 *
117 * Bit in the loadsubset context field to tell to do ID/REFs lookups
118 * Use it to initialize xmlLoadExtDtdDefaultValue
119 */
120#define XML_DETECT_IDS 2
121
122/**
123 * XML_COMPLETE_ATTRS:
124 *
125 * Bit in the loadsubset context field to tell to do complete the
126 * elements attributes lists with the ones defaulted from the DTDs
127 * Use it to initialize xmlLoadExtDtdDefaultValue
128 */
129#define XML_COMPLETE_ATTRS 4
130
131/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000132 * xmlParserCtxt:
133 *
Owen Taylor3473f882001-02-23 17:55:21 +0000134 * The parser context.
135 * NOTE This doesn't completely defines the parser state, the (current ?)
136 * design of the parser uses recursive function calls since this allow
137 * and easy mapping from the production rules of the specification
138 * to the actual code. The drawback is that the actual function call
139 * also reflect the parser state. However most of the parsing routines
140 * takes as the only argument the parser context pointer, so migrating
141 * to a state based parser for progressive parsing shouldn't be too hard.
142 */
Owen Taylor3473f882001-02-23 17:55:21 +0000143struct _xmlParserCtxt {
144 struct _xmlSAXHandler *sax; /* The SAX handler */
145 void *userData; /* For SAX interface only, used by DOM build */
146 xmlDocPtr myDoc; /* the document being built */
147 int wellFormed; /* is the document well formed */
148 int replaceEntities; /* shall we replace entities ? */
149 const xmlChar *version; /* the XML version string */
150 const xmlChar *encoding; /* the declared encoding, if any */
151 int standalone; /* standalone document */
152 int html; /* an HTML(1)/Docbook(2) document */
153
154 /* Input stream stack */
155 xmlParserInputPtr input; /* Current input stream */
156 int inputNr; /* Number of current input streams */
157 int inputMax; /* Max number of input streams */
158 xmlParserInputPtr *inputTab; /* stack of inputs */
159
160 /* Node analysis stack only used for DOM building */
161 xmlNodePtr node; /* Current parsed Node */
162 int nodeNr; /* Depth of the parsing stack */
163 int nodeMax; /* Max depth of the parsing stack */
164 xmlNodePtr *nodeTab; /* array of nodes */
165
166 int record_info; /* Whether node info should be kept */
167 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
168
169 int errNo; /* error code */
170
171 int hasExternalSubset; /* reference and external subset */
172 int hasPErefs; /* the internal subset has PE refs */
173 int external; /* are we parsing an external entity */
174
175 int valid; /* is the document valid */
176 int validate; /* shall we try to validate ? */
177 xmlValidCtxt vctxt; /* The validity context */
178
179 xmlParserInputState instate; /* current type of input */
180 int token; /* next char look-ahead */
181
182 char *directory; /* the data directory */
183
184 /* Node name stack */
185 xmlChar *name; /* Current parsed Node */
186 int nameNr; /* Depth of the parsing stack */
187 int nameMax; /* Max depth of the parsing stack */
188 xmlChar * *nameTab; /* array of nodes */
189
190 long nbChars; /* number of xmlChar processed */
191 long checkIndex; /* used by progressive parsing lookup */
192 int keepBlanks; /* ugly but ... */
193 int disableSAX; /* SAX callbacks are disabled */
194 int inSubset; /* Parsing is in int 1/ext 2 subset */
195 xmlChar * intSubName; /* name of subset */
196 xmlChar * extSubURI; /* URI of external subset */
197 xmlChar * extSubSystem; /* SYSTEM ID of external subset */
198
199 /* xml:space values */
200 int * space; /* Should the parser preserve spaces */
201 int spaceNr; /* Depth of the parsing stack */
202 int spaceMax; /* Max depth of the parsing stack */
203 int * spaceTab; /* array of space infos */
204
205 int depth; /* to prevent entity substitution loops */
206 xmlParserInputPtr entity; /* used to check entities boundaries */
207 int charset; /* encoding of the in-memory content
208 actually an xmlCharEncoding */
209 int nodelen; /* Those two fields are there to */
210 int nodemem; /* Speed up large node parsing */
211 int pedantic; /* signal pedantic warnings */
212 void *_private; /* For user data, libxml won't touch it */
213
214 int loadsubset; /* should the external subset be loaded */
Daniel Veillardd9bad132001-07-23 19:39:43 +0000215 int linenumbers; /* set line number in element content */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000216 void *catalogs; /* document's own catalog */
Owen Taylor3473f882001-02-23 17:55:21 +0000217};
218
219/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000220 * xmlSAXLocator:
221 *
Owen Taylor3473f882001-02-23 17:55:21 +0000222 * a SAX Locator.
223 */
224typedef struct _xmlSAXLocator xmlSAXLocator;
225typedef xmlSAXLocator *xmlSAXLocatorPtr;
226struct _xmlSAXLocator {
227 const xmlChar *(*getPublicId)(void *ctx);
228 const xmlChar *(*getSystemId)(void *ctx);
229 int (*getLineNumber)(void *ctx);
230 int (*getColumnNumber)(void *ctx);
231};
232
233/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000234 * xmlSAXHandler:
235 *
Owen Taylor3473f882001-02-23 17:55:21 +0000236 * a SAX handler is bunch of callbacks called by the parser when processing
237 * of the input generate data or structure informations.
238 */
239
240typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
241 const xmlChar *publicId, const xmlChar *systemId);
242typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name,
243 const xmlChar *ExternalID, const xmlChar *SystemID);
244typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name,
245 const xmlChar *ExternalID, const xmlChar *SystemID);
246typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
247 const xmlChar *name);
248typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
249 const xmlChar *name);
250typedef void (*entityDeclSAXFunc) (void *ctx,
251 const xmlChar *name, int type, const xmlChar *publicId,
252 const xmlChar *systemId, xmlChar *content);
253typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name,
254 const xmlChar *publicId, const xmlChar *systemId);
255typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem,
256 const xmlChar *name, int type, int def,
257 const xmlChar *defaultValue, xmlEnumerationPtr tree);
258typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name,
259 int type, xmlElementContentPtr content);
260typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
261 const xmlChar *name, const xmlChar *publicId,
262 const xmlChar *systemId, const xmlChar *notationName);
263typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
264 xmlSAXLocatorPtr loc);
265typedef void (*startDocumentSAXFunc) (void *ctx);
266typedef void (*endDocumentSAXFunc) (void *ctx);
267typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name,
268 const xmlChar **atts);
269typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name);
270typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name,
271 const xmlChar *value);
272typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name);
273typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch,
274 int len);
275typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
276 const xmlChar *ch, int len);
277typedef void (*processingInstructionSAXFunc) (void *ctx,
278 const xmlChar *target, const xmlChar *data);
279typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value);
280typedef void (*cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len);
281typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
282typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
283typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
284typedef int (*isStandaloneSAXFunc) (void *ctx);
285typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
286typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
287
288typedef struct _xmlSAXHandler xmlSAXHandler;
289typedef xmlSAXHandler *xmlSAXHandlerPtr;
290struct _xmlSAXHandler {
291 internalSubsetSAXFunc internalSubset;
292 isStandaloneSAXFunc isStandalone;
293 hasInternalSubsetSAXFunc hasInternalSubset;
294 hasExternalSubsetSAXFunc hasExternalSubset;
295 resolveEntitySAXFunc resolveEntity;
296 getEntitySAXFunc getEntity;
297 entityDeclSAXFunc entityDecl;
298 notationDeclSAXFunc notationDecl;
299 attributeDeclSAXFunc attributeDecl;
300 elementDeclSAXFunc elementDecl;
301 unparsedEntityDeclSAXFunc unparsedEntityDecl;
302 setDocumentLocatorSAXFunc setDocumentLocator;
303 startDocumentSAXFunc startDocument;
304 endDocumentSAXFunc endDocument;
305 startElementSAXFunc startElement;
306 endElementSAXFunc endElement;
307 referenceSAXFunc reference;
308 charactersSAXFunc characters;
309 ignorableWhitespaceSAXFunc ignorableWhitespace;
310 processingInstructionSAXFunc processingInstruction;
311 commentSAXFunc comment;
312 warningSAXFunc warning;
313 errorSAXFunc error;
314 fatalErrorSAXFunc fatalError;
315 getParameterEntitySAXFunc getParameterEntity;
316 cdataBlockSAXFunc cdataBlock;
317 externalSubsetSAXFunc externalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000318 int initialized;
Owen Taylor3473f882001-02-23 17:55:21 +0000319};
320
321/**
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000322 * xmlExternalEntityLoader:
323 * @URL: The System ID of the resource requested
324 * @ID: The Public ID of the resource requested
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000325 * @context: the XML parser context
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000326 *
Owen Taylor3473f882001-02-23 17:55:21 +0000327 * External entity loaders types
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000328 *
329 * Returns the entity input parser
Owen Taylor3473f882001-02-23 17:55:21 +0000330 */
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/*
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000347 * entity substitution default behavior.
Owen Taylor3473f882001-02-23 17:55:21 +0000348 */
349
350#ifdef VMS
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000351/**
352 * xmlSubstituteEntitiesDefaultValue:
353 *
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000354 * global variable controlling the entity substitution default behavior
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000355 */
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);
Daniel Veillarda293c322001-10-02 13:54:14 +0000458xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
459 const char *filename,
460 int recovery,
461 void *data);
Owen Taylor3473f882001-02-23 17:55:21 +0000462xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
463 const char *filename);
464xmlDocPtr xmlParseEntity (const char *filename);
465xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
466 const xmlChar *SystemID);
467xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
468 const xmlChar *ExternalID,
469 const xmlChar *SystemID);
470xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
471 xmlParserInputBufferPtr input,
472 xmlCharEncoding enc);
473int xmlParseBalancedChunkMemory(xmlDocPtr doc,
474 xmlSAXHandlerPtr sax,
475 void *user_data,
476 int depth,
477 const xmlChar *string,
Daniel Veillardcda96922001-08-21 10:56:31 +0000478 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000479int xmlParseExternalEntity (xmlDocPtr doc,
480 xmlSAXHandlerPtr sax,
481 void *user_data,
482 int depth,
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 +0000486int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
487 const xmlChar *URL,
488 const xmlChar *ID,
Daniel Veillardcda96922001-08-21 10:56:31 +0000489 xmlNodePtr *lst);
Owen Taylor3473f882001-02-23 17:55:21 +0000490
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000491/*
Owen Taylor3473f882001-02-23 17:55:21 +0000492 * SAX initialization routines
493 */
494void xmlDefaultSAXHandlerInit(void);
495void htmlDefaultSAXHandlerInit(void);
496
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000497/*
Owen Taylor3473f882001-02-23 17:55:21 +0000498 * Parser contexts handling.
499 */
500void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
501void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
502void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
503void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
504 const xmlChar* buffer,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000505 const char *filename);
Owen Taylor3473f882001-02-23 17:55:21 +0000506xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
507
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000508/*
Owen Taylor3473f882001-02-23 17:55:21 +0000509 * Reading/setting optional parsing features.
510 */
511
512int xmlGetFeaturesList (int *len,
513 const char **result);
514int xmlGetFeature (xmlParserCtxtPtr ctxt,
515 const char *name,
516 void *result);
517int xmlSetFeature (xmlParserCtxtPtr ctxt,
518 const char *name,
519 void *value);
520
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000521/*
Owen Taylor3473f882001-02-23 17:55:21 +0000522 * Interfaces for the Push mode
523 */
524xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
525 void *user_data,
526 const char *chunk,
527 int size,
528 const char *filename);
529int xmlParseChunk (xmlParserCtxtPtr ctxt,
530 const char *chunk,
531 int size,
532 int terminate);
533
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000534/*
Owen Taylor3473f882001-02-23 17:55:21 +0000535 * Special I/O mode
536 */
537
538xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
539 void *user_data,
540 xmlInputReadCallback ioread,
541 xmlInputCloseCallback ioclose,
542 void *ioctx,
543 xmlCharEncoding enc);
544
545xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
546 xmlParserInputBufferPtr input,
547 xmlCharEncoding enc);
548
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000549/*
Owen Taylor3473f882001-02-23 17:55:21 +0000550 * Node infos
551 */
552const xmlParserNodeInfo*
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000553 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
554 const xmlNodePtr node);
Owen Taylor3473f882001-02-23 17:55:21 +0000555void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
556void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000557unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
558 const xmlNodePtr node);
Owen Taylor3473f882001-02-23 17:55:21 +0000559void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
Daniel Veillard963d2ae2002-01-20 22:08:18 +0000560 const xmlParserNodeInfoPtr info);
Owen Taylor3473f882001-02-23 17:55:21 +0000561
562/*
563 * External entities handling actually implemented in xmlIO
564 */
565
566void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
567xmlExternalEntityLoader
568 xmlGetExternalEntityLoader(void);
569xmlParserInputPtr
570 xmlLoadExternalEntity (const char *URL,
571 const char *ID,
572 xmlParserCtxtPtr context);
Owen Taylor3473f882001-02-23 17:55:21 +0000573
574#ifdef __cplusplus
575}
576#endif
577
Daniel Veillard64a411c2001-10-15 12:32:07 +0000578#include <libxml/globals.h>
579
Owen Taylor3473f882001-02-23 17:55:21 +0000580#endif /* __XML_PARSER_H__ */
581