added Info.plist
[TestXSLT.git] / libxml2 / include / libxml / parser.h
1 /*
2  * parser.h : Interfaces, constants and types related to the XML parser.
3  *
4  * See Copyright for the status of this software.
5  *
6  * daniel@veillard.com
7  */
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/entities.h>
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /**
21  * XML_DEFAULT_VERSION:
22  *
23  * The default version of XML used: 1.0
24  */
25 #define XML_DEFAULT_VERSION     "1.0"
26
27 /**
28  * xmlParserInput:
29  *
30  * An xmlParserInput is an input flow for the XML processor.
31  * Each entity parsed is associated an xmlParserInput (except the
32  * few predefined ones). This is the case both for internal entities
33  * - in which case the flow is already completely in memory - or
34  * external entities - in which case we use the buf structure for
35  * progressive reading and I18N conversions to the internal UTF-8 format.
36  */
37
38 /**
39  * xmlParserInputDeallocate:
40  * @str:  the string to deallocate
41  *
42  * Callback for freeing some parser input allocations.
43  */
44 typedef void (* xmlParserInputDeallocate)(xmlChar *str);
45
46 struct _xmlParserInput {
47     /* Input buffer */
48     xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
49
50     const char *filename;             /* The file analyzed, if any */
51     const char *directory;            /* the directory/base of the file */
52     const xmlChar *base;              /* Base of the array to parse */
53     const xmlChar *cur;               /* Current char being parsed */
54     const xmlChar *end;               /* end of the array to parse */
55     int length;                       /* length if known */
56     int line;                         /* Current line */
57     int col;                          /* Current column */
58     /*
59      * NOTE: consumed is only tested for equality in the parser code,
60      *       so even if there is an overflow this should not give troubles
61      *       for parsing very large instances.
62      */
63     unsigned long consumed;           /* How many xmlChars already consumed */
64     xmlParserInputDeallocate free;    /* function to deallocate the base */
65     const xmlChar *encoding;          /* the encoding string for entity */
66     const xmlChar *version;           /* the version string for entity */
67     int standalone;                   /* Was that entity marked standalone */
68 };
69
70 /**
71  * xmlParserNodeInfo:
72  *
73  * The parser can be asked to collect Node informations, i.e. at what
74  * place in the file they were detected. 
75  * NOTE: This is off by default and not very well tested.
76  */
77 typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
78 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
79
80 struct _xmlParserNodeInfo {
81   const struct _xmlNode* node;
82   /* Position & line # that text that created the node begins & ends on */
83   unsigned long begin_pos;
84   unsigned long begin_line;
85   unsigned long end_pos;
86   unsigned long end_line;
87 };
88
89 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
90 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
91 struct _xmlParserNodeInfoSeq {
92   unsigned long maximum;
93   unsigned long length;
94   xmlParserNodeInfo* buffer;
95 };
96
97 /**
98  * xmlParserInputState:
99  *
100  * The parser is now working also as a state based parser.
101  * The recursive one use the state info for entities processing.
102  */
103 typedef enum {
104     XML_PARSER_EOF = -1,        /* nothing is to be parsed */
105     XML_PARSER_START = 0,       /* nothing has been parsed */
106     XML_PARSER_MISC,            /* Misc* before int subset */
107     XML_PARSER_PI,              /* Within a processing instruction */
108     XML_PARSER_DTD,             /* within some DTD content */
109     XML_PARSER_PROLOG,          /* Misc* after internal subset */
110     XML_PARSER_COMMENT,         /* within a comment */
111     XML_PARSER_START_TAG,       /* within a start tag */
112     XML_PARSER_CONTENT,         /* within the content */
113     XML_PARSER_CDATA_SECTION,   /* within a CDATA section */
114     XML_PARSER_END_TAG,         /* within a closing tag */
115     XML_PARSER_ENTITY_DECL,     /* within an entity declaration */
116     XML_PARSER_ENTITY_VALUE,    /* within an entity value in a decl */
117     XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
118     XML_PARSER_SYSTEM_LITERAL,  /* within a SYSTEM value */
119     XML_PARSER_EPILOG,          /* the Misc* after the last end tag */
120     XML_PARSER_IGNORE,          /* within an IGNORED section */
121     XML_PARSER_PUBLIC_LITERAL   /* within a PUBLIC value */
122 } xmlParserInputState;
123
124 /**
125  * XML_DETECT_IDS:
126  *
127  * Bit in the loadsubset context field to tell to do ID/REFs lookups.
128  * Use it to initialize xmlLoadExtDtdDefaultValue.
129  */
130 #define XML_DETECT_IDS          2
131
132 /**
133  * XML_COMPLETE_ATTRS:
134  *
135  * Bit in the loadsubset context field to tell to do complete the
136  * elements attributes lists with the ones defaulted from the DTDs.
137  * Use it to initialize xmlLoadExtDtdDefaultValue.
138  */
139 #define XML_COMPLETE_ATTRS      4
140
141 /**
142  * XML_SKIP_IDS:
143  *
144  * Bit in the loadsubset context field to tell to not do ID/REFs registration.
145  * Used to initialize xmlLoadExtDtdDefaultValue in some special cases.
146  */
147 #define XML_SKIP_IDS            8
148
149 /**
150  * xmlParserCtxt:
151  *
152  * The parser context.
153  * NOTE This doesn't completely define the parser state, the (current ?)
154  *      design of the parser uses recursive function calls since this allow
155  *      and easy mapping from the production rules of the specification
156  *      to the actual code. The drawback is that the actual function call
157  *      also reflect the parser state. However most of the parsing routines
158  *      takes as the only argument the parser context pointer, so migrating
159  *      to a state based parser for progressive parsing shouldn't be too hard.
160  */
161 struct _xmlParserCtxt {
162     struct _xmlSAXHandler *sax;       /* The SAX handler */
163     void            *userData;        /* For SAX interface only, used by DOM build */
164     xmlDocPtr           myDoc;        /* the document being built */
165     int            wellFormed;        /* is the document well formed */
166     int       replaceEntities;        /* shall we replace entities ? */
167     const xmlChar    *version;        /* the XML version string */
168     const xmlChar   *encoding;        /* the declared encoding, if any */
169     int            standalone;        /* standalone document */
170     int                  html;        /* an HTML(1)/Docbook(2) document */
171
172     /* Input stream stack */
173     xmlParserInputPtr  input;         /* Current input stream */
174     int                inputNr;       /* Number of current input streams */
175     int                inputMax;      /* Max number of input streams */
176     xmlParserInputPtr *inputTab;      /* stack of inputs */
177
178     /* Node analysis stack only used for DOM building */
179     xmlNodePtr         node;          /* Current parsed Node */
180     int                nodeNr;        /* Depth of the parsing stack */
181     int                nodeMax;       /* Max depth of the parsing stack */
182     xmlNodePtr        *nodeTab;       /* array of nodes */
183
184     int record_info;                  /* Whether node info should be kept */
185     xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
186
187     int errNo;                        /* error code */
188
189     int     hasExternalSubset;        /* reference and external subset */
190     int             hasPErefs;        /* the internal subset has PE refs */
191     int              external;        /* are we parsing an external entity */
192
193     int                 valid;        /* is the document valid */
194     int              validate;        /* shall we try to validate ? */
195     xmlValidCtxt        vctxt;        /* The validity context */
196
197     xmlParserInputState instate;      /* current type of input */
198     int                 token;        /* next char look-ahead */    
199
200     char           *directory;        /* the data directory */
201
202     /* Node name stack */
203     xmlChar           *name;          /* Current parsed Node */
204     int                nameNr;        /* Depth of the parsing stack */
205     int                nameMax;       /* Max depth of the parsing stack */
206     xmlChar *         *nameTab;       /* array of nodes */
207
208     long               nbChars;       /* number of xmlChar processed */
209     long            checkIndex;       /* used by progressive parsing lookup */
210     int             keepBlanks;       /* ugly but ... */
211     int             disableSAX;       /* SAX callbacks are disabled */
212     int               inSubset;       /* Parsing is in int 1/ext 2 subset */
213     xmlChar *          intSubName;    /* name of subset */
214     xmlChar *          extSubURI;     /* URI of external subset */
215     xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
216
217     /* xml:space values */
218     int *              space;         /* Should the parser preserve spaces */
219     int                spaceNr;       /* Depth of the parsing stack */
220     int                spaceMax;      /* Max depth of the parsing stack */
221     int *              spaceTab;      /* array of space infos */
222
223     int                depth;         /* to prevent entity substitution loops */
224     xmlParserInputPtr  entity;        /* used to check entities boundaries */
225     int                charset;       /* encoding of the in-memory content
226                                          actually an xmlCharEncoding */
227     int                nodelen;       /* Those two fields are there to */
228     int                nodemem;       /* Speed up large node parsing */
229     int                pedantic;      /* signal pedantic warnings */
230     void              *_private;      /* For user data, libxml won't touch it */
231
232     int                loadsubset;    /* should the external subset be loaded */
233     int                linenumbers;   /* set line number in element content */
234     void              *catalogs;       /* document's own catalog */
235     int                recovery;      /* run in recovery mode */
236     int                progressive;   /* is this a progressive parsing */
237 };
238
239 /**
240  * xmlSAXLocator:
241  *
242  * A SAX Locator.
243  */
244 struct _xmlSAXLocator {
245     const xmlChar *(*getPublicId)(void *ctx);
246     const xmlChar *(*getSystemId)(void *ctx);
247     int (*getLineNumber)(void *ctx);
248     int (*getColumnNumber)(void *ctx);
249 };
250
251 /**
252  * xmlSAXHandler:
253  *
254  * A SAX handler is bunch of callbacks called by the parser when processing
255  * of the input generate data or structure informations.
256  */
257
258 /**
259  * resolveEntitySAXFunc:
260  * @ctx:  the user data (XML parser context)
261  * @publicId: The public ID of the entity
262  * @systemId: The system ID of the entity
263  *
264  * Callback:
265  * The entity loader, to control the loading of external entities,
266  * the application can either:
267  *    - override this resolveEntity() callback in the SAX block
268  *    - or better use the xmlSetExternalEntityLoader() function to
269  *      set up it's own entity resolution routine
270  *
271  * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
272  */
273 typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
274                                 const xmlChar *publicId,
275                                 const xmlChar *systemId);
276 /**
277  * internalSubsetSAXFunc:
278  * @ctx:  the user data (XML parser context)
279  * @name:  the root element name
280  * @ExternalID:  the external ID
281  * @SystemID:  the SYSTEM ID (e.g. filename or URL)
282  *
283  * Callback on internal subset declaration.
284  */
285 typedef void (*internalSubsetSAXFunc) (void *ctx,
286                                 const xmlChar *name,
287                                 const xmlChar *ExternalID,
288                                 const xmlChar *SystemID);
289 /**
290  * externalSubsetSAXFunc:
291  * @ctx:  the user data (XML parser context)
292  * @name:  the root element name
293  * @ExternalID:  the external ID
294  * @SystemID:  the SYSTEM ID (e.g. filename or URL)
295  *
296  * Callback on external subset declaration.
297  */
298 typedef void (*externalSubsetSAXFunc) (void *ctx,
299                                 const xmlChar *name,
300                                 const xmlChar *ExternalID,
301                                 const xmlChar *SystemID);
302 /**
303  * getEntitySAXFunc:
304  * @ctx:  the user data (XML parser context)
305  * @name: The entity name
306  *
307  * Get an entity by name.
308  *
309  * Returns the xmlEntityPtr if found.
310  */
311 typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
312                                 const xmlChar *name);
313 /**
314  * getParameterEntitySAXFunc:
315  * @ctx:  the user data (XML parser context)
316  * @name: The entity name
317  *
318  * Get a parameter entity by name.
319  *
320  * Returns the xmlEntityPtr if found.
321  */
322 typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
323                                 const xmlChar *name);
324 /**
325  * entityDeclSAXFunc:
326  * @ctx:  the user data (XML parser context)
327  * @name:  the entity name 
328  * @type:  the entity type 
329  * @publicId: The public ID of the entity
330  * @systemId: The system ID of the entity
331  * @content: the entity value (without processing).
332  *
333  * An entity definition has been parsed.
334  */
335 typedef void (*entityDeclSAXFunc) (void *ctx,
336                                 const xmlChar *name,
337                                 int type,
338                                 const xmlChar *publicId,
339                                 const xmlChar *systemId,
340                                 xmlChar *content);
341 /**
342  * notationDeclSAXFunc:
343  * @ctx:  the user data (XML parser context)
344  * @name: The name of the notation
345  * @publicId: The public ID of the entity
346  * @systemId: The system ID of the entity
347  *
348  * What to do when a notation declaration has been parsed.
349  */
350 typedef void (*notationDeclSAXFunc)(void *ctx,
351                                 const xmlChar *name,
352                                 const xmlChar *publicId,
353                                 const xmlChar *systemId);
354 /**
355  * attributeDeclSAXFunc:
356  * @ctx:  the user data (XML parser context)
357  * @elem:  the name of the element
358  * @fullname:  the attribute name 
359  * @type:  the attribute type 
360  * @def:  the type of default value
361  * @defaultValue: the attribute default value
362  * @tree:  the tree of enumerated value set
363  *
364  * An attribute definition has been parsed.
365  */
366 typedef void (*attributeDeclSAXFunc)(void *ctx,
367                                 const xmlChar *elem,
368                                 const xmlChar *fullname,
369                                 int type,
370                                 int def,
371                                 const xmlChar *defaultValue,
372                                 xmlEnumerationPtr tree);
373 /**
374  * elementDeclSAXFunc:
375  * @ctx:  the user data (XML parser context)
376  * @name:  the element name 
377  * @type:  the element type 
378  * @content: the element value tree
379  *
380  * An element definition has been parsed.
381  */
382 typedef void (*elementDeclSAXFunc)(void *ctx,
383                                 const xmlChar *name,
384                                 int type,
385                                 xmlElementContentPtr content);
386 /**
387  * unparsedEntityDeclSAXFunc:
388  * @ctx:  the user data (XML parser context)
389  * @name: The name of the entity
390  * @publicId: The public ID of the entity
391  * @systemId: The system ID of the entity
392  * @notationName: the name of the notation
393  *
394  * What to do when an unparsed entity declaration is parsed.
395  */
396 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
397                                 const xmlChar *name,
398                                 const xmlChar *publicId,
399                                 const xmlChar *systemId,
400                                 const xmlChar *notationName);
401 /**
402  * setDocumentLocatorSAXFunc:
403  * @ctx:  the user data (XML parser context)
404  * @loc: A SAX Locator
405  *
406  * Receive the document locator at startup, actually xmlDefaultSAXLocator.
407  * Everything is available on the context, so this is useless in our case.
408  */
409 typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
410                                 xmlSAXLocatorPtr loc);
411 /**
412  * startDocumentSAXFunc:
413  * @ctx:  the user data (XML parser context)
414  *
415  * Called when the document start being processed.
416  */
417 typedef void (*startDocumentSAXFunc) (void *ctx);
418 /**
419  * endDocumentSAXFunc:
420  * @ctx:  the user data (XML parser context)
421  *
422  * Called when the document end has been detected.
423  */
424 typedef void (*endDocumentSAXFunc) (void *ctx);
425 /**
426  * startElementSAXFunc:
427  * @ctx:  the user data (XML parser context)
428  * @name:  The element name, including namespace prefix
429  * @atts:  An array of name/value attributes pairs, NULL terminated
430  *
431  * Called when an opening tag has been processed.
432  */
433 typedef void (*startElementSAXFunc) (void *ctx,
434                                 const xmlChar *name,
435                                 const xmlChar **atts);
436 /**
437  * endElementSAXFunc:
438  * @ctx:  the user data (XML parser context)
439  * @name:  The element name
440  *
441  * Called when the end of an element has been detected.
442  */
443 typedef void (*endElementSAXFunc) (void *ctx,
444                                 const xmlChar *name);
445 /**
446  * attributeSAXFunc:
447  * @ctx:  the user data (XML parser context)
448  * @name:  The attribute name, including namespace prefix
449  * @value:  The attribute value
450  *
451  * Handle an attribute that has been read by the parser.
452  * The default handling is to convert the attribute into an
453  * DOM subtree and past it in a new xmlAttr element added to
454  * the element.
455  */
456 typedef void (*attributeSAXFunc) (void *ctx,
457                                 const xmlChar *name,
458                                 const xmlChar *value);
459 /**
460  * referenceSAXFunc:
461  * @ctx:  the user data (XML parser context)
462  * @name:  The entity name
463  *
464  * Called when an entity reference is detected. 
465  */
466 typedef void (*referenceSAXFunc) (void *ctx,
467                                 const xmlChar *name);
468 /**
469  * charactersSAXFunc:
470  * @ctx:  the user data (XML parser context)
471  * @ch:  a xmlChar string
472  * @len: the number of xmlChar
473  *
474  * Receiving some chars from the parser.
475  */
476 typedef void (*charactersSAXFunc) (void *ctx,
477                                 const xmlChar *ch,
478                                 int len);
479 /**
480  * ignorableWhitespaceSAXFunc:
481  * @ctx:  the user data (XML parser context)
482  * @ch:  a xmlChar string
483  * @len: the number of xmlChar
484  *
485  * Receiving some ignorable whitespaces from the parser.
486  * UNUSED: by default the DOM building will use characters.
487  */
488 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
489                                 const xmlChar *ch,
490                                 int len);
491 /**
492  * processingInstructionSAXFunc:
493  * @ctx:  the user data (XML parser context)
494  * @target:  the target name
495  * @data: the PI data's
496  *
497  * A processing instruction has been parsed.
498  */
499 typedef void (*processingInstructionSAXFunc) (void *ctx,
500                                 const xmlChar *target,
501                                 const xmlChar *data);
502 /**
503  * commentSAXFunc:
504  * @ctx:  the user data (XML parser context)
505  * @value:  the comment content
506  *
507  * A comment has been parsed.
508  */
509 typedef void (*commentSAXFunc) (void *ctx,
510                                 const xmlChar *value);
511 /**
512  * cdataBlockSAXFunc:
513  * @ctx:  the user data (XML parser context)
514  * @value:  The pcdata content
515  * @len:  the block length
516  *
517  * Called when a pcdata block has been parsed.
518  */
519 typedef void (*cdataBlockSAXFunc) (
520                                 void *ctx,
521                                 const xmlChar *value,
522                                 int len);
523 /**
524  * warningSAXFunc:
525  * @ctx:  an XML parser context
526  * @msg:  the message to display/transmit
527  * @...:  extra parameters for the message display
528  * 
529  * Display and format a warning messages, callback.
530  */
531 typedef void (*warningSAXFunc) (void *ctx,
532                                 const char *msg, ...);
533 /**
534  * errorSAXFunc:
535  * @ctx:  an XML parser context
536  * @msg:  the message to display/transmit
537  * @...:  extra parameters for the message display
538  * 
539  * Display and format an error messages, callback.
540  */
541 typedef void (*errorSAXFunc) (void *ctx,
542                                 const char *msg, ...);
543 /**
544  * fatalErrorSAXFunc:
545  * @ctx:  an XML parser context
546  * @msg:  the message to display/transmit
547  * @...:  extra parameters for the message display
548  * 
549  * Display and format fatal error messages, callback.
550  * Note: so far fatalError() SAX callbacks are not used, error()
551  *       get all the callbacks for errors.
552  */
553 typedef void (*fatalErrorSAXFunc) (void *ctx,
554                                 const char *msg, ...);
555 /**
556  * isStandaloneSAXFunc:
557  * @ctx:  the user data (XML parser context)
558  *
559  * Is this document tagged standalone?
560  *
561  * Returns 1 if true
562  */
563 typedef int (*isStandaloneSAXFunc) (void *ctx);
564 /**
565  * hasInternalSubsetSAXFunc:
566  * @ctx:  the user data (XML parser context)
567  *
568  * Does this document has an internal subset.
569  *
570  * Returns 1 if true
571  */
572 typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
573 /**
574  * hasExternalSubsetSAXFunc:
575  * @ctx:  the user data (XML parser context)
576  *
577  * Does this document has an external subset?
578  *
579  * Returns 1 if true
580  */
581 typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
582
583 struct _xmlSAXHandler {
584     internalSubsetSAXFunc internalSubset;
585     isStandaloneSAXFunc isStandalone;
586     hasInternalSubsetSAXFunc hasInternalSubset;
587     hasExternalSubsetSAXFunc hasExternalSubset;
588     resolveEntitySAXFunc resolveEntity;
589     getEntitySAXFunc getEntity;
590     entityDeclSAXFunc entityDecl;
591     notationDeclSAXFunc notationDecl;
592     attributeDeclSAXFunc attributeDecl;
593     elementDeclSAXFunc elementDecl;
594     unparsedEntityDeclSAXFunc unparsedEntityDecl;
595     setDocumentLocatorSAXFunc setDocumentLocator;
596     startDocumentSAXFunc startDocument;
597     endDocumentSAXFunc endDocument;
598     startElementSAXFunc startElement;
599     endElementSAXFunc endElement;
600     referenceSAXFunc reference;
601     charactersSAXFunc characters;
602     ignorableWhitespaceSAXFunc ignorableWhitespace;
603     processingInstructionSAXFunc processingInstruction;
604     commentSAXFunc comment;
605     warningSAXFunc warning;
606     errorSAXFunc error;
607     fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
608     getParameterEntitySAXFunc getParameterEntity;
609     cdataBlockSAXFunc cdataBlock;
610     externalSubsetSAXFunc externalSubset;
611     int initialized;
612 };
613
614 /**
615  * xmlExternalEntityLoader:
616  * @URL: The System ID of the resource requested
617  * @ID: The Public ID of the resource requested
618  * @context: the XML parser context 
619  *
620  * External entity loaders types.
621  *
622  * Returns the entity input parser.
623  */
624 typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
625                                          const char *ID,
626                                          xmlParserCtxtPtr context);
627
628 /*
629  * Global variables: just the default SAX interface tables and XML
630  * version infos.
631  */
632 #if 0
633 LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
634 #endif
635
636 /*
637 LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
638 LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
639 LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
640 LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler;
641  */
642
643 /*
644  * Entity substitution default behavior.
645  */
646
647 #if 0
648 LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
649 LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
650 #endif
651
652 #ifdef __cplusplus
653 }
654 #endif
655 #include <libxml/encoding.h>
656 #include <libxml/xmlIO.h>
657 #include <libxml/globals.h>
658 #ifdef __cplusplus
659 extern "C" {
660 #endif
661
662
663 /*
664  * Init/Cleanup
665  */
666 void            xmlInitParser           (void);
667 void            xmlCleanupParser        (void);
668
669 /*
670  * Input functions
671  */
672 int             xmlParserInputRead      (xmlParserInputPtr in,
673                                          int len);
674 int             xmlParserInputGrow      (xmlParserInputPtr in,
675                                          int len);
676
677 /*
678  * xmlChar handling
679  */
680 xmlChar *       xmlStrdup               (const xmlChar *cur);
681 xmlChar *       xmlStrndup              (const xmlChar *cur,
682                                          int len);
683 xmlChar *       xmlCharStrndup          (const char *cur,
684                                          int len);
685 xmlChar *       xmlCharStrdup           (const char *cur);
686 xmlChar *       xmlStrsub               (const xmlChar *str,
687                                          int start,
688                                          int len);
689 const xmlChar * xmlStrchr               (const xmlChar *str,
690                                          xmlChar val);
691 const xmlChar * xmlStrstr               (const xmlChar *str,
692                                          const xmlChar *val);
693 const xmlChar * xmlStrcasestr           (const xmlChar *str,
694                                          xmlChar *val);
695 int             xmlStrcmp               (const xmlChar *str1,
696                                          const xmlChar *str2);
697 int             xmlStrncmp              (const xmlChar *str1,
698                                          const xmlChar *str2,
699                                          int len);
700 int             xmlStrcasecmp           (const xmlChar *str1,
701                                          const xmlChar *str2);
702 int             xmlStrncasecmp          (const xmlChar *str1,
703                                          const xmlChar *str2,
704                                          int len);
705 int             xmlStrEqual             (const xmlChar *str1,
706                                          const xmlChar *str2);
707 int             xmlStrlen               (const xmlChar *str);
708 xmlChar *       xmlStrcat               (xmlChar *cur,
709                                          const xmlChar *add);
710 xmlChar *       xmlStrncat              (xmlChar *cur,
711                                          const xmlChar *add,
712                                          int len);
713
714 /*
715  * Basic parsing Interfaces
716  */
717 xmlDocPtr       xmlParseDoc             (xmlChar *cur);
718 xmlDocPtr       xmlParseMemory          (const char *buffer,
719                                          int size);
720 xmlDocPtr       xmlParseFile            (const char *filename);
721 int             xmlSubstituteEntitiesDefault(int val);
722 int             xmlKeepBlanksDefault    (int val);
723 void            xmlStopParser           (xmlParserCtxtPtr ctxt);
724 int             xmlPedanticParserDefault(int val);
725 int             xmlLineNumbersDefault   (int val);
726
727 /*
728  * Recovery mode 
729  */
730 xmlDocPtr       xmlRecoverDoc           (xmlChar *cur);
731 xmlDocPtr       xmlRecoverMemory        (const char *buffer,
732                                          int size);
733 xmlDocPtr       xmlRecoverFile          (const char *filename);
734
735 /*
736  * Less common routines and SAX interfaces
737  */
738 int             xmlParseDocument        (xmlParserCtxtPtr ctxt);
739 int             xmlParseExtParsedEnt    (xmlParserCtxtPtr ctxt);
740 xmlDocPtr       xmlSAXParseDoc          (xmlSAXHandlerPtr sax,
741                                          xmlChar *cur,
742                                          int recovery);
743 int             xmlSAXUserParseFile     (xmlSAXHandlerPtr sax,
744                                          void *user_data,
745                                          const char *filename);
746 int             xmlSAXUserParseMemory   (xmlSAXHandlerPtr sax,
747                                          void *user_data,
748                                          const char *buffer,
749                                          int size);
750 xmlDocPtr       xmlSAXParseMemory       (xmlSAXHandlerPtr sax,
751                                          const char *buffer,
752                                          int size,
753                                          int recovery);
754 xmlDocPtr       xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
755                                          const char *buffer,
756                                          int size,
757                                          int recovery,
758                                          void *data);
759 xmlDocPtr       xmlSAXParseFile         (xmlSAXHandlerPtr sax,
760                                          const char *filename,
761                                          int recovery);
762 xmlDocPtr       xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
763                                          const char *filename,
764                                          int recovery,
765                                          void *data);
766 xmlDocPtr       xmlSAXParseEntity       (xmlSAXHandlerPtr sax,
767                                          const char *filename);
768 xmlDocPtr       xmlParseEntity          (const char *filename);
769 xmlDtdPtr       xmlParseDTD             (const xmlChar *ExternalID,
770                                          const xmlChar *SystemID);
771 xmlDtdPtr       xmlSAXParseDTD          (xmlSAXHandlerPtr sax,
772                                          const xmlChar *ExternalID,
773                                          const xmlChar *SystemID);
774 xmlDtdPtr       xmlIOParseDTD           (xmlSAXHandlerPtr sax,
775                                          xmlParserInputBufferPtr input,
776                                          xmlCharEncoding enc);
777 int             xmlParseBalancedChunkMemory(xmlDocPtr doc,
778                                          xmlSAXHandlerPtr sax,
779                                          void *user_data,
780                                          int depth,
781                                          const xmlChar *string,
782                                          xmlNodePtr *lst);
783 int           xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
784                      xmlSAXHandlerPtr sax,
785                      void *user_data,
786                      int depth,
787                      const xmlChar *string,
788                      xmlNodePtr *lst,
789                      int recover);
790 int             xmlParseExternalEntity  (xmlDocPtr doc,
791                                          xmlSAXHandlerPtr sax,
792                                          void *user_data,
793                                          int depth,
794                                          const xmlChar *URL,
795                                          const xmlChar *ID,
796                                          xmlNodePtr *lst);
797 int             xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
798                                          const xmlChar *URL,
799                                          const xmlChar *ID,
800                                          xmlNodePtr *lst);
801
802 /*
803  * Parser contexts handling.
804  */
805 int             xmlInitParserCtxt       (xmlParserCtxtPtr ctxt);
806 void            xmlClearParserCtxt      (xmlParserCtxtPtr ctxt);
807 void            xmlFreeParserCtxt       (xmlParserCtxtPtr ctxt);
808 void            xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
809                                          const xmlChar* buffer,
810                                          const char *filename);
811 xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
812
813 /*
814  * Reading/setting optional parsing features.
815  */
816
817 int             xmlGetFeaturesList      (int *len,
818                                          const char **result);
819 int             xmlGetFeature           (xmlParserCtxtPtr ctxt,
820                                          const char *name,
821                                          void *result);
822 int             xmlSetFeature           (xmlParserCtxtPtr ctxt,
823                                          const char *name,
824                                          void *value);
825
826 /*
827  * Interfaces for the Push mode.
828  */
829 xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
830                                          void *user_data,
831                                          const char *chunk,
832                                          int size,
833                                          const char *filename);
834 int              xmlParseChunk          (xmlParserCtxtPtr ctxt,
835                                          const char *chunk,
836                                          int size,
837                                          int terminate);
838
839 /*
840  * Special I/O mode.
841  */
842
843 xmlParserCtxtPtr xmlCreateIOParserCtxt  (xmlSAXHandlerPtr sax,
844                                          void *user_data,
845                                          xmlInputReadCallback   ioread,
846                                          xmlInputCloseCallback  ioclose,
847                                          void *ioctx,
848                                          xmlCharEncoding enc);
849
850 xmlParserInputPtr xmlNewIOInputStream   (xmlParserCtxtPtr ctxt,
851                                          xmlParserInputBufferPtr input,
852                                          xmlCharEncoding enc);
853
854 /*
855  * Node infos.
856  */
857 const xmlParserNodeInfo*
858                 xmlParserFindNodeInfo   (const xmlParserCtxtPtr ctxt,
859                                          const xmlNodePtr node);
860 void            xmlInitNodeInfoSeq      (xmlParserNodeInfoSeqPtr seq);
861 void            xmlClearNodeInfoSeq     (xmlParserNodeInfoSeqPtr seq);
862 unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
863                                          const xmlNodePtr node);
864 void            xmlParserAddNodeInfo    (xmlParserCtxtPtr ctxt,
865                                          const xmlParserNodeInfoPtr info);
866
867 /*
868  * External entities handling actually implemented in xmlIO.
869  */
870
871 void            xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
872 xmlExternalEntityLoader
873                 xmlGetExternalEntityLoader(void);
874 xmlParserInputPtr
875                 xmlLoadExternalEntity   (const char *URL,
876                                          const char *ID,
877                                          xmlParserCtxtPtr ctxt);
878
879 #ifdef __cplusplus
880 }
881 #endif
882 #endif /* __XML_PARSER_H__ */
883