|
1 /* |
|
2 * Summary: the core parser module |
|
3 * Description: Interfaces, constants and types related to the XML parser |
|
4 * |
|
5 * Copy: See Copyright for the status of this software. |
|
6 * |
|
7 * Author: Daniel Veillard |
|
8 * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
9 */ |
|
10 |
|
11 /** @file |
|
12 @publishedAll |
|
13 @released |
|
14 */ |
|
15 |
|
16 #ifndef XML_PARSER_H |
|
17 #define XML_PARSER_H |
|
18 |
|
19 #include <stdapis/libxml2/libxml2_dict.h> |
|
20 #include <stdapis/libxml2/libxml2_hash.h> |
|
21 #include <stdapis/libxml2/libxml2_valid.h> |
|
22 #include <stdapis/libxml2/libxml2_entities.h> |
|
23 #include <stdapis/libxml2/libxml2_encoding.h> |
|
24 |
|
25 //typedef struct _xmlParserInput xmlParserInput; |
|
26 //typedef xmlParserInput *xmlParserInputPtr; |
|
27 |
|
28 #include <stdapis/libxml2/libxml2_xmlio.h> |
|
29 |
|
30 #ifdef __cplusplus |
|
31 extern "C" { |
|
32 #endif |
|
33 |
|
34 /** |
|
35 * XML_DEFAULT_VERSION: |
|
36 * |
|
37 * The default version of XML used: 1.0 |
|
38 */ |
|
39 #define XML_DEFAULT_VERSION "1.0" |
|
40 |
|
41 /** |
|
42 * xmlParserInput: |
|
43 * |
|
44 * An xmlParserInput is an input flow for the XML processor. |
|
45 * Each entity parsed is associated an xmlParserInput (except the |
|
46 * few predefined ones). This is the case both for internal entities |
|
47 * - in which case the flow is already completely in memory - or |
|
48 * external entities - in which case we use the buf structure for |
|
49 * progressive reading and I18N conversions to the internal UTF-8 format. |
|
50 */ |
|
51 |
|
52 /** |
|
53 * xmlParserInputDeallocate: |
|
54 * @param str the string to deallocate |
|
55 * |
|
56 * Callback for freeing some parser input allocations. |
|
57 */ |
|
58 typedef void (* xmlParserInputDeallocate)(xmlChar *str); |
|
59 |
|
60 struct _xmlParserInput { |
|
61 /* Input buffer */ |
|
62 xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ |
|
63 |
|
64 const char *filename; /* The file analyzed, if any */ |
|
65 const char *directory; /* the directory/base of the file */ |
|
66 const xmlChar *base; /* Base of the array to parse */ |
|
67 const xmlChar *cur; /* Current char being parsed */ |
|
68 const xmlChar *end; /* end of the array to parse */ |
|
69 int length; /* length if known */ |
|
70 int line; /* Current line */ |
|
71 int col; /* Current column */ |
|
72 /* |
|
73 * NOTE: consumed is only tested for equality in the parser code, |
|
74 * so even if there is an overflow this should not give troubles |
|
75 * for parsing very large instances. |
|
76 */ |
|
77 unsigned long consumed; /* How many xmlChars already consumed */ |
|
78 xmlParserInputDeallocate free; /* function to deallocate the base */ |
|
79 const xmlChar *encoding; /* the encoding string for entity */ |
|
80 const xmlChar *version; /* the version string for entity */ |
|
81 int standalone; /* Was that entity marked standalone */ |
|
82 int id; /* an unique identifier for the entity */ |
|
83 }; |
|
84 |
|
85 /** |
|
86 * xmlParserNodeInfo: |
|
87 * |
|
88 * The parser can be asked to collect Node informations, i.e. at what |
|
89 * place in the file they were detected. |
|
90 * NOTE: This is off by default and not very well tested. |
|
91 */ |
|
92 typedef struct _xmlParserNodeInfo xmlParserNodeInfo; |
|
93 typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; |
|
94 |
|
95 struct _xmlParserNodeInfo { |
|
96 const struct _xmlNode* node; |
|
97 /* Position & line # that text that created the node begins & ends on */ |
|
98 unsigned long begin_pos; |
|
99 unsigned long begin_line; |
|
100 unsigned long end_pos; |
|
101 unsigned long end_line; |
|
102 }; |
|
103 |
|
104 typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; |
|
105 typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; |
|
106 struct _xmlParserNodeInfoSeq { |
|
107 unsigned long maximum; |
|
108 unsigned long length; |
|
109 xmlParserNodeInfo* buffer; |
|
110 }; |
|
111 |
|
112 /** |
|
113 * xmlParserInputState: |
|
114 * |
|
115 * The parser is now working also as a state based parser. |
|
116 * The recursive one use the state info for entities processing. |
|
117 */ |
|
118 typedef enum { |
|
119 XML_PARSER_EOF = -1, /* nothing is to be parsed */ |
|
120 XML_PARSER_START = 0, /* nothing has been parsed */ |
|
121 XML_PARSER_MISC, /* Misc* before int subset */ |
|
122 XML_PARSER_PI, /* Within a processing instruction */ |
|
123 XML_PARSER_DTD, /* within some DTD content */ |
|
124 XML_PARSER_PROLOG, /* Misc* after internal subset */ |
|
125 XML_PARSER_COMMENT, /* within a comment */ |
|
126 XML_PARSER_START_TAG, /* within a start tag */ |
|
127 XML_PARSER_CONTENT, /* within the content */ |
|
128 XML_PARSER_CDATA_SECTION, /* within a CDATA section */ |
|
129 XML_PARSER_END_TAG, /* within a closing tag */ |
|
130 XML_PARSER_ENTITY_DECL, /* within an entity declaration */ |
|
131 XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ |
|
132 XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ |
|
133 XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ |
|
134 XML_PARSER_EPILOG, /* the Misc* after the last end tag */ |
|
135 XML_PARSER_IGNORE, /* within an IGNORED section */ |
|
136 XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ |
|
137 } xmlParserInputState; |
|
138 |
|
139 /** |
|
140 * XML_DETECT_IDS: |
|
141 * |
|
142 * Bit in the loadsubset context field to tell to do ID/REFs lookups. |
|
143 * Use it to initialize xmlLoadExtDtdDefaultValue. |
|
144 */ |
|
145 #define XML_DETECT_IDS 2 |
|
146 |
|
147 /** |
|
148 * XML_COMPLETE_ATTRS: |
|
149 * |
|
150 * Bit in the loadsubset context field to tell to do complete the |
|
151 * elements attributes lists with the ones defaulted from the DTDs. |
|
152 * Use it to initialize xmlLoadExtDtdDefaultValue. |
|
153 */ |
|
154 #define XML_COMPLETE_ATTRS 4 |
|
155 |
|
156 /** |
|
157 * XML_SKIP_IDS: |
|
158 * |
|
159 * Bit in the loadsubset context field to tell to not do ID/REFs registration. |
|
160 * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. |
|
161 */ |
|
162 #define XML_SKIP_IDS 8 |
|
163 |
|
164 /** |
|
165 * xmlParserCtxt: |
|
166 * |
|
167 * The parser context. |
|
168 * NOTE This doesn't completely define the parser state, the (current ?) |
|
169 * design of the parser uses recursive function calls since this allow |
|
170 * and easy mapping from the production rules of the specification |
|
171 * to the actual code. The drawback is that the actual function call |
|
172 * also reflect the parser state. However most of the parsing routines |
|
173 * takes as the only argument the parser context pointer, so migrating |
|
174 * to a state based parser for progressive parsing shouldn't be too hard. |
|
175 */ |
|
176 struct _xmlParserCtxt { |
|
177 struct _xmlSAXHandler *sax; /* The SAX handler */ |
|
178 void* userData; /* For SAX interface only, used by DOM build */ |
|
179 xmlDocPtr myDoc; /* the document being built */ |
|
180 int wellFormed; /* is the document well formed */ |
|
181 int replaceEntities; /* shall we replace entities ? */ |
|
182 const xmlChar* encoding; /* the declared encoding, if any */ |
|
183 int standalone; /* standalone document */ |
|
184 int html; /* an HTML(1)/Docbook(2) document */ |
|
185 |
|
186 /* Input stream stack */ |
|
187 xmlParserInputPtr input; /* Current input stream */ |
|
188 int inputNr; /* Number of current input streams */ |
|
189 int inputMax; /* Max number of input streams */ |
|
190 xmlParserInputPtr* inputTab; /* stack of inputs */ |
|
191 |
|
192 #ifdef LIBXML_ENABLE_GS_CACHING_IN_CTXT |
|
193 // Note: location is chosen trying to get GS pointer into proximity to |
|
194 // the data often referred to (to avoid cache misses) |
|
195 //XMLENGINE: NEW CODE |
|
196 void* cachedGs; /* cached GS pointer */ |
|
197 #endif |
|
198 /* Node analysis stack only used for DOM building */ |
|
199 xmlNodePtr node; /* Current parsed Node */ |
|
200 int nodeNr; /* Depth of the parsing stack */ |
|
201 int nodeMax; /* Max depth of the parsing stack */ |
|
202 xmlNodePtr* nodeTab; /* array of nodes */ |
|
203 |
|
204 int errNo; /* error code */ |
|
205 |
|
206 int hasExternalSubset; /* reference and external subset */ |
|
207 int hasPErefs; /* the internal subset has PE refs */ |
|
208 int external; /* are we parsing an external entity */ |
|
209 |
|
210 int valid; /* is the document valid */ |
|
211 int validate; /* shall we try to validate ? */ |
|
212 |
|
213 xmlParserInputState instate; /* current type of input */ |
|
214 int token; /* next char look-ahead */ |
|
215 |
|
216 char* directory; /* the data directory */ |
|
217 |
|
218 /* Node name stack */ |
|
219 const xmlChar* name; /* Current parsed Node */ |
|
220 int nameNr; /* Depth of the parsing stack */ |
|
221 int nameMax; /* Max depth of the parsing stack */ |
|
222 const xmlChar** nameTab; /* array of nodes */ |
|
223 |
|
224 long nbChars; /* number of xmlChar processed */ |
|
225 long checkIndex; /* used by progressive parsing lookup */ |
|
226 int keepBlanks; /* ugly but ... */ |
|
227 int disableSAX; /* SAX callbacks are disabled */ |
|
228 int inSubset; /* Parsing is in int 1/ext 2 subset */ |
|
229 int stackLowThreshold; /* minimum amount of thread's stack left */ |
|
230 |
|
231 /* xml:space values */ |
|
232 int* space; /* Should the parser preserve spaces */ |
|
233 int spaceNr; /* Depth of the parsing stack */ |
|
234 int spaceMax; /* Max depth of the parsing stack */ |
|
235 int* spaceTab; /* array of space infos */ |
|
236 |
|
237 int depth; /* to prevent entity substitution loops */ |
|
238 int charset; /* encoding of the in-memory content |
|
239 actually an xmlCharEncoding */ |
|
240 int nodelen; /* Those two fields are there to */ |
|
241 int nodemem; /* Speed up large node parsing */ |
|
242 int pedantic; /* signal pedantic warnings */ |
|
243 void* _private; /* For user data, libxml won't touch it */ |
|
244 |
|
245 int loadsubset; /* should the external subset be loaded */ |
|
246 |
|
247 void* catalogs; /* document's own catalog */ |
|
248 int progressive; /* is this a progressive parsing */ |
|
249 xmlDictPtr dict; /* dictionnary for the parser */ |
|
250 const xmlChar** atts; /* array for the attributes callbacks */ |
|
251 int maxatts; /* the size of the array */ |
|
252 |
|
253 /* |
|
254 * pre-interned strings |
|
255 */ |
|
256 const xmlChar* str_xml; |
|
257 const xmlChar* str_xmlns; |
|
258 const xmlChar* str_xml_ns; |
|
259 |
|
260 /* |
|
261 * Everything below is used only by the new SAX mode |
|
262 */ |
|
263 int sax2; /* operating in the new SAX mode */ |
|
264 int nsNr; /* the number of inherited namespaces */ |
|
265 int nsMax; /* the size of the arrays */ |
|
266 const xmlChar** nsTab; /* the array of prefix/namespace name */ |
|
267 int* attallocs; /* which attribute were allocated */ |
|
268 void** pushTab; /* array of data for push */ |
|
269 xmlHashTablePtr attsDefault; /* defaulted attributes if any */ |
|
270 xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ |
|
271 int nsWellFormed; /* is the document XML Nanespace okay */ |
|
272 int options; /* Extra options */ |
|
273 |
|
274 /* |
|
275 * Those fields are needed only for streaming parsing so far |
|
276 */ |
|
277 int dictNames; /* Use dictionary names for the tree */ |
|
278 int freeElemsNr; /* number of freed element nodes */ |
|
279 xmlNodePtr freeElems; /* List of freed element nodes */ |
|
280 int freeAttrsNr; /* number of freed attributes nodes */ |
|
281 xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ |
|
282 |
|
283 /* |
|
284 * the complete error informations for the last error. |
|
285 */ |
|
286 xmlError lastError; |
|
287 |
|
288 // XMLENGINE: BEGIN NEW CODE - lastNsNr attribute in parser context |
|
289 int lastNsNr; /* temporarily contains number of new namespaces in element*/ |
|
290 // XMLENGINE: END NEW CODE |
|
291 |
|
292 //== Fields less used in libxml2, so put in the end of the structure (offset is > 255) |
|
293 // |
|
294 // Note: these fields were move from their original place in the structure |
|
295 // |
|
296 const xmlChar* version; /* the XML version string */ |
|
297 const xmlChar* intSubName; /* name of subset */ |
|
298 xmlChar* extSubURI; /* URI of external subset */ |
|
299 xmlChar* extSubSystem; /* SYSTEM ID of external subset */ |
|
300 int recovery; /* run in recovery mode */ |
|
301 int docdict; /* use strings from dict to build tree */ |
|
302 xmlParserInputPtr entity; /* used to check entities boundaries */ |
|
303 |
|
304 xmlValidCtxt vctxt; /* The validity context */ |
|
305 |
|
306 //== Fields below are likely to stay disabled forever in XML ENGINE |
|
307 |
|
308 #ifdef LIBXML_ENABLE_NODE_LINEINFO |
|
309 int linenumbers; /* set line number in element content */ |
|
310 #endif |
|
311 |
|
312 #ifdef XMLENGINE_ENABLE_PARSER_RECORD_INFO |
|
313 int record_info; /* Whether node info should be kept */ |
|
314 xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ |
|
315 #endif |
|
316 |
|
317 |
|
318 }; // struct _xmlParserCtxt |
|
319 |
|
320 |
|
321 |
|
322 /** |
|
323 * xmlSAXLocator: |
|
324 * |
|
325 * A SAX Locator. |
|
326 */ |
|
327 struct _xmlSAXLocator { |
|
328 const xmlChar* (*getPublicId)(void* ctx); |
|
329 const xmlChar* (*getSystemId)(void* ctx); |
|
330 int (*getLineNumber)(void* ctx); |
|
331 int (*getColumnNumber)(void* ctx); |
|
332 }; |
|
333 |
|
334 /** |
|
335 * xmlSAXHandler: |
|
336 * |
|
337 * A SAX handler is bunch of callbacks called by the parser when processing |
|
338 * of the input generate data or structure informations. |
|
339 */ |
|
340 |
|
341 /** |
|
342 * resolveEntitySAXFunc: |
|
343 * @param ctx the user data (XML parser context) |
|
344 * @param publicId The public ID of the entity |
|
345 * @param systemId The system ID of the entity |
|
346 * |
|
347 * Callback: |
|
348 * The entity loader, to control the loading of external entities, |
|
349 * the application can either: |
|
350 * - override this resolveEntity() callback in the SAX block |
|
351 * - or better use the xmlSetExternalEntityLoader() function to |
|
352 * set up it's own entity resolution routine |
|
353 * |
|
354 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. |
|
355 */ |
|
356 typedef xmlParserInputPtr (*resolveEntitySAXFunc) ( |
|
357 void* ctx, |
|
358 const xmlChar* publicId, |
|
359 const xmlChar* systemId); |
|
360 /** |
|
361 * internalSubsetSAXFunc: |
|
362 * @param ctx the user data (XML parser context) |
|
363 * @param name the root element name |
|
364 * @param ExternalID the external ID |
|
365 * @param SystemID the SYSTEM ID (e.g. filename or URL) |
|
366 * |
|
367 * Callback on internal subset declaration. |
|
368 */ |
|
369 typedef void (*internalSubsetSAXFunc) ( |
|
370 void* ctx, |
|
371 const xmlChar* name, |
|
372 const xmlChar* ExternalID, |
|
373 const xmlChar* SystemID); |
|
374 /** |
|
375 * externalSubsetSAXFunc: |
|
376 * @param ctx the user data (XML parser context) |
|
377 * @param name the root element name |
|
378 * @param ExternalID the external ID |
|
379 * @param SystemID the SYSTEM ID (e.g. filename or URL) |
|
380 * |
|
381 * Callback on external subset declaration. |
|
382 */ |
|
383 typedef void (*externalSubsetSAXFunc) ( |
|
384 void* ctx, |
|
385 const xmlChar* name, |
|
386 const xmlChar* ExternalID, |
|
387 const xmlChar* SystemID); |
|
388 /** |
|
389 * getEntitySAXFunc: |
|
390 * @param ctx the user data (XML parser context) |
|
391 * @param name The entity name |
|
392 * |
|
393 * Get an entity by name. |
|
394 * |
|
395 * Returns the xmlEntityPtr if found. |
|
396 */ |
|
397 typedef xmlEntityPtr (*getEntitySAXFunc) ( |
|
398 void* ctx, |
|
399 const xmlChar* name); |
|
400 /** |
|
401 * getParameterEntitySAXFunc: |
|
402 * @param ctx the user data (XML parser context) |
|
403 * @param name The entity name |
|
404 * |
|
405 * Get a parameter entity by name. |
|
406 * |
|
407 * Returns the xmlEntityPtr if found. |
|
408 */ |
|
409 typedef xmlEntityPtr (*getParameterEntitySAXFunc) ( |
|
410 void* ctx, |
|
411 const xmlChar* name); |
|
412 /** |
|
413 * entityDeclSAXFunc: |
|
414 * @param ctx the user data (XML parser context) |
|
415 * @param name the entity name |
|
416 * @param type the entity type |
|
417 * @param publicId The public ID of the entity |
|
418 * @param systemId The system ID of the entity |
|
419 * @param content the entity value (without processing). |
|
420 * |
|
421 * An entity definition has been parsed. |
|
422 */ |
|
423 typedef void (*entityDeclSAXFunc) ( |
|
424 void* ctx, |
|
425 const xmlChar* name, |
|
426 int type, |
|
427 const xmlChar* publicId, |
|
428 const xmlChar* systemId, |
|
429 xmlChar* content); |
|
430 /** |
|
431 * notationDeclSAXFunc: |
|
432 * @param ctx the user data (XML parser context) |
|
433 * @param name The name of the notation |
|
434 * @param publicId The public ID of the entity |
|
435 * @param systemId The system ID of the entity |
|
436 * |
|
437 * What to do when a notation declaration has been parsed. |
|
438 */ |
|
439 typedef void (*notationDeclSAXFunc)( |
|
440 void* ctx, |
|
441 const xmlChar* name, |
|
442 const xmlChar* publicId, |
|
443 const xmlChar* systemId); |
|
444 /** |
|
445 * attributeDeclSAXFunc: |
|
446 * @param ctx the user data (XML parser context) |
|
447 * @param elem the name of the element |
|
448 * @param fullname the attribute name |
|
449 * @param type the attribute type |
|
450 * @param def the type of default value |
|
451 * @param defaultValue the attribute default value |
|
452 * @param tree the tree of enumerated value set |
|
453 * |
|
454 * An attribute definition has been parsed. |
|
455 */ |
|
456 typedef void (*attributeDeclSAXFunc)( |
|
457 void* ctx, |
|
458 const xmlChar* elem, |
|
459 const xmlChar* fullname, |
|
460 int type, |
|
461 int def, |
|
462 const xmlChar* defaultValue, |
|
463 xmlEnumerationPtr tree); |
|
464 /** |
|
465 * elementDeclSAXFunc: |
|
466 * @param ctx the user data (XML parser context) |
|
467 * @param name the element name |
|
468 * @param type the element type |
|
469 * @param content the element value tree |
|
470 * |
|
471 * An element definition has been parsed. |
|
472 */ |
|
473 typedef void (*elementDeclSAXFunc)( |
|
474 void* ctx, |
|
475 const xmlChar* name, |
|
476 int type, |
|
477 xmlElementContentPtr content); |
|
478 /** |
|
479 * unparsedEntityDeclSAXFunc: |
|
480 * @param ctx the user data (XML parser context) |
|
481 * @param name The name of the entity |
|
482 * @param publicId The public ID of the entity |
|
483 * @param systemId The system ID of the entity |
|
484 * @param notationName the name of the notation |
|
485 * |
|
486 * What to do when an unparsed entity declaration is parsed. |
|
487 */ |
|
488 typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, |
|
489 const xmlChar *name, |
|
490 const xmlChar *publicId, |
|
491 const xmlChar *systemId, |
|
492 const xmlChar *notationName); |
|
493 /** |
|
494 * setDocumentLocatorSAXFunc: |
|
495 * @param ctx the user data (XML parser context) |
|
496 * @param loc A SAX Locator |
|
497 * |
|
498 * Receive the document locator at startup, actually xmlDefaultSAXLocator. |
|
499 * Everything is available on the context, so this is useless in our case. |
|
500 */ |
|
501 typedef void (*setDocumentLocatorSAXFunc) (void *ctx, |
|
502 xmlSAXLocatorPtr loc); |
|
503 /** |
|
504 * startDocumentSAXFunc: |
|
505 * @param ctx the user data (XML parser context) |
|
506 * |
|
507 * Called when the document start being processed. |
|
508 */ |
|
509 typedef void (*startDocumentSAXFunc) (void *ctx); |
|
510 /** |
|
511 * endDocumentSAXFunc: |
|
512 * @param ctx the user data (XML parser context) |
|
513 * |
|
514 * Called when the document end has been detected. |
|
515 */ |
|
516 typedef void (*endDocumentSAXFunc) (void *ctx); |
|
517 /** |
|
518 * startElementSAXFunc: |
|
519 * @param ctx the user data (XML parser context) |
|
520 * @param name The element name, including namespace prefix |
|
521 * @param atts An array of name/value attributes pairs, NULL terminated |
|
522 * |
|
523 * Called when an opening tag has been processed. |
|
524 */ |
|
525 typedef void (*startElementSAXFunc) (void *ctx, |
|
526 const xmlChar *name, |
|
527 const xmlChar **atts); |
|
528 /** |
|
529 * endElementSAXFunc: |
|
530 * @param ctx the user data (XML parser context) |
|
531 * @param name The element name |
|
532 * |
|
533 * Called when the end of an element has been detected. |
|
534 */ |
|
535 typedef void (*endElementSAXFunc) (void *ctx, |
|
536 const xmlChar *name); |
|
537 /** |
|
538 * attributeSAXFunc: |
|
539 * @param ctx the user data (XML parser context) |
|
540 * @param name The attribute name, including namespace prefix |
|
541 * @param value The attribute value |
|
542 * |
|
543 * Handle an attribute that has been read by the parser. |
|
544 * The default handling is to convert the attribute into an |
|
545 * DOM subtree and past it in a new xmlAttr element added to |
|
546 * the element. |
|
547 */ |
|
548 typedef void (*attributeSAXFunc) (void *ctx, |
|
549 const xmlChar *name, |
|
550 const xmlChar *value); |
|
551 /** |
|
552 * referenceSAXFunc: |
|
553 * @param ctx the user data (XML parser context) |
|
554 * @param name The entity name |
|
555 * |
|
556 * Called when an entity reference is detected. |
|
557 */ |
|
558 typedef void (*referenceSAXFunc) (void *ctx, |
|
559 const xmlChar *name); |
|
560 /** |
|
561 * charactersSAXFunc: |
|
562 * @param ctx the user data (XML parser context) |
|
563 * @param ch a xmlChar string |
|
564 * @param len the number of xmlChar |
|
565 * |
|
566 * Receiving some chars from the parser. |
|
567 */ |
|
568 typedef void (*charactersSAXFunc) (void *ctx, |
|
569 const xmlChar *ch, |
|
570 int len); |
|
571 /** |
|
572 * ignorableWhitespaceSAXFunc: |
|
573 * @param ctx the user data (XML parser context) |
|
574 * @param ch a xmlChar string |
|
575 * @param len the number of xmlChar |
|
576 * |
|
577 * Receiving some ignorable whitespaces from the parser. |
|
578 * UNUSED: by default the DOM building will use characters. |
|
579 */ |
|
580 typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, |
|
581 const xmlChar *ch, |
|
582 int len); |
|
583 /** |
|
584 * processingInstructionSAXFunc: |
|
585 * @param ctx the user data (XML parser context) |
|
586 * @param target the target name |
|
587 * @param data the PI data's |
|
588 * |
|
589 * A processing instruction has been parsed. |
|
590 */ |
|
591 typedef void (*processingInstructionSAXFunc) (void *ctx, |
|
592 const xmlChar *target, |
|
593 const xmlChar *data); |
|
594 /** |
|
595 * commentSAXFunc: |
|
596 * @param ctx the user data (XML parser context) |
|
597 * @param value the comment content |
|
598 * |
|
599 * A comment has been parsed. |
|
600 */ |
|
601 typedef void (*commentSAXFunc) (void *ctx, |
|
602 const xmlChar *value); |
|
603 /** |
|
604 * cdataBlockSAXFunc: |
|
605 * @param ctx the user data (XML parser context) |
|
606 * @param value The pcdata content |
|
607 * @param len the block length |
|
608 * |
|
609 * Called when a pcdata block has been parsed. |
|
610 */ |
|
611 typedef void (*cdataBlockSAXFunc) ( |
|
612 void *ctx, |
|
613 const xmlChar *value, |
|
614 int len); |
|
615 /** |
|
616 * warningSAXFunc: |
|
617 * @param ctx an XML parser context |
|
618 * @param msg the message to display/transmit |
|
619 * @param # extra parameters for the message display |
|
620 * |
|
621 * Display and format a warning messages, callback. |
|
622 */ |
|
623 typedef void (*warningSAXFunc) (void *ctx, |
|
624 const char *msg, ...); |
|
625 /** |
|
626 * errorSAXFunc: |
|
627 * @param ctx an XML parser context |
|
628 * @param msg the message to display/transmit |
|
629 * @param # extra parameters for the message display |
|
630 * |
|
631 * Display and format an error messages, callback. |
|
632 */ |
|
633 typedef void (*errorSAXFunc) (void *ctx, |
|
634 const char *msg, ...); |
|
635 /** |
|
636 * fatalErrorSAXFunc: |
|
637 * @param ctx an XML parser context |
|
638 * @param msg the message to display/transmit |
|
639 * @param # extra parameters for the message display |
|
640 * |
|
641 * Display and format fatal error messages, callback. |
|
642 * Note: so far fatalError() SAX callbacks are not used, error() |
|
643 * get all the callbacks for errors. |
|
644 */ |
|
645 typedef void (*fatalErrorSAXFunc) (void *ctx, |
|
646 const char *msg, ...); |
|
647 /** |
|
648 * isStandaloneSAXFunc: |
|
649 * @param ctx the user data (XML parser context) |
|
650 * |
|
651 * Is this document tagged standalone? |
|
652 * |
|
653 * Returns 1 if true |
|
654 */ |
|
655 typedef int (*isStandaloneSAXFunc) (void *ctx); |
|
656 /** |
|
657 * hasInternalSubsetSAXFunc: |
|
658 * @param ctx the user data (XML parser context) |
|
659 * |
|
660 * Does this document has an internal subset. |
|
661 * |
|
662 * Returns 1 if true |
|
663 */ |
|
664 typedef int (*hasInternalSubsetSAXFunc) (void *ctx); |
|
665 |
|
666 /** |
|
667 * hasExternalSubsetSAXFunc: |
|
668 * @param ctx the user data (XML parser context) |
|
669 * |
|
670 * Does this document has an external subset? |
|
671 * |
|
672 * Returns 1 if true |
|
673 */ |
|
674 typedef int (*hasExternalSubsetSAXFunc) (void *ctx); |
|
675 |
|
676 /************************************************************************ |
|
677 * * |
|
678 * The SAX version 2 API extensions * |
|
679 * * |
|
680 ************************************************************************/ |
|
681 /** |
|
682 * XML_SAX2_MAGIC: |
|
683 * |
|
684 * Special constant found in SAX2 blocks initialized fields |
|
685 */ |
|
686 #define XML_SAX2_MAGIC 0xDEEDBEAF |
|
687 |
|
688 /** |
|
689 * startElementNsSAX2Func: |
|
690 * @param ctx the user data (XML parser context) |
|
691 * @param localname the local name of the element |
|
692 * @param prefix the element namespace prefix if available |
|
693 * @param URI the element namespace name if available |
|
694 * @param nb_namespaces number of namespace definitions on that node |
|
695 * @param namespaces pointer to the array of prefix/URI pairs namespace definitions |
|
696 * @param nb_attributes the number of attributes on that node |
|
697 * @param nb_defaulted the number of defaulted attributes. The defaulted |
|
698 * ones are at the end of the array |
|
699 * @param attributes pointer to the array of (localname/prefix/URI/value/end) |
|
700 * attribute values. |
|
701 * |
|
702 * SAX2 callback when an element start has been detected by the parser. |
|
703 * It provides the namespace informations for the element, as well as |
|
704 * the new namespace declarations on the element. |
|
705 */ |
|
706 |
|
707 typedef void (*startElementNsSAX2Func) (void *ctx, |
|
708 const xmlChar *localname, |
|
709 const xmlChar *prefix, |
|
710 const xmlChar *URI, |
|
711 int nb_namespaces, |
|
712 const xmlChar **namespaces, |
|
713 int nb_attributes, |
|
714 int nb_defaulted, |
|
715 const xmlChar **attributes); |
|
716 |
|
717 /** |
|
718 * endElementNsSAX2Func: |
|
719 * @param ctx the user data (XML parser context) |
|
720 * @param localname the local name of the element |
|
721 * @param prefix the element namespace prefix if available |
|
722 * @param URI the element namespace name if available |
|
723 * |
|
724 * SAX2 callback when an element end has been detected by the parser. |
|
725 * It provides the namespace informations for the element. |
|
726 */ |
|
727 |
|
728 typedef void (*endElementNsSAX2Func) (void *ctx, |
|
729 const xmlChar *localname, |
|
730 const xmlChar *prefix, |
|
731 const xmlChar *URI); |
|
732 |
|
733 // XE: BEGIN new code |
|
734 /** |
|
735 * startPrefixMappingSAX2Func: |
|
736 * @param ctx the user data (XML parser context) |
|
737 * @param prefix the element namespace prefix if available, NULL if default namespace |
|
738 * @param URI the element namespace name if available |
|
739 * |
|
740 * SAX2 callback when namespace prefix mapping is done. |
|
741 */ |
|
742 |
|
743 typedef void (*startPrefixMappingSAX2Func) (void *ctx, |
|
744 const xmlChar *prefix, |
|
745 const xmlChar *URI); |
|
746 |
|
747 |
|
748 /** |
|
749 * endPrefixMappingSAX2Func: |
|
750 * @param ctx the user data (XML parser context) |
|
751 * @param prefix the element namespace prefix if available, NULL otherwise |
|
752 * |
|
753 * SAX2 callback when namespace prefix mapping is getting out of scope. |
|
754 */ |
|
755 |
|
756 typedef void (*endPrefixMappingSAX2Func) (void *ctx, |
|
757 const xmlChar *prefix); |
|
758 |
|
759 // XE: END new code |
|
760 |
|
761 struct _xmlSAXHandler { |
|
762 internalSubsetSAXFunc internalSubset; |
|
763 isStandaloneSAXFunc isStandalone; |
|
764 hasInternalSubsetSAXFunc hasInternalSubset; |
|
765 hasExternalSubsetSAXFunc hasExternalSubset; |
|
766 resolveEntitySAXFunc resolveEntity; |
|
767 getEntitySAXFunc getEntity; |
|
768 entityDeclSAXFunc entityDecl; |
|
769 notationDeclSAXFunc notationDecl; |
|
770 attributeDeclSAXFunc attributeDecl; |
|
771 elementDeclSAXFunc elementDecl; |
|
772 unparsedEntityDeclSAXFunc unparsedEntityDecl; |
|
773 setDocumentLocatorSAXFunc setDocumentLocator; |
|
774 startDocumentSAXFunc startDocument; |
|
775 endDocumentSAXFunc endDocument; |
|
776 startElementSAXFunc startElement; |
|
777 endElementSAXFunc endElement; |
|
778 referenceSAXFunc reference; |
|
779 charactersSAXFunc characters; |
|
780 ignorableWhitespaceSAXFunc ignorableWhitespace; |
|
781 processingInstructionSAXFunc processingInstruction; |
|
782 commentSAXFunc comment; |
|
783 warningSAXFunc warning; |
|
784 errorSAXFunc error; |
|
785 fatalErrorSAXFunc fatalError; /* unused - error() get all the errors */ |
|
786 getParameterEntitySAXFunc getParameterEntity; |
|
787 cdataBlockSAXFunc cdataBlock; |
|
788 externalSubsetSAXFunc externalSubset; |
|
789 unsigned int initialized; |
|
790 /* The following fields are extensions available only on version 2 */ |
|
791 void *_private; |
|
792 startElementNsSAX2Func startElementNs; |
|
793 endElementNsSAX2Func endElementNs; |
|
794 xmlStructuredErrorFunc serror; |
|
795 startPrefixMappingSAX2Func startPrefixMapping; |
|
796 endPrefixMappingSAX2Func endPrefixMapping; |
|
797 }; |
|
798 |
|
799 /* |
|
800 * SAX Version 1 |
|
801 */ |
|
802 typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; |
|
803 typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; |
|
804 struct _xmlSAXHandlerV1 { |
|
805 internalSubsetSAXFunc internalSubset; |
|
806 isStandaloneSAXFunc isStandalone; |
|
807 hasInternalSubsetSAXFunc hasInternalSubset; |
|
808 hasExternalSubsetSAXFunc hasExternalSubset; |
|
809 resolveEntitySAXFunc resolveEntity; |
|
810 getEntitySAXFunc getEntity; |
|
811 entityDeclSAXFunc entityDecl; |
|
812 notationDeclSAXFunc notationDecl; |
|
813 attributeDeclSAXFunc attributeDecl; |
|
814 elementDeclSAXFunc elementDecl; |
|
815 unparsedEntityDeclSAXFunc unparsedEntityDecl; |
|
816 setDocumentLocatorSAXFunc setDocumentLocator; |
|
817 startDocumentSAXFunc startDocument; |
|
818 endDocumentSAXFunc endDocument; |
|
819 startElementSAXFunc startElement; |
|
820 endElementSAXFunc endElement; |
|
821 referenceSAXFunc reference; |
|
822 charactersSAXFunc characters; |
|
823 ignorableWhitespaceSAXFunc ignorableWhitespace; |
|
824 processingInstructionSAXFunc processingInstruction; |
|
825 commentSAXFunc comment; |
|
826 warningSAXFunc warning; |
|
827 errorSAXFunc error; |
|
828 fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ |
|
829 getParameterEntitySAXFunc getParameterEntity; |
|
830 cdataBlockSAXFunc cdataBlock; |
|
831 externalSubsetSAXFunc externalSubset; |
|
832 unsigned int initialized; |
|
833 }; |
|
834 |
|
835 |
|
836 /** |
|
837 * xmlExternalEntityLoader: |
|
838 * @param URL The System ID of the resource requested |
|
839 * @param ID The Public ID of the resource requested |
|
840 * @param context the XML parser context |
|
841 * |
|
842 * External entity loaders types. |
|
843 * |
|
844 * Returns the entity input parser. |
|
845 */ |
|
846 typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, |
|
847 const char *ID, |
|
848 xmlParserCtxtPtr context); |
|
849 |
|
850 #ifdef __cplusplus |
|
851 } |
|
852 #endif |
|
853 |
|
854 #ifdef __cplusplus |
|
855 extern "C" { |
|
856 #endif |
|
857 |
|
858 |
|
859 /* |
|
860 * Init/Cleanup |
|
861 */ |
|
862 XMLPUBFUN void XMLCALL |
|
863 xmlInitParser (void); |
|
864 XMLPUBFUN void XMLCALL |
|
865 xmlCleanupParser (void); |
|
866 |
|
867 /* |
|
868 * Input functions |
|
869 */ |
|
870 XMLPUBFUN int XMLCALL |
|
871 xmlParserInputRead (xmlParserInputPtr in, |
|
872 int len); |
|
873 XMLPUBFUN int XMLCALL |
|
874 xmlParserInputGrow (xmlParserInputPtr in, |
|
875 int len); |
|
876 |
|
877 /* |
|
878 * Basic parsing Interfaces |
|
879 */ |
|
880 XMLPUBFUN xmlDocPtr XMLCALL |
|
881 xmlParseDoc (xmlChar *cur); |
|
882 XMLPUBFUN xmlDocPtr XMLCALL |
|
883 xmlParseMemory (const char *buffer, |
|
884 int size); |
|
885 XMLPUBFUN xmlDocPtr XMLCALL |
|
886 xmlParseFile (const char *filename); |
|
887 XMLPUBFUN int XMLCALL |
|
888 xmlSubstituteEntitiesDefault(int val); |
|
889 |
|
890 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
891 XMLPUBFUN int XMLCALL xmlKeepBlanksDefault (int val); |
|
892 XMLPUBFUN int XMLCALL xmlLineNumbersDefault (int val); |
|
893 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
894 |
|
895 XMLPUBFUN void XMLCALL |
|
896 xmlStopParser (xmlParserCtxtPtr ctxt); |
|
897 XMLPUBFUN int XMLCALL |
|
898 xmlPedanticParserDefault(int val); |
|
899 |
|
900 /* |
|
901 * Recovery mode |
|
902 */ |
|
903 XMLPUBFUN xmlDocPtr XMLCALL |
|
904 xmlRecoverDoc (xmlChar *cur); |
|
905 XMLPUBFUN xmlDocPtr XMLCALL |
|
906 xmlRecoverMemory (const char *buffer, int size); |
|
907 XMLPUBFUN xmlDocPtr XMLCALL |
|
908 xmlRecoverFile (const char *filename); |
|
909 |
|
910 /* |
|
911 * Less common routines and SAX interfaces |
|
912 */ |
|
913 XMLPUBFUN int XMLCALL |
|
914 xmlParseDocument (xmlParserCtxtPtr ctxt); |
|
915 XMLPUBFUN int XMLCALL |
|
916 xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt); |
|
917 XMLPUBFUN xmlDocPtr XMLCALL |
|
918 xmlSAXParseDoc (xmlSAXHandlerPtr sax, |
|
919 xmlChar *cur, |
|
920 int length, |
|
921 int recovery, |
|
922 int* /* out if !NULL */ errorCode); |
|
923 XMLPUBFUN int XMLCALL |
|
924 xmlSAXUserParseFile (xmlSAXHandlerPtr sax, |
|
925 void *user_data, |
|
926 const char *filename); |
|
927 XMLPUBFUN int XMLCALL |
|
928 xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, |
|
929 void *user_data, |
|
930 const char *buffer, |
|
931 int size); |
|
932 XMLPUBFUN xmlDocPtr XMLCALL |
|
933 xmlSAXParseMemory (xmlSAXHandlerPtr sax, |
|
934 const char *buffer, |
|
935 int size, |
|
936 int recovery); |
|
937 XMLPUBFUN xmlDocPtr XMLCALL |
|
938 xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, |
|
939 const char *buffer, |
|
940 int size, |
|
941 int recovery, |
|
942 void *data); |
|
943 XMLPUBFUN xmlDocPtr XMLCALL |
|
944 xmlSAXParseFile (xmlSAXHandlerPtr sax, |
|
945 const char *filename, |
|
946 int recovery); |
|
947 XMLPUBFUN xmlDocPtr XMLCALL |
|
948 xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, |
|
949 const char *filename, |
|
950 int recovery, |
|
951 void *data); |
|
952 XMLPUBFUN xmlDocPtr XMLCALL |
|
953 xmlSAXParseEntity (xmlSAXHandlerPtr sax, |
|
954 const char *filename); |
|
955 XMLPUBFUN xmlDocPtr XMLCALL |
|
956 xmlParseEntity (const char *filename); |
|
957 XMLPUBFUN xmlDtdPtr XMLCALL |
|
958 xmlParseDTD (const xmlChar *ExternalID, |
|
959 const xmlChar *SystemID); |
|
960 XMLPUBFUN xmlDtdPtr XMLCALL |
|
961 xmlSAXParseDTD (xmlSAXHandlerPtr sax, |
|
962 const xmlChar *ExternalID, |
|
963 const xmlChar *SystemID); |
|
964 XMLPUBFUN xmlDtdPtr XMLCALL |
|
965 xmlIOParseDTD (xmlSAXHandlerPtr sax, |
|
966 xmlParserInputBufferPtr input, |
|
967 xmlCharEncoding enc); |
|
968 XMLPUBFUN int XMLCALL |
|
969 xmlParseBalancedChunkMemory(xmlDocPtr doc, |
|
970 xmlSAXHandlerPtr sax, |
|
971 void *user_data, |
|
972 int depth, |
|
973 const xmlChar *string, |
|
974 xmlNodePtr *lst); |
|
975 // XMLENGINE: added from v2.6.21 |
|
976 XMLPUBFUN xmlParserErrors XMLCALL |
|
977 xmlParseInNodeContext (xmlNodePtr node, |
|
978 const char *data, |
|
979 int datalen, |
|
980 int options, |
|
981 xmlNodePtr *lst); |
|
982 //-- |
|
983 XMLPUBFUN int XMLCALL |
|
984 xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, |
|
985 xmlSAXHandlerPtr sax, |
|
986 void *user_data, |
|
987 int depth, |
|
988 const xmlChar *string, |
|
989 xmlNodePtr *lst, |
|
990 int recover); |
|
991 XMLPUBFUN int XMLCALL |
|
992 xmlParseExternalEntity (xmlDocPtr doc, |
|
993 xmlSAXHandlerPtr sax, |
|
994 void *user_data, |
|
995 int depth, |
|
996 const xmlChar *URL, |
|
997 const xmlChar *ID, |
|
998 xmlNodePtr *lst); |
|
999 XMLPUBFUN int XMLCALL |
|
1000 xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, |
|
1001 const xmlChar *URL, |
|
1002 const xmlChar *ID, |
|
1003 xmlNodePtr *lst); |
|
1004 |
|
1005 /* |
|
1006 * Parser contexts handling. |
|
1007 */ |
|
1008 XMLPUBFUN xmlParserCtxtPtr XMLCALL |
|
1009 xmlNewParserCtxt (void); |
|
1010 XMLPUBFUN int XMLCALL |
|
1011 xmlInitParserCtxt (xmlParserCtxtPtr ctxt); |
|
1012 XMLPUBFUN void XMLCALL |
|
1013 xmlClearParserCtxt (xmlParserCtxtPtr ctxt); |
|
1014 XMLPUBFUN void XMLCALL |
|
1015 xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); |
|
1016 XMLPUBFUN void XMLCALL |
|
1017 xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, |
|
1018 const xmlChar* buffer, |
|
1019 const char *filename); |
|
1020 XMLPUBFUN xmlParserCtxtPtr XMLCALL |
|
1021 xmlCreateDocParserCtxt (const xmlChar *cur, int length); |
|
1022 |
|
1023 /* |
|
1024 * Reading/setting optional parsing features. |
|
1025 */ |
|
1026 |
|
1027 XMLPUBFUN int XMLCALL |
|
1028 xmlGetFeaturesList (int *len, |
|
1029 const char **result); |
|
1030 XMLPUBFUN int XMLCALL |
|
1031 xmlGetFeature (xmlParserCtxtPtr ctxt, |
|
1032 const char *name, |
|
1033 void *result); |
|
1034 XMLPUBFUN int XMLCALL |
|
1035 xmlSetFeature (xmlParserCtxtPtr ctxt, |
|
1036 const char *name, |
|
1037 void *value); |
|
1038 |
|
1039 #ifdef LIBXML_PUSH_ENABLED |
|
1040 /* |
|
1041 * Interfaces for the Push mode. |
|
1042 */ |
|
1043 XMLPUBFUN xmlParserCtxtPtr XMLCALL |
|
1044 xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, |
|
1045 void *user_data, |
|
1046 const char *chunk, |
|
1047 int size, |
|
1048 const char *filename); |
|
1049 XMLPUBFUN int XMLCALL |
|
1050 xmlParseChunk (xmlParserCtxtPtr ctxt, |
|
1051 const char *chunk, |
|
1052 int size, |
|
1053 int terminate); |
|
1054 #endif /* LIBXML_PUSH_ENABLED */ |
|
1055 |
|
1056 /* |
|
1057 * Special I/O mode. |
|
1058 */ |
|
1059 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1060 XMLPUBFUN xmlParserCtxtPtr XMLCALL |
|
1061 xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, |
|
1062 void *user_data, |
|
1063 xmlInputReadCallback ioread, |
|
1064 xmlInputCloseCallback ioclose, |
|
1065 void *ioctx, |
|
1066 xmlCharEncoding enc); |
|
1067 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
1068 |
|
1069 |
|
1070 XMLPUBFUN xmlParserInputPtr XMLCALL |
|
1071 xmlNewIOInputStream (xmlParserCtxtPtr ctxt, |
|
1072 xmlParserInputBufferPtr input, |
|
1073 xmlCharEncoding enc); |
|
1074 |
|
1075 #ifdef XMLENGINE_ENABLE_PARSER_RECORD_INFO |
|
1076 /* |
|
1077 * Node infos. |
|
1078 */ |
|
1079 XMLPUBFUN const xmlParserNodeInfo* XMLCALL |
|
1080 xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, |
|
1081 const xmlNodePtr node); |
|
1082 XMLPUBFUN void XMLCALL |
|
1083 xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); |
|
1084 XMLPUBFUN void XMLCALL |
|
1085 xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); |
|
1086 XMLPUBFUN unsigned long XMLCALL |
|
1087 xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, |
|
1088 const xmlNodePtr node); |
|
1089 XMLPUBFUN void XMLCALL |
|
1090 xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, |
|
1091 const xmlParserNodeInfoPtr info); |
|
1092 #endif /* XMLENGINE_ENABLE_PARSER_RECORD_INFO */ |
|
1093 |
|
1094 /* |
|
1095 * External entities handling actually implemented in xmlIO. |
|
1096 */ |
|
1097 |
|
1098 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1099 XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader(xmlExternalEntityLoader f); |
|
1100 XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void); |
|
1101 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
1102 |
|
1103 XMLPUBFUN xmlParserInputPtr XMLCALL |
|
1104 xmlLoadExternalEntity (const char *URL, |
|
1105 const char *ID, |
|
1106 xmlParserCtxtPtr ctxt); |
|
1107 |
|
1108 /* |
|
1109 * Index lookup, actually implemented in the encoding module |
|
1110 */ |
|
1111 |
|
1112 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1113 XMLPUBFUN long XMLCALL xmlByteConsumed (xmlParserCtxtPtr ctxt); |
|
1114 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
1115 |
|
1116 /* |
|
1117 * New set of simpler/more flexible APIs |
|
1118 */ |
|
1119 /** |
|
1120 * xmlParserOption: |
|
1121 * |
|
1122 * This is the set of XML parser options that can be passed down |
|
1123 * to the xmlReadDoc() and similar calls. |
|
1124 */ |
|
1125 typedef enum { |
|
1126 XML_PARSE_RECOVER = 1<<0, /* recover on errors */ |
|
1127 XML_PARSE_NOENT = 1<<1, /* substitute entities */ |
|
1128 XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ |
|
1129 XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ |
|
1130 XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ |
|
1131 XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ |
|
1132 XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ |
|
1133 XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ |
|
1134 XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ |
|
1135 XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ |
|
1136 XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ |
|
1137 XML_PARSE_NONET = 1<<11,/* Forbid network access */ |
|
1138 XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ |
|
1139 XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ |
|
1140 XML_PARSE_NOCDATA = 1<<14 /* merge CDATA as text nodes */ |
|
1141 } xmlParserOption; |
|
1142 |
|
1143 XMLPUBFUN void XMLCALL |
|
1144 xmlCtxtReset (xmlParserCtxtPtr ctxt); |
|
1145 |
|
1146 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1147 XMLPUBFUN int XMLCALL |
|
1148 xmlCtxtResetPush (xmlParserCtxtPtr ctxt, |
|
1149 const char *chunk, |
|
1150 int size, |
|
1151 const char *filename, |
|
1152 const char *encoding); |
|
1153 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
1154 |
|
1155 XMLPUBFUN int XMLCALL |
|
1156 xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, |
|
1157 int options); |
|
1158 XMLPUBFUN xmlDocPtr XMLCALL |
|
1159 xmlReadDoc (const xmlChar *cur, |
|
1160 const char *URL, |
|
1161 const char *encoding, |
|
1162 int options); |
|
1163 |
|
1164 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1165 XMLPUBFUN xmlDocPtr XMLCALL |
|
1166 xmlReadFile (const char *URL, |
|
1167 const char *encoding, |
|
1168 int options); |
|
1169 #endif |
|
1170 |
|
1171 XMLPUBFUN xmlDocPtr XMLCALL |
|
1172 xmlReadMemory (const char *buffer, |
|
1173 int size, |
|
1174 const char *URL, |
|
1175 const char *encoding, |
|
1176 int options); |
|
1177 XMLPUBFUN xmlDocPtr XMLCALL |
|
1178 xmlReadFd (int fd, |
|
1179 const char *URL, |
|
1180 const char *encoding, |
|
1181 int options); |
|
1182 XMLPUBFUN xmlDocPtr XMLCALL |
|
1183 xmlReadIO (xmlInputReadCallback ioread, |
|
1184 xmlInputCloseCallback ioclose, |
|
1185 void *ioctx, |
|
1186 const char *URL, |
|
1187 const char *encoding, |
|
1188 int options); |
|
1189 |
|
1190 #ifndef XMLENGINE_EXCLUDE_UNUSED |
|
1191 |
|
1192 XMLPUBFUN xmlDocPtr XMLCALL |
|
1193 xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, |
|
1194 const xmlChar *cur, |
|
1195 const char *URL, |
|
1196 const char *encoding, |
|
1197 int options); |
|
1198 XMLPUBFUN xmlDocPtr XMLCALL |
|
1199 xmlCtxtReadFd (xmlParserCtxtPtr ctxt, |
|
1200 int fd, |
|
1201 const char *URL, |
|
1202 const char *encoding, |
|
1203 int options); |
|
1204 XMLPUBFUN xmlDocPtr XMLCALL |
|
1205 xmlCtxtReadFile (xmlParserCtxtPtr ctxt, |
|
1206 const char *filename, |
|
1207 const char *encoding, |
|
1208 int options); |
|
1209 XMLPUBFUN xmlDocPtr XMLCALL |
|
1210 xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, |
|
1211 const char *buffer, |
|
1212 int size, |
|
1213 const char *URL, |
|
1214 const char *encoding, |
|
1215 int options); |
|
1216 XMLPUBFUN xmlDocPtr XMLCALL |
|
1217 xmlCtxtReadIO (xmlParserCtxtPtr ctxt, |
|
1218 xmlInputReadCallback ioread, |
|
1219 xmlInputCloseCallback ioclose, |
|
1220 void *ioctx, |
|
1221 const char *URL, |
|
1222 const char *encoding, |
|
1223 int options); |
|
1224 #endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */ |
|
1225 |
|
1226 #ifdef __cplusplus |
|
1227 } |
|
1228 #endif |
|
1229 #endif /* XML_PARSER_H */ |
|
1230 |
|
1231 |