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