Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 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@w3.org |
| 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/xmlIO.h> |
| 15 | #include <libxml/entities.h> |
| 16 | |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | /* |
| 23 | * Constants. |
| 24 | */ |
| 25 | #define XML_DEFAULT_VERSION "1.0" |
| 26 | |
| 27 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 28 | * xmlParserInput: |
| 29 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 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 | typedef void (* xmlParserInputDeallocate)(xmlChar *); |
| 39 | typedef struct _xmlParserInput xmlParserInput; |
| 40 | typedef xmlParserInput *xmlParserInputPtr; |
| 41 | struct _xmlParserInput { |
| 42 | /* Input buffer */ |
| 43 | xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ |
| 44 | |
| 45 | const char *filename; /* The file analyzed, if any */ |
| 46 | const char *directory; /* the directory/base of teh file */ |
| 47 | const xmlChar *base; /* Base of the array to parse */ |
| 48 | const xmlChar *cur; /* Current char being parsed */ |
Daniel Veillard | 48b2f89 | 2001-02-25 16:11:03 +0000 | [diff] [blame] | 49 | const xmlChar *end; /* end of the arry to parse */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 50 | int length; /* length if known */ |
| 51 | int line; /* Current line */ |
| 52 | int col; /* Current column */ |
| 53 | int consumed; /* How many xmlChars already consumed */ |
| 54 | xmlParserInputDeallocate free; /* function to deallocate the base */ |
| 55 | const xmlChar *encoding; /* the encoding string for entity */ |
| 56 | const xmlChar *version; /* the version string for entity */ |
| 57 | int standalone; /* Was that entity marked standalone */ |
| 58 | }; |
| 59 | |
| 60 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 61 | * xmlParserNodeInfo: |
| 62 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 63 | * the parser can be asked to collect Node informations, i.e. at what |
| 64 | * place in the file they were detected. |
| 65 | * NOTE: This is off by default and not very well tested. |
| 66 | */ |
| 67 | typedef struct _xmlParserNodeInfo xmlParserNodeInfo; |
| 68 | typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; |
| 69 | |
| 70 | struct _xmlParserNodeInfo { |
| 71 | const struct _xmlNode* node; |
| 72 | /* Position & line # that text that created the node begins & ends on */ |
| 73 | unsigned long begin_pos; |
| 74 | unsigned long begin_line; |
| 75 | unsigned long end_pos; |
| 76 | unsigned long end_line; |
| 77 | }; |
| 78 | |
| 79 | typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; |
| 80 | typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; |
| 81 | struct _xmlParserNodeInfoSeq { |
| 82 | unsigned long maximum; |
| 83 | unsigned long length; |
| 84 | xmlParserNodeInfo* buffer; |
| 85 | }; |
| 86 | |
| 87 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 88 | * xmlParserInputState: |
| 89 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 90 | * The parser is now working also as a state based parser |
| 91 | * The recursive one use the stagte info for entities processing |
| 92 | */ |
| 93 | typedef enum { |
| 94 | XML_PARSER_EOF = -1, /* nothing is to be parsed */ |
| 95 | XML_PARSER_START = 0, /* nothing has been parsed */ |
| 96 | XML_PARSER_MISC, /* Misc* before int subset */ |
| 97 | XML_PARSER_PI, /* Whithin a processing instruction */ |
| 98 | XML_PARSER_DTD, /* within some DTD content */ |
| 99 | XML_PARSER_PROLOG, /* Misc* after internal subset */ |
| 100 | XML_PARSER_COMMENT, /* within a comment */ |
| 101 | XML_PARSER_START_TAG, /* within a start tag */ |
| 102 | XML_PARSER_CONTENT, /* within the content */ |
| 103 | XML_PARSER_CDATA_SECTION, /* within a CDATA section */ |
| 104 | XML_PARSER_END_TAG, /* within a closing tag */ |
| 105 | XML_PARSER_ENTITY_DECL, /* within an entity declaration */ |
| 106 | XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ |
| 107 | XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ |
| 108 | XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ |
| 109 | XML_PARSER_EPILOG, /* the Misc* after the last end tag */ |
| 110 | XML_PARSER_IGNORE /* within an IGNORED section */ |
| 111 | } xmlParserInputState; |
| 112 | |
| 113 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 114 | * xmlParserCtxt: |
| 115 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 116 | * The parser context. |
| 117 | * NOTE This doesn't completely defines the parser state, the (current ?) |
| 118 | * design of the parser uses recursive function calls since this allow |
| 119 | * and easy mapping from the production rules of the specification |
| 120 | * to the actual code. The drawback is that the actual function call |
| 121 | * also reflect the parser state. However most of the parsing routines |
| 122 | * takes as the only argument the parser context pointer, so migrating |
| 123 | * to a state based parser for progressive parsing shouldn't be too hard. |
| 124 | */ |
| 125 | typedef struct _xmlParserCtxt xmlParserCtxt; |
| 126 | typedef xmlParserCtxt *xmlParserCtxtPtr; |
| 127 | struct _xmlParserCtxt { |
| 128 | struct _xmlSAXHandler *sax; /* The SAX handler */ |
| 129 | void *userData; /* For SAX interface only, used by DOM build */ |
| 130 | xmlDocPtr myDoc; /* the document being built */ |
| 131 | int wellFormed; /* is the document well formed */ |
| 132 | int replaceEntities; /* shall we replace entities ? */ |
| 133 | const xmlChar *version; /* the XML version string */ |
| 134 | const xmlChar *encoding; /* the declared encoding, if any */ |
| 135 | int standalone; /* standalone document */ |
| 136 | int html; /* an HTML(1)/Docbook(2) document */ |
| 137 | |
| 138 | /* Input stream stack */ |
| 139 | xmlParserInputPtr input; /* Current input stream */ |
| 140 | int inputNr; /* Number of current input streams */ |
| 141 | int inputMax; /* Max number of input streams */ |
| 142 | xmlParserInputPtr *inputTab; /* stack of inputs */ |
| 143 | |
| 144 | /* Node analysis stack only used for DOM building */ |
| 145 | xmlNodePtr node; /* Current parsed Node */ |
| 146 | int nodeNr; /* Depth of the parsing stack */ |
| 147 | int nodeMax; /* Max depth of the parsing stack */ |
| 148 | xmlNodePtr *nodeTab; /* array of nodes */ |
| 149 | |
| 150 | int record_info; /* Whether node info should be kept */ |
| 151 | xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ |
| 152 | |
| 153 | int errNo; /* error code */ |
| 154 | |
| 155 | int hasExternalSubset; /* reference and external subset */ |
| 156 | int hasPErefs; /* the internal subset has PE refs */ |
| 157 | int external; /* are we parsing an external entity */ |
| 158 | |
| 159 | int valid; /* is the document valid */ |
| 160 | int validate; /* shall we try to validate ? */ |
| 161 | xmlValidCtxt vctxt; /* The validity context */ |
| 162 | |
| 163 | xmlParserInputState instate; /* current type of input */ |
| 164 | int token; /* next char look-ahead */ |
| 165 | |
| 166 | char *directory; /* the data directory */ |
| 167 | |
| 168 | /* Node name stack */ |
| 169 | xmlChar *name; /* Current parsed Node */ |
| 170 | int nameNr; /* Depth of the parsing stack */ |
| 171 | int nameMax; /* Max depth of the parsing stack */ |
| 172 | xmlChar * *nameTab; /* array of nodes */ |
| 173 | |
| 174 | long nbChars; /* number of xmlChar processed */ |
| 175 | long checkIndex; /* used by progressive parsing lookup */ |
| 176 | int keepBlanks; /* ugly but ... */ |
| 177 | int disableSAX; /* SAX callbacks are disabled */ |
| 178 | int inSubset; /* Parsing is in int 1/ext 2 subset */ |
| 179 | xmlChar * intSubName; /* name of subset */ |
| 180 | xmlChar * extSubURI; /* URI of external subset */ |
| 181 | xmlChar * extSubSystem; /* SYSTEM ID of external subset */ |
| 182 | |
| 183 | /* xml:space values */ |
| 184 | int * space; /* Should the parser preserve spaces */ |
| 185 | int spaceNr; /* Depth of the parsing stack */ |
| 186 | int spaceMax; /* Max depth of the parsing stack */ |
| 187 | int * spaceTab; /* array of space infos */ |
| 188 | |
| 189 | int depth; /* to prevent entity substitution loops */ |
| 190 | xmlParserInputPtr entity; /* used to check entities boundaries */ |
| 191 | int charset; /* encoding of the in-memory content |
| 192 | actually an xmlCharEncoding */ |
| 193 | int nodelen; /* Those two fields are there to */ |
| 194 | int nodemem; /* Speed up large node parsing */ |
| 195 | int pedantic; /* signal pedantic warnings */ |
| 196 | void *_private; /* For user data, libxml won't touch it */ |
| 197 | |
| 198 | int loadsubset; /* should the external subset be loaded */ |
| 199 | }; |
| 200 | |
| 201 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 202 | * xmlSAXLocator: |
| 203 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 204 | * a SAX Locator. |
| 205 | */ |
| 206 | typedef struct _xmlSAXLocator xmlSAXLocator; |
| 207 | typedef xmlSAXLocator *xmlSAXLocatorPtr; |
| 208 | struct _xmlSAXLocator { |
| 209 | const xmlChar *(*getPublicId)(void *ctx); |
| 210 | const xmlChar *(*getSystemId)(void *ctx); |
| 211 | int (*getLineNumber)(void *ctx); |
| 212 | int (*getColumnNumber)(void *ctx); |
| 213 | }; |
| 214 | |
| 215 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 216 | * xmlSAXHandler: |
| 217 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 218 | * a SAX handler is bunch of callbacks called by the parser when processing |
| 219 | * of the input generate data or structure informations. |
| 220 | */ |
| 221 | |
| 222 | typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, |
| 223 | const xmlChar *publicId, const xmlChar *systemId); |
| 224 | typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name, |
| 225 | const xmlChar *ExternalID, const xmlChar *SystemID); |
| 226 | typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name, |
| 227 | const xmlChar *ExternalID, const xmlChar *SystemID); |
| 228 | typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, |
| 229 | const xmlChar *name); |
| 230 | typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, |
| 231 | const xmlChar *name); |
| 232 | typedef void (*entityDeclSAXFunc) (void *ctx, |
| 233 | const xmlChar *name, int type, const xmlChar *publicId, |
| 234 | const xmlChar *systemId, xmlChar *content); |
| 235 | typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name, |
| 236 | const xmlChar *publicId, const xmlChar *systemId); |
| 237 | typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem, |
| 238 | const xmlChar *name, int type, int def, |
| 239 | const xmlChar *defaultValue, xmlEnumerationPtr tree); |
| 240 | typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name, |
| 241 | int type, xmlElementContentPtr content); |
| 242 | typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, |
| 243 | const xmlChar *name, const xmlChar *publicId, |
| 244 | const xmlChar *systemId, const xmlChar *notationName); |
| 245 | typedef void (*setDocumentLocatorSAXFunc) (void *ctx, |
| 246 | xmlSAXLocatorPtr loc); |
| 247 | typedef void (*startDocumentSAXFunc) (void *ctx); |
| 248 | typedef void (*endDocumentSAXFunc) (void *ctx); |
| 249 | typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name, |
| 250 | const xmlChar **atts); |
| 251 | typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name); |
| 252 | typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name, |
| 253 | const xmlChar *value); |
| 254 | typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name); |
| 255 | typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch, |
| 256 | int len); |
| 257 | typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, |
| 258 | const xmlChar *ch, int len); |
| 259 | typedef void (*processingInstructionSAXFunc) (void *ctx, |
| 260 | const xmlChar *target, const xmlChar *data); |
| 261 | typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value); |
| 262 | typedef void (*cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len); |
| 263 | typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...); |
| 264 | typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...); |
| 265 | typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...); |
| 266 | typedef int (*isStandaloneSAXFunc) (void *ctx); |
| 267 | typedef int (*hasInternalSubsetSAXFunc) (void *ctx); |
| 268 | typedef int (*hasExternalSubsetSAXFunc) (void *ctx); |
| 269 | |
| 270 | typedef struct _xmlSAXHandler xmlSAXHandler; |
| 271 | typedef xmlSAXHandler *xmlSAXHandlerPtr; |
| 272 | struct _xmlSAXHandler { |
| 273 | internalSubsetSAXFunc internalSubset; |
| 274 | isStandaloneSAXFunc isStandalone; |
| 275 | hasInternalSubsetSAXFunc hasInternalSubset; |
| 276 | hasExternalSubsetSAXFunc hasExternalSubset; |
| 277 | resolveEntitySAXFunc resolveEntity; |
| 278 | getEntitySAXFunc getEntity; |
| 279 | entityDeclSAXFunc entityDecl; |
| 280 | notationDeclSAXFunc notationDecl; |
| 281 | attributeDeclSAXFunc attributeDecl; |
| 282 | elementDeclSAXFunc elementDecl; |
| 283 | unparsedEntityDeclSAXFunc unparsedEntityDecl; |
| 284 | setDocumentLocatorSAXFunc setDocumentLocator; |
| 285 | startDocumentSAXFunc startDocument; |
| 286 | endDocumentSAXFunc endDocument; |
| 287 | startElementSAXFunc startElement; |
| 288 | endElementSAXFunc endElement; |
| 289 | referenceSAXFunc reference; |
| 290 | charactersSAXFunc characters; |
| 291 | ignorableWhitespaceSAXFunc ignorableWhitespace; |
| 292 | processingInstructionSAXFunc processingInstruction; |
| 293 | commentSAXFunc comment; |
| 294 | warningSAXFunc warning; |
| 295 | errorSAXFunc error; |
| 296 | fatalErrorSAXFunc fatalError; |
| 297 | getParameterEntitySAXFunc getParameterEntity; |
| 298 | cdataBlockSAXFunc cdataBlock; |
| 299 | externalSubsetSAXFunc externalSubset; |
| 300 | }; |
| 301 | |
| 302 | /** |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 303 | * xmlExternalEntityLoader: |
| 304 | * @URL: The System ID of the resource requested |
| 305 | * @ID: The Public ID of the resource requested |
| 306 | * @xmlParserCtxtPtr: the XML parser context |
| 307 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 308 | * External entity loaders types |
| 309 | */ |
| 310 | typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL, |
| 311 | const char *ID, |
| 312 | xmlParserCtxtPtr context); |
| 313 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 314 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 315 | * Global variables: just the default SAX interface tables and XML |
| 316 | * version infos. |
| 317 | */ |
| 318 | LIBXML_DLL_IMPORT extern const char *xmlParserVersion; |
| 319 | |
| 320 | LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator; |
| 321 | LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler; |
| 322 | LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler; |
Daniel Veillard | eae522a | 2001-04-23 13:41:34 +0000 | [diff] [blame] | 323 | LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler; |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 324 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 325 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 326 | * entity substitution default behaviour. |
| 327 | */ |
| 328 | |
| 329 | #ifdef VMS |
| 330 | LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultVal; |
| 331 | #define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal |
| 332 | #else |
| 333 | LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; |
| 334 | #endif |
| 335 | LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; |
| 336 | |
| 337 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 338 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 339 | * Init/Cleanup |
| 340 | */ |
| 341 | void xmlInitParser (void); |
| 342 | void xmlCleanupParser (void); |
| 343 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 344 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 345 | * Input functions |
| 346 | */ |
| 347 | int xmlParserInputRead (xmlParserInputPtr in, |
| 348 | int len); |
| 349 | int xmlParserInputGrow (xmlParserInputPtr in, |
| 350 | int len); |
| 351 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 352 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 353 | * xmlChar handling |
| 354 | */ |
| 355 | xmlChar * xmlStrdup (const xmlChar *cur); |
| 356 | xmlChar * xmlStrndup (const xmlChar *cur, |
| 357 | int len); |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 358 | xmlChar * xmlCharStrndup (const char *cur, |
| 359 | int len); |
| 360 | xmlChar * xmlCharStrdup (const char *cur); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 361 | xmlChar * xmlStrsub (const xmlChar *str, |
| 362 | int start, |
| 363 | int len); |
| 364 | const xmlChar * xmlStrchr (const xmlChar *str, |
| 365 | xmlChar val); |
| 366 | const xmlChar * xmlStrstr (const xmlChar *str, |
| 367 | xmlChar *val); |
| 368 | const xmlChar * xmlStrcasestr (const xmlChar *str, |
| 369 | xmlChar *val); |
| 370 | int xmlStrcmp (const xmlChar *str1, |
| 371 | const xmlChar *str2); |
| 372 | int xmlStrncmp (const xmlChar *str1, |
| 373 | const xmlChar *str2, |
| 374 | int len); |
| 375 | int xmlStrcasecmp (const xmlChar *str1, |
| 376 | const xmlChar *str2); |
| 377 | int xmlStrncasecmp (const xmlChar *str1, |
| 378 | const xmlChar *str2, |
| 379 | int len); |
| 380 | int xmlStrEqual (const xmlChar *str1, |
| 381 | const xmlChar *str2); |
| 382 | int xmlStrlen (const xmlChar *str); |
| 383 | xmlChar * xmlStrcat (xmlChar *cur, |
| 384 | const xmlChar *add); |
| 385 | xmlChar * xmlStrncat (xmlChar *cur, |
| 386 | const xmlChar *add, |
| 387 | int len); |
| 388 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 389 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 390 | * Basic parsing Interfaces |
| 391 | */ |
| 392 | xmlDocPtr xmlParseDoc (xmlChar *cur); |
| 393 | xmlDocPtr xmlParseMemory (char *buffer, |
| 394 | int size); |
| 395 | xmlDocPtr xmlParseFile (const char *filename); |
| 396 | int xmlSubstituteEntitiesDefault(int val); |
| 397 | int xmlKeepBlanksDefault (int val); |
| 398 | void xmlStopParser (xmlParserCtxtPtr ctxt); |
| 399 | int xmlPedanticParserDefault(int val); |
| 400 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 401 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 402 | * Recovery mode |
| 403 | */ |
| 404 | xmlDocPtr xmlRecoverDoc (xmlChar *cur); |
| 405 | xmlDocPtr xmlRecoverMemory (char *buffer, |
| 406 | int size); |
| 407 | xmlDocPtr xmlRecoverFile (const char *filename); |
| 408 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 409 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 410 | * Less common routines and SAX interfaces |
| 411 | */ |
| 412 | int xmlParseDocument (xmlParserCtxtPtr ctxt); |
| 413 | int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); |
| 414 | xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax, |
| 415 | xmlChar *cur, |
| 416 | int recovery); |
| 417 | int xmlSAXUserParseFile (xmlSAXHandlerPtr sax, |
| 418 | void *user_data, |
| 419 | const char *filename); |
| 420 | int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, |
| 421 | void *user_data, |
Daniel Veillard | fd7ddca | 2001-05-16 10:57:35 +0000 | [diff] [blame] | 422 | const char *buffer, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 423 | int size); |
| 424 | xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax, |
| 425 | char *buffer, |
| 426 | int size, |
| 427 | int recovery); |
| 428 | xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax, |
| 429 | const char *filename, |
| 430 | int recovery); |
| 431 | xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax, |
| 432 | const char *filename); |
| 433 | xmlDocPtr xmlParseEntity (const char *filename); |
| 434 | xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID, |
| 435 | const xmlChar *SystemID); |
| 436 | xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax, |
| 437 | const xmlChar *ExternalID, |
| 438 | const xmlChar *SystemID); |
| 439 | xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax, |
| 440 | xmlParserInputBufferPtr input, |
| 441 | xmlCharEncoding enc); |
| 442 | int xmlParseBalancedChunkMemory(xmlDocPtr doc, |
| 443 | xmlSAXHandlerPtr sax, |
| 444 | void *user_data, |
| 445 | int depth, |
| 446 | const xmlChar *string, |
| 447 | xmlNodePtr *list); |
| 448 | int xmlParseExternalEntity (xmlDocPtr doc, |
| 449 | xmlSAXHandlerPtr sax, |
| 450 | void *user_data, |
| 451 | int depth, |
| 452 | const xmlChar *URL, |
| 453 | const xmlChar *ID, |
| 454 | xmlNodePtr *list); |
| 455 | int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, |
| 456 | const xmlChar *URL, |
| 457 | const xmlChar *ID, |
| 458 | xmlNodePtr *list); |
| 459 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 460 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 461 | * SAX initialization routines |
| 462 | */ |
| 463 | void xmlDefaultSAXHandlerInit(void); |
| 464 | void htmlDefaultSAXHandlerInit(void); |
| 465 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 466 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 467 | * Parser contexts handling. |
| 468 | */ |
| 469 | void xmlInitParserCtxt (xmlParserCtxtPtr ctxt); |
| 470 | void xmlClearParserCtxt (xmlParserCtxtPtr ctxt); |
| 471 | void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); |
| 472 | void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, |
| 473 | const xmlChar* buffer, |
| 474 | const char* filename); |
| 475 | xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur); |
| 476 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 477 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 478 | * Reading/setting optional parsing features. |
| 479 | */ |
| 480 | |
| 481 | int xmlGetFeaturesList (int *len, |
| 482 | const char **result); |
| 483 | int xmlGetFeature (xmlParserCtxtPtr ctxt, |
| 484 | const char *name, |
| 485 | void *result); |
| 486 | int xmlSetFeature (xmlParserCtxtPtr ctxt, |
| 487 | const char *name, |
| 488 | void *value); |
| 489 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 490 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 491 | * Interfaces for the Push mode |
| 492 | */ |
| 493 | xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, |
| 494 | void *user_data, |
| 495 | const char *chunk, |
| 496 | int size, |
| 497 | const char *filename); |
| 498 | int xmlParseChunk (xmlParserCtxtPtr ctxt, |
| 499 | const char *chunk, |
| 500 | int size, |
| 501 | int terminate); |
| 502 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 503 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 504 | * Special I/O mode |
| 505 | */ |
| 506 | |
| 507 | xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, |
| 508 | void *user_data, |
| 509 | xmlInputReadCallback ioread, |
| 510 | xmlInputCloseCallback ioclose, |
| 511 | void *ioctx, |
| 512 | xmlCharEncoding enc); |
| 513 | |
| 514 | xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt, |
| 515 | xmlParserInputBufferPtr input, |
| 516 | xmlCharEncoding enc); |
| 517 | |
Daniel Veillard | f69bb4b | 2001-05-19 13:24:56 +0000 | [diff] [blame] | 518 | /* |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 519 | * Node infos |
| 520 | */ |
| 521 | const xmlParserNodeInfo* |
| 522 | xmlParserFindNodeInfo (const xmlParserCtxt* ctxt, |
| 523 | const xmlNode* node); |
| 524 | void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); |
| 525 | void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); |
| 526 | unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq, |
| 527 | const xmlNode* node); |
| 528 | void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, |
| 529 | const xmlParserNodeInfo* info); |
| 530 | |
| 531 | /* |
| 532 | * External entities handling actually implemented in xmlIO |
| 533 | */ |
| 534 | |
| 535 | void xmlSetExternalEntityLoader(xmlExternalEntityLoader f); |
| 536 | xmlExternalEntityLoader |
| 537 | xmlGetExternalEntityLoader(void); |
| 538 | xmlParserInputPtr |
| 539 | xmlLoadExternalEntity (const char *URL, |
| 540 | const char *ID, |
| 541 | xmlParserCtxtPtr context); |
| 542 | |
| 543 | #ifdef __cplusplus |
| 544 | } |
| 545 | #endif |
| 546 | |
| 547 | #endif /* __XML_PARSER_H__ */ |
| 548 | |