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