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