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