Eneboo - Documentación para desarrolladores
|
00001 /* 00002 * Summary: the core parser module 00003 * Description: Interfaces, constants and types related to the XML parser 00004 * 00005 * Copy: See Copyright for the status of this software. 00006 * 00007 * Author: Daniel Veillard 00008 */ 00009 00010 #ifndef __XML_PARSER_H__ 00011 #define __XML_PARSER_H__ 00012 00013 #include <stdarg.h> 00014 00015 #include <libxml/xmlversion.h> 00016 #include <libxml/tree.h> 00017 #include <libxml/dict.h> 00018 #include <libxml/hash.h> 00019 #include <libxml/valid.h> 00020 #include <libxml/entities.h> 00021 #include <libxml/xmlerror.h> 00022 #include <libxml/xmlstring.h> 00023 00024 #ifdef __cplusplus 00025 extern "C" { 00026 #endif 00027 00033 #define XML_DEFAULT_VERSION "1.0" 00034 00052 typedef void (* xmlParserInputDeallocate)(xmlChar *str); 00053 00054 struct _xmlParserInput { 00055 /* Input buffer */ 00056 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ 00057 00058 const char *filename; /* The file analyzed, if any */ 00059 const char *directory; /* the directory/base of the file */ 00060 const xmlChar *base; /* Base of the array to parse */ 00061 const xmlChar *cur; /* Current char being parsed */ 00062 const xmlChar *end; /* end of the array to parse */ 00063 int length; /* length if known */ 00064 int line; /* Current line */ 00065 int col; /* Current column */ 00066 /* 00067 * NOTE: consumed is only tested for equality in the parser code, 00068 * so even if there is an overflow this should not give troubles 00069 * for parsing very large instances. 00070 */ 00071 unsigned long consumed; /* How many xmlChars already consumed */ 00072 xmlParserInputDeallocate free; /* function to deallocate the base */ 00073 const xmlChar *encoding; /* the encoding string for entity */ 00074 const xmlChar *version; /* the version string for entity */ 00075 int standalone; /* Was that entity marked standalone */ 00076 int id; /* an unique identifier for the entity */ 00077 }; 00078 00086 typedef struct _xmlParserNodeInfo xmlParserNodeInfo; 00087 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; 00088 00089 struct _xmlParserNodeInfo { 00090 const struct _xmlNode* node; 00091 /* Position & line # that text that created the node begins & ends on */ 00092 unsigned long begin_pos; 00093 unsigned long begin_line; 00094 unsigned long end_pos; 00095 unsigned long end_line; 00096 }; 00097 00098 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; 00099 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; 00100 struct _xmlParserNodeInfoSeq { 00101 unsigned long maximum; 00102 unsigned long length; 00103 xmlParserNodeInfo* buffer; 00104 }; 00105 00112 typedef enum { 00113 XML_PARSER_EOF = -1, /* nothing is to be parsed */ 00114 XML_PARSER_START = 0, /* nothing has been parsed */ 00115 XML_PARSER_MISC, /* Misc* before int subset */ 00116 XML_PARSER_PI, /* Within a processing instruction */ 00117 XML_PARSER_DTD, /* within some DTD content */ 00118 XML_PARSER_PROLOG, /* Misc* after internal subset */ 00119 XML_PARSER_COMMENT, /* within a comment */ 00120 XML_PARSER_START_TAG, /* within a start tag */ 00121 XML_PARSER_CONTENT, /* within the content */ 00122 XML_PARSER_CDATA_SECTION, /* within a CDATA section */ 00123 XML_PARSER_END_TAG, /* within a closing tag */ 00124 XML_PARSER_ENTITY_DECL, /* within an entity declaration */ 00125 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ 00126 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ 00127 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ 00128 XML_PARSER_EPILOG, /* the Misc* after the last end tag */ 00129 XML_PARSER_IGNORE, /* within an IGNORED section */ 00130 XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ 00131 } xmlParserInputState; 00132 00139 #define XML_DETECT_IDS 2 00140 00148 #define XML_COMPLETE_ATTRS 4 00149 00156 #define XML_SKIP_IDS 8 00157 00163 typedef enum { 00164 XML_PARSE_UNKNOWN = 0, 00165 XML_PARSE_DOM = 1, 00166 XML_PARSE_SAX = 2, 00167 XML_PARSE_PUSH_DOM = 3, 00168 XML_PARSE_PUSH_SAX = 4, 00169 XML_PARSE_READER = 5 00170 } xmlParserMode; 00171 00184 struct _xmlParserCtxt { 00185 struct _xmlSAXHandler *sax; /* The SAX handler */ 00186 void *userData; /* For SAX interface only, used by DOM build */ 00187 xmlDocPtr myDoc; /* the document being built */ 00188 int wellFormed; /* is the document well formed */ 00189 int replaceEntities; /* shall we replace entities ? */ 00190 const xmlChar *version; /* the XML version string */ 00191 const xmlChar *encoding; /* the declared encoding, if any */ 00192 int standalone; /* standalone document */ 00193 int html; /* an HTML(1)/Docbook(2) document 00194 * 3 is HTML after <head> 00195 * 10 is HTML after <body> 00196 */ 00197 00198 /* Input stream stack */ 00199 xmlParserInputPtr input; /* Current input stream */ 00200 int inputNr; /* Number of current input streams */ 00201 int inputMax; /* Max number of input streams */ 00202 xmlParserInputPtr *inputTab; /* stack of inputs */ 00203 00204 /* Node analysis stack only used for DOM building */ 00205 xmlNodePtr node; /* Current parsed Node */ 00206 int nodeNr; /* Depth of the parsing stack */ 00207 int nodeMax; /* Max depth of the parsing stack */ 00208 xmlNodePtr *nodeTab; /* array of nodes */ 00209 00210 int record_info; /* Whether node info should be kept */ 00211 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ 00212 00213 int errNo; /* error code */ 00214 00215 int hasExternalSubset; /* reference and external subset */ 00216 int hasPErefs; /* the internal subset has PE refs */ 00217 int external; /* are we parsing an external entity */ 00218 00219 int valid; /* is the document valid */ 00220 int validate; /* shall we try to validate ? */ 00221 xmlValidCtxt vctxt; /* The validity context */ 00222 00223 xmlParserInputState instate; /* current type of input */ 00224 int token; /* next char look-ahead */ 00225 00226 char *directory; /* the data directory */ 00227 00228 /* Node name stack */ 00229 const xmlChar *name; /* Current parsed Node */ 00230 int nameNr; /* Depth of the parsing stack */ 00231 int nameMax; /* Max depth of the parsing stack */ 00232 const xmlChar * *nameTab; /* array of nodes */ 00233 00234 long nbChars; /* number of xmlChar processed */ 00235 long checkIndex; /* used by progressive parsing lookup */ 00236 int keepBlanks; /* ugly but ... */ 00237 int disableSAX; /* SAX callbacks are disabled */ 00238 int inSubset; /* Parsing is in int 1/ext 2 subset */ 00239 const xmlChar * intSubName; /* name of subset */ 00240 xmlChar * extSubURI; /* URI of external subset */ 00241 xmlChar * extSubSystem; /* SYSTEM ID of external subset */ 00242 00243 /* xml:space values */ 00244 int * space; /* Should the parser preserve spaces */ 00245 int spaceNr; /* Depth of the parsing stack */ 00246 int spaceMax; /* Max depth of the parsing stack */ 00247 int * spaceTab; /* array of space infos */ 00248 00249 int depth; /* to prevent entity substitution loops */ 00250 xmlParserInputPtr entity; /* used to check entities boundaries */ 00251 int charset; /* encoding of the in-memory content 00252 actually an xmlCharEncoding */ 00253 int nodelen; /* Those two fields are there to */ 00254 int nodemem; /* Speed up large node parsing */ 00255 int pedantic; /* signal pedantic warnings */ 00256 void *_private; /* For user data, libxml won't touch it */ 00257 00258 int loadsubset; /* should the external subset be loaded */ 00259 int linenumbers; /* set line number in element content */ 00260 void *catalogs; /* document's own catalog */ 00261 int recovery; /* run in recovery mode */ 00262 int progressive; /* is this a progressive parsing */ 00263 xmlDictPtr dict; /* dictionnary for the parser */ 00264 const xmlChar * *atts; /* array for the attributes callbacks */ 00265 int maxatts; /* the size of the array */ 00266 int docdict; /* use strings from dict to build tree */ 00267 00268 /* 00269 * pre-interned strings 00270 */ 00271 const xmlChar *str_xml; 00272 const xmlChar *str_xmlns; 00273 const xmlChar *str_xml_ns; 00274 00275 /* 00276 * Everything below is used only by the new SAX mode 00277 */ 00278 int sax2; /* operating in the new SAX mode */ 00279 int nsNr; /* the number of inherited namespaces */ 00280 int nsMax; /* the size of the arrays */ 00281 const xmlChar * *nsTab; /* the array of prefix/namespace name */ 00282 int *attallocs; /* which attribute were allocated */ 00283 void * *pushTab; /* array of data for push */ 00284 xmlHashTablePtr attsDefault; /* defaulted attributes if any */ 00285 xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ 00286 int nsWellFormed; /* is the document XML Nanespace okay */ 00287 int options; /* Extra options */ 00288 00289 /* 00290 * Those fields are needed only for treaming parsing so far 00291 */ 00292 int dictNames; /* Use dictionary names for the tree */ 00293 int freeElemsNr; /* number of freed element nodes */ 00294 xmlNodePtr freeElems; /* List of freed element nodes */ 00295 int freeAttrsNr; /* number of freed attributes nodes */ 00296 xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ 00297 00298 /* 00299 * the complete error informations for the last error. 00300 */ 00301 xmlError lastError; 00302 xmlParserMode parseMode; /* the parser mode */ 00303 unsigned long nbentities; /* number of entities references */ 00304 unsigned long sizeentities; /* size of parsed entities */ 00305 00306 /* for use by HTML non-recursive parser */ 00307 xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ 00308 int nodeInfoNr; /* Depth of the parsing stack */ 00309 int nodeInfoMax; /* Max depth of the parsing stack */ 00310 xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ 00311 }; 00312 00318 struct _xmlSAXLocator { 00319 const xmlChar *(*getPublicId)(void *ctx); 00320 const xmlChar *(*getSystemId)(void *ctx); 00321 int (*getLineNumber)(void *ctx); 00322 int (*getColumnNumber)(void *ctx); 00323 }; 00324 00347 typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, 00348 const xmlChar *publicId, 00349 const xmlChar *systemId); 00359 typedef void (*internalSubsetSAXFunc) (void *ctx, 00360 const xmlChar *name, 00361 const xmlChar *ExternalID, 00362 const xmlChar *SystemID); 00372 typedef void (*externalSubsetSAXFunc) (void *ctx, 00373 const xmlChar *name, 00374 const xmlChar *ExternalID, 00375 const xmlChar *SystemID); 00385 typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, 00386 const xmlChar *name); 00396 typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, 00397 const xmlChar *name); 00409 typedef void (*entityDeclSAXFunc) (void *ctx, 00410 const xmlChar *name, 00411 int type, 00412 const xmlChar *publicId, 00413 const xmlChar *systemId, 00414 xmlChar *content); 00424 typedef void (*notationDeclSAXFunc)(void *ctx, 00425 const xmlChar *name, 00426 const xmlChar *publicId, 00427 const xmlChar *systemId); 00440 typedef void (*attributeDeclSAXFunc)(void *ctx, 00441 const xmlChar *elem, 00442 const xmlChar *fullname, 00443 int type, 00444 int def, 00445 const xmlChar *defaultValue, 00446 xmlEnumerationPtr tree); 00456 typedef void (*elementDeclSAXFunc)(void *ctx, 00457 const xmlChar *name, 00458 int type, 00459 xmlElementContentPtr content); 00470 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, 00471 const xmlChar *name, 00472 const xmlChar *publicId, 00473 const xmlChar *systemId, 00474 const xmlChar *notationName); 00483 typedef void (*setDocumentLocatorSAXFunc) (void *ctx, 00484 xmlSAXLocatorPtr loc); 00491 typedef void (*startDocumentSAXFunc) (void *ctx); 00498 typedef void (*endDocumentSAXFunc) (void *ctx); 00507 typedef void (*startElementSAXFunc) (void *ctx, 00508 const xmlChar *name, 00509 const xmlChar **atts); 00517 typedef void (*endElementSAXFunc) (void *ctx, 00518 const xmlChar *name); 00530 typedef void (*attributeSAXFunc) (void *ctx, 00531 const xmlChar *name, 00532 const xmlChar *value); 00540 typedef void (*referenceSAXFunc) (void *ctx, 00541 const xmlChar *name); 00550 typedef void (*charactersSAXFunc) (void *ctx, 00551 const xmlChar *ch, 00552 int len); 00562 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, 00563 const xmlChar *ch, 00564 int len); 00573 typedef void (*processingInstructionSAXFunc) (void *ctx, 00574 const xmlChar *target, 00575 const xmlChar *data); 00583 typedef void (*commentSAXFunc) (void *ctx, 00584 const xmlChar *value); 00593 typedef void (*cdataBlockSAXFunc) ( 00594 void *ctx, 00595 const xmlChar *value, 00596 int len); 00605 typedef void (XMLCDECL *warningSAXFunc) (void *ctx, 00606 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); 00615 typedef void (XMLCDECL *errorSAXFunc) (void *ctx, 00616 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); 00627 typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, 00628 const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); 00637 typedef int (*isStandaloneSAXFunc) (void *ctx); 00646 typedef int (*hasInternalSubsetSAXFunc) (void *ctx); 00647 00656 typedef int (*hasExternalSubsetSAXFunc) (void *ctx); 00657 00658 /************************************************************************ 00659 * * 00660 * The SAX version 2 API extensions * 00661 * * 00662 ************************************************************************/ 00668 #define XML_SAX2_MAGIC 0xDEEDBEAF 00669 00689 typedef void (*startElementNsSAX2Func) (void *ctx, 00690 const xmlChar *localname, 00691 const xmlChar *prefix, 00692 const xmlChar *URI, 00693 int nb_namespaces, 00694 const xmlChar **namespaces, 00695 int nb_attributes, 00696 int nb_defaulted, 00697 const xmlChar **attributes); 00698 00710 typedef void (*endElementNsSAX2Func) (void *ctx, 00711 const xmlChar *localname, 00712 const xmlChar *prefix, 00713 const xmlChar *URI); 00714 00715 00716 struct _xmlSAXHandler { 00717 internalSubsetSAXFunc internalSubset; 00718 isStandaloneSAXFunc isStandalone; 00719 hasInternalSubsetSAXFunc hasInternalSubset; 00720 hasExternalSubsetSAXFunc hasExternalSubset; 00721 resolveEntitySAXFunc resolveEntity; 00722 getEntitySAXFunc getEntity; 00723 entityDeclSAXFunc entityDecl; 00724 notationDeclSAXFunc notationDecl; 00725 attributeDeclSAXFunc attributeDecl; 00726 elementDeclSAXFunc elementDecl; 00727 unparsedEntityDeclSAXFunc unparsedEntityDecl; 00728 setDocumentLocatorSAXFunc setDocumentLocator; 00729 startDocumentSAXFunc startDocument; 00730 endDocumentSAXFunc endDocument; 00731 startElementSAXFunc startElement; 00732 endElementSAXFunc endElement; 00733 referenceSAXFunc reference; 00734 charactersSAXFunc characters; 00735 ignorableWhitespaceSAXFunc ignorableWhitespace; 00736 processingInstructionSAXFunc processingInstruction; 00737 commentSAXFunc comment; 00738 warningSAXFunc warning; 00739 errorSAXFunc error; 00740 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ 00741 getParameterEntitySAXFunc getParameterEntity; 00742 cdataBlockSAXFunc cdataBlock; 00743 externalSubsetSAXFunc externalSubset; 00744 unsigned int initialized; 00745 /* The following fields are extensions available only on version 2 */ 00746 void *_private; 00747 startElementNsSAX2Func startElementNs; 00748 endElementNsSAX2Func endElementNs; 00749 xmlStructuredErrorFunc serror; 00750 }; 00751 00752 /* 00753 * SAX Version 1 00754 */ 00755 typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; 00756 typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; 00757 struct _xmlSAXHandlerV1 { 00758 internalSubsetSAXFunc internalSubset; 00759 isStandaloneSAXFunc isStandalone; 00760 hasInternalSubsetSAXFunc hasInternalSubset; 00761 hasExternalSubsetSAXFunc hasExternalSubset; 00762 resolveEntitySAXFunc resolveEntity; 00763 getEntitySAXFunc getEntity; 00764 entityDeclSAXFunc entityDecl; 00765 notationDeclSAXFunc notationDecl; 00766 attributeDeclSAXFunc attributeDecl; 00767 elementDeclSAXFunc elementDecl; 00768 unparsedEntityDeclSAXFunc unparsedEntityDecl; 00769 setDocumentLocatorSAXFunc setDocumentLocator; 00770 startDocumentSAXFunc startDocument; 00771 endDocumentSAXFunc endDocument; 00772 startElementSAXFunc startElement; 00773 endElementSAXFunc endElement; 00774 referenceSAXFunc reference; 00775 charactersSAXFunc characters; 00776 ignorableWhitespaceSAXFunc ignorableWhitespace; 00777 processingInstructionSAXFunc processingInstruction; 00778 commentSAXFunc comment; 00779 warningSAXFunc warning; 00780 errorSAXFunc error; 00781 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ 00782 getParameterEntitySAXFunc getParameterEntity; 00783 cdataBlockSAXFunc cdataBlock; 00784 externalSubsetSAXFunc externalSubset; 00785 unsigned int initialized; 00786 }; 00787 00788 00799 typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, 00800 const char *ID, 00801 xmlParserCtxtPtr context); 00802 00803 #ifdef __cplusplus 00804 } 00805 #endif 00806 00807 #include <libxml/encoding.h> 00808 #include <libxml/xmlIO.h> 00809 #include <libxml/globals.h> 00810 00811 #ifdef __cplusplus 00812 extern "C" { 00813 #endif 00814 00815 00816 /* 00817 * Init/Cleanup 00818 */ 00819 XMLPUBFUN void XMLCALL 00820 xmlInitParser (void); 00821 XMLPUBFUN void XMLCALL 00822 xmlCleanupParser (void); 00823 00824 /* 00825 * Input functions 00826 */ 00827 XMLPUBFUN int XMLCALL 00828 xmlParserInputRead (xmlParserInputPtr in, 00829 int len); 00830 XMLPUBFUN int XMLCALL 00831 xmlParserInputGrow (xmlParserInputPtr in, 00832 int len); 00833 00834 /* 00835 * Basic parsing Interfaces 00836 */ 00837 #ifdef LIBXML_SAX1_ENABLED 00838 XMLPUBFUN xmlDocPtr XMLCALL 00839 xmlParseDoc (const xmlChar *cur); 00840 XMLPUBFUN xmlDocPtr XMLCALL 00841 xmlParseFile (const char *filename); 00842 XMLPUBFUN xmlDocPtr XMLCALL 00843 xmlParseMemory (const char *buffer, 00844 int size); 00845 #endif /* LIBXML_SAX1_ENABLED */ 00846 XMLPUBFUN int XMLCALL 00847 xmlSubstituteEntitiesDefault(int val); 00848 XMLPUBFUN int XMLCALL 00849 xmlKeepBlanksDefault (int val); 00850 XMLPUBFUN void XMLCALL 00851 xmlStopParser (xmlParserCtxtPtr ctxt); 00852 XMLPUBFUN int XMLCALL 00853 xmlPedanticParserDefault(int val); 00854 XMLPUBFUN int XMLCALL 00855 xmlLineNumbersDefault (int val); 00856 00857 #ifdef LIBXML_SAX1_ENABLED 00858 /* 00859 * Recovery mode 00860 */ 00861 XMLPUBFUN xmlDocPtr XMLCALL 00862 xmlRecoverDoc (const xmlChar *cur); 00863 XMLPUBFUN xmlDocPtr XMLCALL 00864 xmlRecoverMemory (const char *buffer, 00865 int size); 00866 XMLPUBFUN xmlDocPtr XMLCALL 00867 xmlRecoverFile (const char *filename); 00868 #endif /* LIBXML_SAX1_ENABLED */ 00869 00870 /* 00871 * Less common routines and SAX interfaces 00872 */ 00873 XMLPUBFUN int XMLCALL 00874 xmlParseDocument (xmlParserCtxtPtr ctxt); 00875 XMLPUBFUN int XMLCALL 00876 xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); 00877 #ifdef LIBXML_SAX1_ENABLED 00878 XMLPUBFUN int XMLCALL 00879 xmlSAXUserParseFile (xmlSAXHandlerPtr sax, 00880 void *user_data, 00881 const char *filename); 00882 XMLPUBFUN int XMLCALL 00883 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, 00884 void *user_data, 00885 const char *buffer, 00886 int size); 00887 XMLPUBFUN xmlDocPtr XMLCALL 00888 xmlSAXParseDoc (xmlSAXHandlerPtr sax, 00889 const xmlChar *cur, 00890 int recovery); 00891 XMLPUBFUN xmlDocPtr XMLCALL 00892 xmlSAXParseMemory (xmlSAXHandlerPtr sax, 00893 const char *buffer, 00894 int size, 00895 int recovery); 00896 XMLPUBFUN xmlDocPtr XMLCALL 00897 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, 00898 const char *buffer, 00899 int size, 00900 int recovery, 00901 void *data); 00902 XMLPUBFUN xmlDocPtr XMLCALL 00903 xmlSAXParseFile (xmlSAXHandlerPtr sax, 00904 const char *filename, 00905 int recovery); 00906 XMLPUBFUN xmlDocPtr XMLCALL 00907 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, 00908 const char *filename, 00909 int recovery, 00910 void *data); 00911 XMLPUBFUN xmlDocPtr XMLCALL 00912 xmlSAXParseEntity (xmlSAXHandlerPtr sax, 00913 const char *filename); 00914 XMLPUBFUN xmlDocPtr XMLCALL 00915 xmlParseEntity (const char *filename); 00916 #endif /* LIBXML_SAX1_ENABLED */ 00917 00918 #ifdef LIBXML_VALID_ENABLED 00919 XMLPUBFUN xmlDtdPtr XMLCALL 00920 xmlSAXParseDTD (xmlSAXHandlerPtr sax, 00921 const xmlChar *ExternalID, 00922 const xmlChar *SystemID); 00923 XMLPUBFUN xmlDtdPtr XMLCALL 00924 xmlParseDTD (const xmlChar *ExternalID, 00925 const xmlChar *SystemID); 00926 XMLPUBFUN xmlDtdPtr XMLCALL 00927 xmlIOParseDTD (xmlSAXHandlerPtr sax, 00928 xmlParserInputBufferPtr input, 00929 xmlCharEncoding enc); 00930 #endif /* LIBXML_VALID_ENABLE */ 00931 #ifdef LIBXML_SAX1_ENABLED 00932 XMLPUBFUN int XMLCALL 00933 xmlParseBalancedChunkMemory(xmlDocPtr doc, 00934 xmlSAXHandlerPtr sax, 00935 void *user_data, 00936 int depth, 00937 const xmlChar *string, 00938 xmlNodePtr *lst); 00939 #endif /* LIBXML_SAX1_ENABLED */ 00940 XMLPUBFUN xmlParserErrors XMLCALL 00941 xmlParseInNodeContext (xmlNodePtr node, 00942 const char *data, 00943 int datalen, 00944 int options, 00945 xmlNodePtr *lst); 00946 #ifdef LIBXML_SAX1_ENABLED 00947 XMLPUBFUN int XMLCALL 00948 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, 00949 xmlSAXHandlerPtr sax, 00950 void *user_data, 00951 int depth, 00952 const xmlChar *string, 00953 xmlNodePtr *lst, 00954 int recover); 00955 XMLPUBFUN int XMLCALL 00956 xmlParseExternalEntity (xmlDocPtr doc, 00957 xmlSAXHandlerPtr sax, 00958 void *user_data, 00959 int depth, 00960 const xmlChar *URL, 00961 const xmlChar *ID, 00962 xmlNodePtr *lst); 00963 #endif /* LIBXML_SAX1_ENABLED */ 00964 XMLPUBFUN int XMLCALL 00965 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, 00966 const xmlChar *URL, 00967 const xmlChar *ID, 00968 xmlNodePtr *lst); 00969 00970 /* 00971 * Parser contexts handling. 00972 */ 00973 XMLPUBFUN xmlParserCtxtPtr XMLCALL 00974 xmlNewParserCtxt (void); 00975 XMLPUBFUN int XMLCALL 00976 xmlInitParserCtxt (xmlParserCtxtPtr ctxt); 00977 XMLPUBFUN void XMLCALL 00978 xmlClearParserCtxt (xmlParserCtxtPtr ctxt); 00979 XMLPUBFUN void XMLCALL 00980 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); 00981 #ifdef LIBXML_SAX1_ENABLED 00982 XMLPUBFUN void XMLCALL 00983 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, 00984 const xmlChar* buffer, 00985 const char *filename); 00986 #endif /* LIBXML_SAX1_ENABLED */ 00987 XMLPUBFUN xmlParserCtxtPtr XMLCALL 00988 xmlCreateDocParserCtxt (const xmlChar *cur); 00989 00990 #ifdef LIBXML_LEGACY_ENABLED 00991 /* 00992 * Reading/setting optional parsing features. 00993 */ 00994 XMLPUBFUN int XMLCALL 00995 xmlGetFeaturesList (int *len, 00996 const char **result); 00997 XMLPUBFUN int XMLCALL 00998 xmlGetFeature (xmlParserCtxtPtr ctxt, 00999 const char *name, 01000 void *result); 01001 XMLPUBFUN int XMLCALL 01002 xmlSetFeature (xmlParserCtxtPtr ctxt, 01003 const char *name, 01004 void *value); 01005 #endif /* LIBXML_LEGACY_ENABLED */ 01006 01007 #ifdef LIBXML_PUSH_ENABLED 01008 /* 01009 * Interfaces for the Push mode. 01010 */ 01011 XMLPUBFUN xmlParserCtxtPtr XMLCALL 01012 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, 01013 void *user_data, 01014 const char *chunk, 01015 int size, 01016 const char *filename); 01017 XMLPUBFUN int XMLCALL 01018 xmlParseChunk (xmlParserCtxtPtr ctxt, 01019 const char *chunk, 01020 int size, 01021 int terminate); 01022 #endif /* LIBXML_PUSH_ENABLED */ 01023 01024 /* 01025 * Special I/O mode. 01026 */ 01027 01028 XMLPUBFUN xmlParserCtxtPtr XMLCALL 01029 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, 01030 void *user_data, 01031 xmlInputReadCallback ioread, 01032 xmlInputCloseCallback ioclose, 01033 void *ioctx, 01034 xmlCharEncoding enc); 01035 01036 XMLPUBFUN xmlParserInputPtr XMLCALL 01037 xmlNewIOInputStream (xmlParserCtxtPtr ctxt, 01038 xmlParserInputBufferPtr input, 01039 xmlCharEncoding enc); 01040 01041 /* 01042 * Node infos. 01043 */ 01044 XMLPUBFUN const xmlParserNodeInfo* XMLCALL 01045 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, 01046 const xmlNodePtr node); 01047 XMLPUBFUN void XMLCALL 01048 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); 01049 XMLPUBFUN void XMLCALL 01050 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); 01051 XMLPUBFUN unsigned long XMLCALL 01052 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, 01053 const xmlNodePtr node); 01054 XMLPUBFUN void XMLCALL 01055 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, 01056 const xmlParserNodeInfoPtr info); 01057 01058 /* 01059 * External entities handling actually implemented in xmlIO. 01060 */ 01061 01062 XMLPUBFUN void XMLCALL 01063 xmlSetExternalEntityLoader(xmlExternalEntityLoader f); 01064 XMLPUBFUN xmlExternalEntityLoader XMLCALL 01065 xmlGetExternalEntityLoader(void); 01066 XMLPUBFUN xmlParserInputPtr XMLCALL 01067 xmlLoadExternalEntity (const char *URL, 01068 const char *ID, 01069 xmlParserCtxtPtr ctxt); 01070 01071 /* 01072 * Index lookup, actually implemented in the encoding module 01073 */ 01074 XMLPUBFUN long XMLCALL 01075 xmlByteConsumed (xmlParserCtxtPtr ctxt); 01076 01077 /* 01078 * New set of simpler/more flexible APIs 01079 */ 01086 typedef enum { 01087 XML_PARSE_RECOVER = 1<<0, /* recover on errors */ 01088 XML_PARSE_NOENT = 1<<1, /* substitute entities */ 01089 XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ 01090 XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ 01091 XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ 01092 XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ 01093 XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ 01094 XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ 01095 XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ 01096 XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ 01097 XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ 01098 XML_PARSE_NONET = 1<<11,/* Forbid network access */ 01099 XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ 01100 XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ 01101 XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ 01102 XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ 01103 XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of 01104 the tree allowed afterwards (will possibly 01105 crash if you try to modify the tree) */ 01106 XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ 01107 XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ 01108 XML_PARSE_HUGE = 1<<19, /* relax any hardcoded limit from the parser */ 01109 XML_PARSE_OLDSAX = 1<<20 /* parse using SAX2 interface from before 2.7.0 */ 01110 } xmlParserOption; 01111 01112 XMLPUBFUN void XMLCALL 01113 xmlCtxtReset (xmlParserCtxtPtr ctxt); 01114 XMLPUBFUN int XMLCALL 01115 xmlCtxtResetPush (xmlParserCtxtPtr ctxt, 01116 const char *chunk, 01117 int size, 01118 const char *filename, 01119 const char *encoding); 01120 XMLPUBFUN int XMLCALL 01121 xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, 01122 int options); 01123 XMLPUBFUN xmlDocPtr XMLCALL 01124 xmlReadDoc (const xmlChar *cur, 01125 const char *URL, 01126 const char *encoding, 01127 int options); 01128 XMLPUBFUN xmlDocPtr XMLCALL 01129 xmlReadFile (const char *URL, 01130 const char *encoding, 01131 int options); 01132 XMLPUBFUN xmlDocPtr XMLCALL 01133 xmlReadMemory (const char *buffer, 01134 int size, 01135 const char *URL, 01136 const char *encoding, 01137 int options); 01138 XMLPUBFUN xmlDocPtr XMLCALL 01139 xmlReadFd (int fd, 01140 const char *URL, 01141 const char *encoding, 01142 int options); 01143 XMLPUBFUN xmlDocPtr XMLCALL 01144 xmlReadIO (xmlInputReadCallback ioread, 01145 xmlInputCloseCallback ioclose, 01146 void *ioctx, 01147 const char *URL, 01148 const char *encoding, 01149 int options); 01150 XMLPUBFUN xmlDocPtr XMLCALL 01151 xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, 01152 const xmlChar *cur, 01153 const char *URL, 01154 const char *encoding, 01155 int options); 01156 XMLPUBFUN xmlDocPtr XMLCALL 01157 xmlCtxtReadFile (xmlParserCtxtPtr ctxt, 01158 const char *filename, 01159 const char *encoding, 01160 int options); 01161 XMLPUBFUN xmlDocPtr XMLCALL 01162 xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, 01163 const char *buffer, 01164 int size, 01165 const char *URL, 01166 const char *encoding, 01167 int options); 01168 XMLPUBFUN xmlDocPtr XMLCALL 01169 xmlCtxtReadFd (xmlParserCtxtPtr ctxt, 01170 int fd, 01171 const char *URL, 01172 const char *encoding, 01173 int options); 01174 XMLPUBFUN xmlDocPtr XMLCALL 01175 xmlCtxtReadIO (xmlParserCtxtPtr ctxt, 01176 xmlInputReadCallback ioread, 01177 xmlInputCloseCallback ioclose, 01178 void *ioctx, 01179 const char *URL, 01180 const char *encoding, 01181 int options); 01182 01183 /* 01184 * Library wide options 01185 */ 01193 typedef enum { 01194 XML_WITH_THREAD = 1, 01195 XML_WITH_TREE = 2, 01196 XML_WITH_OUTPUT = 3, 01197 XML_WITH_PUSH = 4, 01198 XML_WITH_READER = 5, 01199 XML_WITH_PATTERN = 6, 01200 XML_WITH_WRITER = 7, 01201 XML_WITH_SAX1 = 8, 01202 XML_WITH_FTP = 9, 01203 XML_WITH_HTTP = 10, 01204 XML_WITH_VALID = 11, 01205 XML_WITH_HTML = 12, 01206 XML_WITH_LEGACY = 13, 01207 XML_WITH_C14N = 14, 01208 XML_WITH_CATALOG = 15, 01209 XML_WITH_XPATH = 16, 01210 XML_WITH_XPTR = 17, 01211 XML_WITH_XINCLUDE = 18, 01212 XML_WITH_ICONV = 19, 01213 XML_WITH_ISO8859X = 20, 01214 XML_WITH_UNICODE = 21, 01215 XML_WITH_REGEXP = 22, 01216 XML_WITH_AUTOMATA = 23, 01217 XML_WITH_EXPR = 24, 01218 XML_WITH_SCHEMAS = 25, 01219 XML_WITH_SCHEMATRON = 26, 01220 XML_WITH_MODULES = 27, 01221 XML_WITH_DEBUG = 28, 01222 XML_WITH_DEBUG_MEM = 29, 01223 XML_WITH_DEBUG_RUN = 30, 01224 XML_WITH_ZLIB = 31, 01225 XML_WITH_NONE = 99999 /* just to be sure of allocation size */ 01226 } xmlFeature; 01227 01228 XMLPUBFUN int XMLCALL 01229 xmlHasFeature (xmlFeature feature); 01230 01231 #ifdef __cplusplus 01232 } 01233 #endif 01234 #endif /* __XML_PARSER_H__ */ 01235