parser.h

00001 /*
00002 
00003  * Summary: the core parser module
00004 
00005  * Description: Interfaces, constants and types related to the XML parser
00006 
00007  *
00008 
00009  * Copy: See Copyright for the status of this software.
00010 
00011  *
00012 
00013  * Author: Daniel Veillard
00014 
00015  */
00016 
00017 
00018 
00019 #ifndef __XML_PARSER_H__
00020 
00021 #define __XML_PARSER_H__
00022 
00023 
00024 
00025 #include <stdarg.h>
00026 
00027 
00028 
00029 #include <libxml/xmlversion.h>
00030 
00031 #include <libxml/tree.h>
00032 
00033 #include <libxml/dict.h>
00034 
00035 #include <libxml/hash.h>
00036 
00037 #include <libxml/valid.h>
00038 
00039 #include <libxml/entities.h>
00040 
00041 #include <libxml/xmlerror.h>
00042 
00043 #include <libxml/xmlstring.h>
00044 
00045 
00046 
00047 #ifdef __cplusplus
00048 
00049 extern "C" {
00050 
00051 #endif
00052 
00053 
00054 
00065 #define XML_DEFAULT_VERSION     "1.0"
00066 
00067 
00068 
00103 typedef void (* xmlParserInputDeallocate)(xmlChar *str);
00104 
00105 
00106 
00107 struct _xmlParserInput {
00108 
00109     /* Input buffer */
00110 
00111     xmlParserInputBufferPtr buf;      /* UTF-8 encoded buffer */
00112 
00113 
00114 
00115     const char *filename;             /* The file analyzed, if any */
00116 
00117     const char *directory;            /* the directory/base of the file */
00118 
00119     const xmlChar *base;              /* Base of the array to parse */
00120 
00121     const xmlChar *cur;               /* Current char being parsed */
00122 
00123     const xmlChar *end;               /* end of the array to parse */
00124 
00125     int length;                       /* length if known */
00126 
00127     int line;                         /* Current line */
00128 
00129     int col;                          /* Current column */
00130 
00131     /*
00132 
00133      * NOTE: consumed is only tested for equality in the parser code,
00134 
00135      *       so even if there is an overflow this should not give troubles
00136 
00137      *       for parsing very large instances.
00138 
00139      */
00140 
00141     unsigned long consumed;           /* How many xmlChars already consumed */
00142 
00143     xmlParserInputDeallocate free;    /* function to deallocate the base */
00144 
00145     const xmlChar *encoding;          /* the encoding string for entity */
00146 
00147     const xmlChar *version;           /* the version string for entity */
00148 
00149     int standalone;                   /* Was that entity marked standalone */
00150 
00151     int id;                           /* an unique identifier for the entity */
00152 
00153 };
00154 
00155 
00156 
00171 typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
00172 
00173 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
00174 
00175 
00176 
00177 struct _xmlParserNodeInfo {
00178 
00179   const struct _xmlNode* node;
00180 
00181   /* Position & line # that text that created the node begins & ends on */
00182 
00183   unsigned long begin_pos;
00184 
00185   unsigned long begin_line;
00186 
00187   unsigned long end_pos;
00188 
00189   unsigned long end_line;
00190 
00191 };
00192 
00193 
00194 
00195 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
00196 
00197 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
00198 
00199 struct _xmlParserNodeInfoSeq {
00200 
00201   unsigned long maximum;
00202 
00203   unsigned long length;
00204 
00205   xmlParserNodeInfo* buffer;
00206 
00207 };
00208 
00209 
00210 
00223 typedef enum {
00224 
00225     XML_PARSER_EOF = -1,        /* nothing is to be parsed */
00226 
00227     XML_PARSER_START = 0,       /* nothing has been parsed */
00228 
00229     XML_PARSER_MISC,            /* Misc* before int subset */
00230 
00231     XML_PARSER_PI,              /* Within a processing instruction */
00232 
00233     XML_PARSER_DTD,             /* within some DTD content */
00234 
00235     XML_PARSER_PROLOG,          /* Misc* after internal subset */
00236 
00237     XML_PARSER_COMMENT,         /* within a comment */
00238 
00239     XML_PARSER_START_TAG,       /* within a start tag */
00240 
00241     XML_PARSER_CONTENT,         /* within the content */
00242 
00243     XML_PARSER_CDATA_SECTION,   /* within a CDATA section */
00244 
00245     XML_PARSER_END_TAG,         /* within a closing tag */
00246 
00247     XML_PARSER_ENTITY_DECL,     /* within an entity declaration */
00248 
00249     XML_PARSER_ENTITY_VALUE,    /* within an entity value in a decl */
00250 
00251     XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
00252 
00253     XML_PARSER_SYSTEM_LITERAL,  /* within a SYSTEM value */
00254 
00255     XML_PARSER_EPILOG,          /* the Misc* after the last end tag */
00256 
00257     XML_PARSER_IGNORE,          /* within an IGNORED section */
00258 
00259     XML_PARSER_PUBLIC_LITERAL   /* within a PUBLIC value */
00260 
00261 } xmlParserInputState;
00262 
00263 
00264 
00277 #define XML_DETECT_IDS          2
00278 
00279 
00280 
00295 #define XML_COMPLETE_ATTRS      4
00296 
00297 
00298 
00311 #define XML_SKIP_IDS            8
00312 
00313 
00314 
00325 typedef enum {
00326 
00327     XML_PARSE_UNKNOWN = 0,
00328 
00329     XML_PARSE_DOM = 1,
00330 
00331     XML_PARSE_SAX = 2,
00332 
00333     XML_PARSE_PUSH_DOM = 3,
00334 
00335     XML_PARSE_PUSH_SAX = 4,
00336 
00337     XML_PARSE_READER = 5
00338 
00339 } xmlParserMode;
00340 
00341 
00342 
00367 struct _xmlParserCtxt {
00368 
00369     struct _xmlSAXHandler *sax;       /* The SAX handler */
00370 
00371     void            *userData;        /* For SAX interface only, used by DOM build */
00372 
00373     xmlDocPtr           myDoc;        /* the document being built */
00374 
00375     int            wellFormed;        /* is the document well formed */
00376 
00377     int       replaceEntities;        /* shall we replace entities ? */
00378 
00379     const xmlChar    *version;        /* the XML version string */
00380 
00381     const xmlChar   *encoding;        /* the declared encoding, if any */
00382 
00383     int            standalone;        /* standalone document */
00384 
00385     int                  html;        /* an HTML(1)/Docbook(2) document */
00386 
00387 
00388 
00389     /* Input stream stack */
00390 
00391     xmlParserInputPtr  input;         /* Current input stream */
00392 
00393     int                inputNr;       /* Number of current input streams */
00394 
00395     int                inputMax;      /* Max number of input streams */
00396 
00397     xmlParserInputPtr *inputTab;      /* stack of inputs */
00398 
00399 
00400 
00401     /* Node analysis stack only used for DOM building */
00402 
00403     xmlNodePtr         node;          /* Current parsed Node */
00404 
00405     int                nodeNr;        /* Depth of the parsing stack */
00406 
00407     int                nodeMax;       /* Max depth of the parsing stack */
00408 
00409     xmlNodePtr        *nodeTab;       /* array of nodes */
00410 
00411 
00412 
00413     int record_info;                  /* Whether node info should be kept */
00414 
00415     xmlParserNodeInfoSeq node_seq;    /* info about each node parsed */
00416 
00417 
00418 
00419     int errNo;                        /* error code */
00420 
00421 
00422 
00423     int     hasExternalSubset;        /* reference and external subset */
00424 
00425     int             hasPErefs;        /* the internal subset has PE refs */
00426 
00427     int              external;        /* are we parsing an external entity */
00428 
00429 
00430 
00431     int                 valid;        /* is the document valid */
00432 
00433     int              validate;        /* shall we try to validate ? */
00434 
00435     xmlValidCtxt        vctxt;        /* The validity context */
00436 
00437 
00438 
00439     xmlParserInputState instate;      /* current type of input */
00440 
00441     int                 token;        /* next char look-ahead */    
00442 
00443 
00444 
00445     char           *directory;        /* the data directory */
00446 
00447 
00448 
00449     /* Node name stack */
00450 
00451     const xmlChar     *name;          /* Current parsed Node */
00452 
00453     int                nameNr;        /* Depth of the parsing stack */
00454 
00455     int                nameMax;       /* Max depth of the parsing stack */
00456 
00457     const xmlChar *   *nameTab;       /* array of nodes */
00458 
00459 
00460 
00461     long               nbChars;       /* number of xmlChar processed */
00462 
00463     long            checkIndex;       /* used by progressive parsing lookup */
00464 
00465     int             keepBlanks;       /* ugly but ... */
00466 
00467     int             disableSAX;       /* SAX callbacks are disabled */
00468 
00469     int               inSubset;       /* Parsing is in int 1/ext 2 subset */
00470 
00471     const xmlChar *    intSubName;    /* name of subset */
00472 
00473     xmlChar *          extSubURI;     /* URI of external subset */
00474 
00475     xmlChar *          extSubSystem;  /* SYSTEM ID of external subset */
00476 
00477 
00478 
00479     /* xml:space values */
00480 
00481     int *              space;         /* Should the parser preserve spaces */
00482 
00483     int                spaceNr;       /* Depth of the parsing stack */
00484 
00485     int                spaceMax;      /* Max depth of the parsing stack */
00486 
00487     int *              spaceTab;      /* array of space infos */
00488 
00489 
00490 
00491     int                depth;         /* to prevent entity substitution loops */
00492 
00493     xmlParserInputPtr  entity;        /* used to check entities boundaries */
00494 
00495     int                charset;       /* encoding of the in-memory content
00496 
00497                                          actually an xmlCharEncoding */
00498 
00499     int                nodelen;       /* Those two fields are there to */
00500 
00501     int                nodemem;       /* Speed up large node parsing */
00502 
00503     int                pedantic;      /* signal pedantic warnings */
00504 
00505     void              *_private;      /* For user data, libxml won't touch it */
00506 
00507 
00508 
00509     int                loadsubset;    /* should the external subset be loaded */
00510 
00511     int                linenumbers;   /* set line number in element content */
00512 
00513     void              *catalogs;      /* document's own catalog */
00514 
00515     int                recovery;      /* run in recovery mode */
00516 
00517     int                progressive;   /* is this a progressive parsing */
00518 
00519     xmlDictPtr         dict;          /* dictionnary for the parser */
00520 
00521     const xmlChar *   *atts;          /* array for the attributes callbacks */
00522 
00523     int                maxatts;       /* the size of the array */
00524 
00525     int                docdict;       /* use strings from dict to build tree */
00526 
00527 
00528 
00529     /*
00530 
00531      * pre-interned strings
00532 
00533      */
00534 
00535     const xmlChar *str_xml;
00536 
00537     const xmlChar *str_xmlns;
00538 
00539     const xmlChar *str_xml_ns;
00540 
00541 
00542 
00543     /*
00544 
00545      * Everything below is used only by the new SAX mode
00546 
00547      */
00548 
00549     int                sax2;          /* operating in the new SAX mode */
00550 
00551     int                nsNr;          /* the number of inherited namespaces */
00552 
00553     int                nsMax;         /* the size of the arrays */
00554 
00555     const xmlChar *   *nsTab;         /* the array of prefix/namespace name */
00556 
00557     int               *attallocs;     /* which attribute were allocated */
00558 
00559     void *            *pushTab;       /* array of data for push */
00560 
00561     xmlHashTablePtr    attsDefault;   /* defaulted attributes if any */
00562 
00563     xmlHashTablePtr    attsSpecial;   /* non-CDATA attributes if any */
00564 
00565     int                nsWellFormed;  /* is the document XML Nanespace okay */
00566 
00567     int                options;       /* Extra options */
00568 
00569 
00570 
00571     /*
00572 
00573      * Those fields are needed only for treaming parsing so far
00574 
00575      */
00576 
00577     int               dictNames;    /* Use dictionary names for the tree */
00578 
00579     int               freeElemsNr;  /* number of freed element nodes */
00580 
00581     xmlNodePtr        freeElems;    /* List of freed element nodes */
00582 
00583     int               freeAttrsNr;  /* number of freed attributes nodes */
00584 
00585     xmlAttrPtr        freeAttrs;    /* List of freed attributes nodes */
00586 
00587 
00588 
00589     /*
00590 
00591      * the complete error informations for the last error.
00592 
00593      */
00594 
00595     xmlError          lastError;
00596 
00597     xmlParserMode     parseMode;    /* the parser mode */
00598 
00599 };
00600 
00601 
00602 
00613 struct _xmlSAXLocator {
00614 
00615     const xmlChar *(*getPublicId)(void *ctx);
00616 
00617     const xmlChar *(*getSystemId)(void *ctx);
00618 
00619     int (*getLineNumber)(void *ctx);
00620 
00621     int (*getColumnNumber)(void *ctx);
00622 
00623 };
00624 
00625 
00626 
00671 typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
00672 
00673                                 const xmlChar *publicId,
00674 
00675                                 const xmlChar *systemId);
00676 
00695 typedef void (*internalSubsetSAXFunc) (void *ctx,
00696 
00697                                 const xmlChar *name,
00698 
00699                                 const xmlChar *ExternalID,
00700 
00701                                 const xmlChar *SystemID);
00702 
00721 typedef void (*externalSubsetSAXFunc) (void *ctx,
00722 
00723                                 const xmlChar *name,
00724 
00725                                 const xmlChar *ExternalID,
00726 
00727                                 const xmlChar *SystemID);
00728 
00747 typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
00748 
00749                                 const xmlChar *name);
00750 
00769 typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
00770 
00771                                 const xmlChar *name);
00772 
00795 typedef void (*entityDeclSAXFunc) (void *ctx,
00796 
00797                                 const xmlChar *name,
00798 
00799                                 int type,
00800 
00801                                 const xmlChar *publicId,
00802 
00803                                 const xmlChar *systemId,
00804 
00805                                 xmlChar *content);
00806 
00825 typedef void (*notationDeclSAXFunc)(void *ctx,
00826 
00827                                 const xmlChar *name,
00828 
00829                                 const xmlChar *publicId,
00830 
00831                                 const xmlChar *systemId);
00832 
00857 typedef void (*attributeDeclSAXFunc)(void *ctx,
00858 
00859                                 const xmlChar *elem,
00860 
00861                                 const xmlChar *fullname,
00862 
00863                                 int type,
00864 
00865                                 int def,
00866 
00867                                 const xmlChar *defaultValue,
00868 
00869                                 xmlEnumerationPtr tree);
00870 
00889 typedef void (*elementDeclSAXFunc)(void *ctx,
00890 
00891                                 const xmlChar *name,
00892 
00893                                 int type,
00894 
00895                                 xmlElementContentPtr content);
00896 
00917 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
00918 
00919                                 const xmlChar *name,
00920 
00921                                 const xmlChar *publicId,
00922 
00923                                 const xmlChar *systemId,
00924 
00925                                 const xmlChar *notationName);
00926 
00943 typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
00944 
00945                                 xmlSAXLocatorPtr loc);
00946 
00959 typedef void (*startDocumentSAXFunc) (void *ctx);
00960 
00973 typedef void (*endDocumentSAXFunc) (void *ctx);
00974 
00991 typedef void (*startElementSAXFunc) (void *ctx,
00992 
00993                                 const xmlChar *name,
00994 
00995                                 const xmlChar **atts);
00996 
01011 typedef void (*endElementSAXFunc) (void *ctx,
01012 
01013                                 const xmlChar *name);
01014 
01037 typedef void (*attributeSAXFunc) (void *ctx,
01038 
01039                                 const xmlChar *name,
01040 
01041                                 const xmlChar *value);
01042 
01057 typedef void (*referenceSAXFunc) (void *ctx,
01058 
01059                                 const xmlChar *name);
01060 
01077 typedef void (*charactersSAXFunc) (void *ctx,
01078 
01079                                 const xmlChar *ch,
01080 
01081                                 int len);
01082 
01101 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
01102 
01103                                 const xmlChar *ch,
01104 
01105                                 int len);
01106 
01123 typedef void (*processingInstructionSAXFunc) (void *ctx,
01124 
01125                                 const xmlChar *target,
01126 
01127                                 const xmlChar *data);
01128 
01143 typedef void (*commentSAXFunc) (void *ctx,
01144 
01145                                 const xmlChar *value);
01146 
01163 typedef void (*cdataBlockSAXFunc) (
01164 
01165                                 void *ctx,
01166 
01167                                 const xmlChar *value,
01168 
01169                                 int len);
01170 
01187 typedef void (*warningSAXFunc) (void *ctx,
01188 
01189                                 const char *msg, ...);
01190 
01207 typedef void (*errorSAXFunc) (void *ctx,
01208 
01209                                 const char *msg, ...);
01210 
01231 typedef void (*fatalErrorSAXFunc) (void *ctx,
01232 
01233                                 const char *msg, ...);
01234 
01251 typedef int (*isStandaloneSAXFunc) (void *ctx);
01252 
01269 typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
01270 
01271 
01272 
01289 typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
01290 
01291 
01292 
01293 /************************************************************************
01294 
01295  *                                                                      *
01296 
01297  *                      The SAX version 2 API extensions                *
01298 
01299  *                                                                      *
01300 
01301  ************************************************************************/
01302 
01313 #define XML_SAX2_MAGIC 0xDEEDBEAF
01314 
01315 
01316 
01355 typedef void (*startElementNsSAX2Func) (void *ctx,
01356 
01357                                         const xmlChar *localname,
01358 
01359                                         const xmlChar *prefix,
01360 
01361                                         const xmlChar *URI,
01362 
01363                                         int nb_namespaces,
01364 
01365                                         const xmlChar **namespaces,
01366 
01367                                         int nb_attributes,
01368 
01369                                         int nb_defaulted,
01370 
01371                                         const xmlChar **attributes);
01372 
01373  
01374 
01397 typedef void (*endElementNsSAX2Func)   (void *ctx,
01398 
01399                                         const xmlChar *localname,
01400 
01401                                         const xmlChar *prefix,
01402 
01403                                         const xmlChar *URI);
01404 
01405 
01406 
01407 
01408 
01409 struct _xmlSAXHandler {
01410 
01411     internalSubsetSAXFunc internalSubset;
01412 
01413     isStandaloneSAXFunc isStandalone;
01414 
01415     hasInternalSubsetSAXFunc hasInternalSubset;
01416 
01417     hasExternalSubsetSAXFunc hasExternalSubset;
01418 
01419     resolveEntitySAXFunc resolveEntity;
01420 
01421     getEntitySAXFunc getEntity;
01422 
01423     entityDeclSAXFunc entityDecl;
01424 
01425     notationDeclSAXFunc notationDecl;
01426 
01427     attributeDeclSAXFunc attributeDecl;
01428 
01429     elementDeclSAXFunc elementDecl;
01430 
01431     unparsedEntityDeclSAXFunc unparsedEntityDecl;
01432 
01433     setDocumentLocatorSAXFunc setDocumentLocator;
01434 
01435     startDocumentSAXFunc startDocument;
01436 
01437     endDocumentSAXFunc endDocument;
01438 
01439     startElementSAXFunc startElement;
01440 
01441     endElementSAXFunc endElement;
01442 
01443     referenceSAXFunc reference;
01444 
01445     charactersSAXFunc characters;
01446 
01447     ignorableWhitespaceSAXFunc ignorableWhitespace;
01448 
01449     processingInstructionSAXFunc processingInstruction;
01450 
01451     commentSAXFunc comment;
01452 
01453     warningSAXFunc warning;
01454 
01455     errorSAXFunc error;
01456 
01457     fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
01458 
01459     getParameterEntitySAXFunc getParameterEntity;
01460 
01461     cdataBlockSAXFunc cdataBlock;
01462 
01463     externalSubsetSAXFunc externalSubset;
01464 
01465     unsigned int initialized;
01466 
01467     /* The following fields are extensions available only on version 2 */
01468 
01469     void *_private;
01470 
01471     startElementNsSAX2Func startElementNs;
01472 
01473     endElementNsSAX2Func endElementNs;
01474 
01475     xmlStructuredErrorFunc serror;
01476 
01477 };
01478 
01479 
01480 
01481 /*
01482 
01483  * SAX Version 1
01484 
01485  */
01486 
01487 typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
01488 
01489 typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
01490 
01491 struct _xmlSAXHandlerV1 {
01492 
01493     internalSubsetSAXFunc internalSubset;
01494 
01495     isStandaloneSAXFunc isStandalone;
01496 
01497     hasInternalSubsetSAXFunc hasInternalSubset;
01498 
01499     hasExternalSubsetSAXFunc hasExternalSubset;
01500 
01501     resolveEntitySAXFunc resolveEntity;
01502 
01503     getEntitySAXFunc getEntity;
01504 
01505     entityDeclSAXFunc entityDecl;
01506 
01507     notationDeclSAXFunc notationDecl;
01508 
01509     attributeDeclSAXFunc attributeDecl;
01510 
01511     elementDeclSAXFunc elementDecl;
01512 
01513     unparsedEntityDeclSAXFunc unparsedEntityDecl;
01514 
01515     setDocumentLocatorSAXFunc setDocumentLocator;
01516 
01517     startDocumentSAXFunc startDocument;
01518 
01519     endDocumentSAXFunc endDocument;
01520 
01521     startElementSAXFunc startElement;
01522 
01523     endElementSAXFunc endElement;
01524 
01525     referenceSAXFunc reference;
01526 
01527     charactersSAXFunc characters;
01528 
01529     ignorableWhitespaceSAXFunc ignorableWhitespace;
01530 
01531     processingInstructionSAXFunc processingInstruction;
01532 
01533     commentSAXFunc comment;
01534 
01535     warningSAXFunc warning;
01536 
01537     errorSAXFunc error;
01538 
01539     fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
01540 
01541     getParameterEntitySAXFunc getParameterEntity;
01542 
01543     cdataBlockSAXFunc cdataBlock;
01544 
01545     externalSubsetSAXFunc externalSubset;
01546 
01547     unsigned int initialized;
01548 
01549 };
01550 
01551 
01552 
01553 
01554 
01575 typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
01576 
01577                                          const char *ID,
01578 
01579                                          xmlParserCtxtPtr context);
01580 
01581 
01582 
01583 #ifdef __cplusplus
01584 
01585 }
01586 
01587 #endif
01588 
01589 
01590 
01591 #include <libxml/encoding.h>
01592 
01593 #include <libxml/xmlIO.h>
01594 
01595 #include <libxml/globals.h>
01596 
01597 
01598 
01599 #ifdef __cplusplus
01600 
01601 extern "C" {
01602 
01603 #endif
01604 
01605 
01606 
01607 
01608 
01609 /*
01610 
01611  * Init/Cleanup
01612 
01613  */
01614 
01615 XMLPUBFUN void XMLCALL          
01616 
01617                 xmlInitParser           (void);
01618 
01619 XMLPUBFUN void XMLCALL          
01620 
01621                 xmlCleanupParser        (void);
01622 
01623 
01624 
01625 /*
01626 
01627  * Input functions
01628 
01629  */
01630 
01631 XMLPUBFUN int XMLCALL           
01632 
01633                 xmlParserInputRead      (xmlParserInputPtr in,
01634 
01635                                          int len);
01636 
01637 XMLPUBFUN int XMLCALL           
01638 
01639                 xmlParserInputGrow      (xmlParserInputPtr in,
01640 
01641                                          int len);
01642 
01643 
01644 
01645 /*
01646 
01647  * Basic parsing Interfaces
01648 
01649  */
01650 
01651 #ifdef LIBXML_SAX1_ENABLED
01652 
01653 XMLPUBFUN xmlDocPtr XMLCALL     
01654 
01655                 xmlParseDoc             (xmlChar *cur);
01656 
01657 XMLPUBFUN xmlDocPtr XMLCALL     
01658 
01659                 xmlParseFile            (const char *filename);
01660 
01661 XMLPUBFUN xmlDocPtr XMLCALL     
01662 
01663                 xmlParseMemory          (const char *buffer,
01664 
01665                                          int size);
01666 
01667 #endif /* LIBXML_SAX1_ENABLED */
01668 
01669 XMLPUBFUN int XMLCALL           
01670 
01671                 xmlSubstituteEntitiesDefault(int val);
01672 
01673 XMLPUBFUN int XMLCALL           
01674 
01675                 xmlKeepBlanksDefault    (int val);
01676 
01677 #ifdef LIBXML_PUSH_ENABLED
01678 
01679 XMLPUBFUN void XMLCALL          
01680 
01681                 xmlStopParser           (xmlParserCtxtPtr ctxt);
01682 
01683 #endif /* LIBXML_PUSH_ENABLED */
01684 
01685 XMLPUBFUN int XMLCALL           
01686 
01687                 xmlPedanticParserDefault(int val);
01688 
01689 XMLPUBFUN int XMLCALL           
01690 
01691                 xmlLineNumbersDefault   (int val);
01692 
01693 
01694 
01695 #ifdef LIBXML_SAX1_ENABLED
01696 
01697 /*
01698 
01699  * Recovery mode 
01700 
01701  */
01702 
01703 XMLPUBFUN xmlDocPtr XMLCALL     
01704 
01705                 xmlRecoverDoc           (xmlChar *cur);
01706 
01707 XMLPUBFUN xmlDocPtr XMLCALL     
01708 
01709                 xmlRecoverMemory        (const char *buffer,
01710 
01711                                          int size);
01712 
01713 XMLPUBFUN xmlDocPtr XMLCALL     
01714 
01715                 xmlRecoverFile          (const char *filename);
01716 
01717 #endif /* LIBXML_SAX1_ENABLED */
01718 
01719 
01720 
01721 /*
01722 
01723  * Less common routines and SAX interfaces
01724 
01725  */
01726 
01727 XMLPUBFUN int XMLCALL           
01728 
01729                 xmlParseDocument        (xmlParserCtxtPtr ctxt);
01730 
01731 XMLPUBFUN int XMLCALL           
01732 
01733                 xmlParseExtParsedEnt    (xmlParserCtxtPtr ctxt);
01734 
01735 #ifdef LIBXML_SAX1_ENABLED
01736 
01737 XMLPUBFUN int XMLCALL           
01738 
01739                 xmlSAXUserParseFile     (xmlSAXHandlerPtr sax,
01740 
01741                                          void *user_data,
01742 
01743                                          const char *filename);
01744 
01745 XMLPUBFUN int XMLCALL           
01746 
01747                 xmlSAXUserParseMemory   (xmlSAXHandlerPtr sax,
01748 
01749                                          void *user_data,
01750 
01751                                          const char *buffer,
01752 
01753                                          int size);
01754 
01755 XMLPUBFUN xmlDocPtr XMLCALL     
01756 
01757                 xmlSAXParseDoc          (xmlSAXHandlerPtr sax,
01758 
01759                                          xmlChar *cur,
01760 
01761                                          int recovery);
01762 
01763 XMLPUBFUN xmlDocPtr XMLCALL     
01764 
01765                 xmlSAXParseMemory       (xmlSAXHandlerPtr sax,
01766 
01767                                          const char *buffer,
01768 
01769                                          int size,
01770 
01771                                          int recovery);
01772 
01773 XMLPUBFUN xmlDocPtr XMLCALL     
01774 
01775                 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
01776 
01777                                          const char *buffer,
01778 
01779                                          int size,
01780 
01781                                          int recovery,
01782 
01783                                          void *data);
01784 
01785 XMLPUBFUN xmlDocPtr XMLCALL     
01786 
01787                 xmlSAXParseFile         (xmlSAXHandlerPtr sax,
01788 
01789                                          const char *filename,
01790 
01791                                          int recovery);
01792 
01793 XMLPUBFUN xmlDocPtr XMLCALL     
01794 
01795                 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
01796 
01797                                          const char *filename,
01798 
01799                                          int recovery,
01800 
01801                                          void *data);
01802 
01803 XMLPUBFUN xmlDocPtr XMLCALL     
01804 
01805                 xmlSAXParseEntity       (xmlSAXHandlerPtr sax,
01806 
01807                                          const char *filename);
01808 
01809 XMLPUBFUN xmlDocPtr XMLCALL     
01810 
01811                 xmlParseEntity          (const char *filename);
01812 
01813 #endif /* LIBXML_SAX1_ENABLED */
01814 
01815 
01816 
01817 #ifdef LIBXML_VALID_ENABLED
01818 
01819 XMLPUBFUN xmlDtdPtr XMLCALL     
01820 
01821                 xmlSAXParseDTD          (xmlSAXHandlerPtr sax,
01822 
01823                                          const xmlChar *ExternalID,
01824 
01825                                          const xmlChar *SystemID);
01826 
01827 XMLPUBFUN xmlDtdPtr XMLCALL     
01828 
01829                 xmlParseDTD             (const xmlChar *ExternalID,
01830 
01831                                          const xmlChar *SystemID);
01832 
01833 XMLPUBFUN xmlDtdPtr XMLCALL     
01834 
01835                 xmlIOParseDTD           (xmlSAXHandlerPtr sax,
01836 
01837                                          xmlParserInputBufferPtr input,
01838 
01839                                          xmlCharEncoding enc);
01840 
01841 #endif /* LIBXML_VALID_ENABLE */
01842 
01843 #ifdef LIBXML_SAX1_ENABLED
01844 
01845 XMLPUBFUN int XMLCALL   
01846 
01847                 xmlParseBalancedChunkMemory(xmlDocPtr doc,
01848 
01849                                          xmlSAXHandlerPtr sax,
01850 
01851                                          void *user_data,
01852 
01853                                          int depth,
01854 
01855                                          const xmlChar *string,
01856 
01857                                          xmlNodePtr *lst);
01858 
01859 #endif /* LIBXML_SAX1_ENABLED */
01860 
01861 XMLPUBFUN xmlParserErrors XMLCALL
01862 
01863                 xmlParseInNodeContext   (xmlNodePtr node,
01864 
01865                                          const char *data,
01866 
01867                                          int datalen,
01868 
01869                                          int options,
01870 
01871                                          xmlNodePtr *lst);
01872 
01873 #ifdef LIBXML_SAX1_ENABLED
01874 
01875 XMLPUBFUN int XMLCALL          
01876 
01877                 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
01878 
01879                      xmlSAXHandlerPtr sax,
01880 
01881                      void *user_data,
01882 
01883                      int depth,
01884 
01885                      const xmlChar *string,
01886 
01887                      xmlNodePtr *lst,
01888 
01889                      int recover);
01890 
01891 XMLPUBFUN int XMLCALL           
01892 
01893                 xmlParseExternalEntity  (xmlDocPtr doc,
01894 
01895                                          xmlSAXHandlerPtr sax,
01896 
01897                                          void *user_data,
01898 
01899                                          int depth,
01900 
01901                                          const xmlChar *URL,
01902 
01903                                          const xmlChar *ID,
01904 
01905                                          xmlNodePtr *lst);
01906 
01907 #endif /* LIBXML_SAX1_ENABLED */
01908 
01909 XMLPUBFUN int XMLCALL           
01910 
01911                 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
01912 
01913                                          const xmlChar *URL,
01914 
01915                                          const xmlChar *ID,
01916 
01917                                          xmlNodePtr *lst);
01918 
01919 
01920 
01921 /*
01922 
01923  * Parser contexts handling.
01924 
01925  */
01926 
01927 XMLPUBFUN xmlParserCtxtPtr XMLCALL      
01928 
01929                 xmlNewParserCtxt        (void);
01930 
01931 XMLPUBFUN int XMLCALL           
01932 
01933                 xmlInitParserCtxt       (xmlParserCtxtPtr ctxt);
01934 
01935 XMLPUBFUN void XMLCALL          
01936 
01937                 xmlClearParserCtxt      (xmlParserCtxtPtr ctxt);
01938 
01939 XMLPUBFUN void XMLCALL          
01940 
01941                 xmlFreeParserCtxt       (xmlParserCtxtPtr ctxt);
01942 
01943 #ifdef LIBXML_SAX1_ENABLED
01944 
01945 XMLPUBFUN void XMLCALL          
01946 
01947                 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
01948 
01949                                          const xmlChar* buffer,
01950 
01951                                          const char *filename);
01952 
01953 #endif /* LIBXML_SAX1_ENABLED */
01954 
01955 XMLPUBFUN xmlParserCtxtPtr XMLCALL 
01956 
01957                 xmlCreateDocParserCtxt  (const xmlChar *cur);
01958 
01959 
01960 
01961 #ifdef LIBXML_LEGACY_ENABLED
01962 
01963 /*
01964 
01965  * Reading/setting optional parsing features.
01966 
01967  */
01968 
01969 XMLPUBFUN int XMLCALL           
01970 
01971                 xmlGetFeaturesList      (int *len,
01972 
01973                                          const char **result);
01974 
01975 XMLPUBFUN int XMLCALL           
01976 
01977                 xmlGetFeature           (xmlParserCtxtPtr ctxt,
01978 
01979                                          const char *name,
01980 
01981                                          void *result);
01982 
01983 XMLPUBFUN int XMLCALL           
01984 
01985                 xmlSetFeature           (xmlParserCtxtPtr ctxt,
01986 
01987                                          const char *name,
01988 
01989                                          void *value);
01990 
01991 #endif /* LIBXML_LEGACY_ENABLED */
01992 
01993 
01994 
01995 #ifdef LIBXML_PUSH_ENABLED
01996 
01997 /*
01998 
01999  * Interfaces for the Push mode.
02000 
02001  */
02002 
02003 XMLPUBFUN xmlParserCtxtPtr XMLCALL 
02004 
02005                 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
02006 
02007                                          void *user_data,
02008 
02009                                          const char *chunk,
02010 
02011                                          int size,
02012 
02013                                          const char *filename);
02014 
02015 XMLPUBFUN int XMLCALL            
02016 
02017                 xmlParseChunk           (xmlParserCtxtPtr ctxt,
02018 
02019                                          const char *chunk,
02020 
02021                                          int size,
02022 
02023                                          int terminate);
02024 
02025 #endif /* LIBXML_PUSH_ENABLED */
02026 
02027 
02028 
02029 /*
02030 
02031  * Special I/O mode.
02032 
02033  */
02034 
02035 
02036 
02037 XMLPUBFUN xmlParserCtxtPtr XMLCALL 
02038 
02039                 xmlCreateIOParserCtxt   (xmlSAXHandlerPtr sax,
02040 
02041                                          void *user_data,
02042 
02043                                          xmlInputReadCallback   ioread,
02044 
02045                                          xmlInputCloseCallback  ioclose,
02046 
02047                                          void *ioctx,
02048 
02049                                          xmlCharEncoding enc);
02050 
02051 
02052 
02053 XMLPUBFUN xmlParserInputPtr XMLCALL 
02054 
02055                 xmlNewIOInputStream     (xmlParserCtxtPtr ctxt,
02056 
02057                                          xmlParserInputBufferPtr input,
02058 
02059                                          xmlCharEncoding enc);
02060 
02061 
02062 
02063 /*
02064 
02065  * Node infos.
02066 
02067  */
02068 
02069 XMLPUBFUN const xmlParserNodeInfo* XMLCALL
02070 
02071                 xmlParserFindNodeInfo   (const xmlParserCtxtPtr ctxt,
02072 
02073                                          const xmlNodePtr node);
02074 
02075 XMLPUBFUN void XMLCALL          
02076 
02077                 xmlInitNodeInfoSeq      (xmlParserNodeInfoSeqPtr seq);
02078 
02079 XMLPUBFUN void XMLCALL          
02080 
02081                 xmlClearNodeInfoSeq     (xmlParserNodeInfoSeqPtr seq);
02082 
02083 XMLPUBFUN unsigned long XMLCALL 
02084 
02085                 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
02086 
02087                                          const xmlNodePtr node);
02088 
02089 XMLPUBFUN void XMLCALL          
02090 
02091                 xmlParserAddNodeInfo    (xmlParserCtxtPtr ctxt,
02092 
02093                                          const xmlParserNodeInfoPtr info);
02094 
02095 
02096 
02097 /*
02098 
02099  * External entities handling actually implemented in xmlIO.
02100 
02101  */
02102 
02103 
02104 
02105 XMLPUBFUN void XMLCALL          
02106 
02107                 xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
02108 
02109 XMLPUBFUN xmlExternalEntityLoader XMLCALL
02110 
02111                 xmlGetExternalEntityLoader(void);
02112 
02113 XMLPUBFUN xmlParserInputPtr XMLCALL
02114 
02115                 xmlLoadExternalEntity   (const char *URL,
02116 
02117                                          const char *ID,
02118 
02119                                          xmlParserCtxtPtr ctxt);
02120 
02121 
02122 
02123 /*
02124 
02125  * Index lookup, actually implemented in the encoding module
02126 
02127  */
02128 
02129 XMLPUBFUN long XMLCALL
02130 
02131                 xmlByteConsumed         (xmlParserCtxtPtr ctxt);
02132 
02133 
02134 
02135 /*
02136 
02137  * New set of simpler/more flexible APIs
02138 
02139  */
02140 
02153 typedef enum {
02154 
02155     XML_PARSE_RECOVER   = 1<<0, /* recover on errors */
02156 
02157     XML_PARSE_NOENT     = 1<<1, /* substitute entities */
02158 
02159     XML_PARSE_DTDLOAD   = 1<<2, /* load the external subset */
02160 
02161     XML_PARSE_DTDATTR   = 1<<3, /* default DTD attributes */
02162 
02163     XML_PARSE_DTDVALID  = 1<<4, /* validate with the DTD */
02164 
02165     XML_PARSE_NOERROR   = 1<<5, /* suppress error reports */
02166 
02167     XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
02168 
02169     XML_PARSE_PEDANTIC  = 1<<7, /* pedantic error reporting */
02170 
02171     XML_PARSE_NOBLANKS  = 1<<8, /* remove blank nodes */
02172 
02173     XML_PARSE_SAX1      = 1<<9, /* use the SAX1 interface internally */
02174 
02175     XML_PARSE_XINCLUDE  = 1<<10,/* Implement XInclude substitition  */
02176 
02177     XML_PARSE_NONET     = 1<<11,/* Forbid network access */
02178 
02179     XML_PARSE_NODICT    = 1<<12,/* Do not reuse the context dictionnary */
02180 
02181     XML_PARSE_NSCLEAN   = 1<<13,/* remove redundant namespaces declarations */
02182 
02183     XML_PARSE_NOCDATA   = 1<<14,/* merge CDATA as text nodes */
02184 
02185     XML_PARSE_NOXINCNODE= 1<<15 /* do not generate XINCLUDE START/END nodes */
02186 
02187 } xmlParserOption;
02188 
02189 
02190 
02191 XMLPUBFUN void XMLCALL
02192 
02193                 xmlCtxtReset            (xmlParserCtxtPtr ctxt);
02194 
02195 XMLPUBFUN int XMLCALL
02196 
02197                 xmlCtxtResetPush        (xmlParserCtxtPtr ctxt,
02198 
02199                                          const char *chunk,
02200 
02201                                          int size,
02202 
02203                                          const char *filename,
02204 
02205                                          const char *encoding);
02206 
02207 XMLPUBFUN int XMLCALL
02208 
02209                 xmlCtxtUseOptions       (xmlParserCtxtPtr ctxt,
02210 
02211                                          int options);
02212 
02213 XMLPUBFUN xmlDocPtr XMLCALL
02214 
02215                 xmlReadDoc              (const xmlChar *cur,
02216 
02217                                          const char *URL,
02218 
02219                                          const char *encoding,
02220 
02221                                          int options);
02222 
02223 XMLPUBFUN xmlDocPtr XMLCALL
02224 
02225                 xmlReadFile             (const char *URL,
02226 
02227                                          const char *encoding,
02228 
02229                                          int options);
02230 
02231 XMLPUBFUN xmlDocPtr XMLCALL
02232 
02233                 xmlReadMemory           (const char *buffer,
02234 
02235                                          int size,
02236 
02237                                          const char *URL,
02238 
02239                                          const char *encoding,
02240 
02241                                          int options);
02242 
02243 XMLPUBFUN xmlDocPtr XMLCALL
02244 
02245                 xmlReadFd               (int fd,
02246 
02247                                          const char *URL,
02248 
02249                                          const char *encoding,
02250 
02251                                          int options);
02252 
02253 XMLPUBFUN xmlDocPtr XMLCALL
02254 
02255                 xmlReadIO               (xmlInputReadCallback ioread,
02256 
02257                                          xmlInputCloseCallback ioclose,
02258 
02259                                          void *ioctx,
02260 
02261                                          const char *URL,
02262 
02263                                          const char *encoding,
02264 
02265                                          int options);
02266 
02267 XMLPUBFUN xmlDocPtr XMLCALL
02268 
02269                 xmlCtxtReadDoc          (xmlParserCtxtPtr ctxt,
02270 
02271                                          const xmlChar *cur,
02272 
02273                                          const char *URL,
02274 
02275                                          const char *encoding,
02276 
02277                                          int options);
02278 
02279 XMLPUBFUN xmlDocPtr XMLCALL
02280 
02281                 xmlCtxtReadFile         (xmlParserCtxtPtr ctxt,
02282 
02283                                          const char *filename,
02284 
02285                                          const char *encoding,
02286 
02287                                          int options);
02288 
02289 XMLPUBFUN xmlDocPtr XMLCALL
02290 
02291                 xmlCtxtReadMemory               (xmlParserCtxtPtr ctxt,
02292 
02293                                          const char *buffer,
02294 
02295                                          int size,
02296 
02297                                          const char *URL,
02298 
02299                                          const char *encoding,
02300 
02301                                          int options);
02302 
02303 XMLPUBFUN xmlDocPtr XMLCALL
02304 
02305                 xmlCtxtReadFd           (xmlParserCtxtPtr ctxt,
02306 
02307                                          int fd,
02308 
02309                                          const char *URL,
02310 
02311                                          const char *encoding,
02312 
02313                                          int options);
02314 
02315 XMLPUBFUN xmlDocPtr XMLCALL
02316 
02317                 xmlCtxtReadIO           (xmlParserCtxtPtr ctxt,
02318 
02319                                          xmlInputReadCallback ioread,
02320 
02321                                          xmlInputCloseCallback ioclose,
02322 
02323                                          void *ioctx,
02324 
02325                                          const char *URL,
02326 
02327                                          const char *encoding,
02328 
02329                                          int options);
02330 
02331 
02332 
02333 #ifdef __cplusplus
02334 
02335 }
02336 
02337 #endif
02338 
02339 #endif /* __XML_PARSER_H__ */
02340 
02341 
02342 

Generated on Wed Jul 26 13:30:45 2006 for XSB by  doxygen 1.4.5