Re: [xml] new SAX2 API



On Thu, 2003-10-02 at 08:10, Daniel Veillard wrote:
[...]
  Based on Havoc's and others feedback here is what I started to work
on, it's very close to Gerror, just specialized for the parser needs:

/**
 * xmlErrorLevel:
 *
 * Indicates the level of an error
 */
typedef enum {
    XML_ERR_NONE = 0,
    XML_ERR_WARNING = 1,        /* A simple warning */
    XML_ERR_ERROR = 2,          /* A recoverable error */
    XML_ERR_FATAL = 3           /* A fatal error */
} xmlErrorLevel;

Can somebody gie me an example of something that is an "error", but not
"fatal"? At least during parsing, I thought that all errors were fatal.
And all of the errors I can think of from each of the xmlErrorDomain
(below) values looks fatal (except maybe some HTML things, if the
library was operating in a kind of tag soup mode).

Of course, that doesn't stop me (and others, apparently) from trying to
recover from errors inside error handlers and either continue parsing or
queue things up for a restart, but that is slightly different.

/**
 * xmlErrorDomain:
 *
 * Indicates where an error may have come from
 */
typedef enum {
    XML_FROM_NONE = 0,
    XML_FROM_PARSER,    /* The XML parser */
    XML_ERR_HTML,       /* The HTML parser */
    XML_ERR_MEMORY,     /* The memory allocator */
    XML_ERR_OUTPUT,     /* The serialization code */
    XML_ERR_IO,         /* The Input/Output stack */
    XML_ERR_XINCLUDE,   /* The XInclude processing */
    XML_ERR_XPATH,      /* The XPath engine */
    XML_ERR_XPOINTER    /* The XPointer engine */
} xmlErrorDomain;

/**
 * xmlError:
 *
 * An XML Error instance.
 */
                                                                                
typedef struct _xmlError xmlError;
typedef xmlError *xmlErrorPtr;
struct _xmlError {
    int         domain; /* What part of the library raised this error */
    int         code;   /* The error code, e.g. an xmlParserError */
    char       *message;/* human-readable informative error message */
    xmlErrorLevel level;/* how consequent is the error */
    char       *file;   /* the filename */
    int         line;   /* the line number if available */
    char       *str1;   /* extra string information */
    char       *str2;   /* extra string information */
    int         int1;   /* extra number information */
    int         int2;   /* extra number information */
};

Nice. :-)


Cheers,
Malcolm



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]