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