1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-01-18 14:21:02 +03:00

changed 'make tests' to use a concise output, scrolling to see where thing

* Makefile.am: changed 'make tests' to use a concise output,
  scrolling to see where thing broke wasn't pleasant
* configure.in: some beta4 preparation, but not ready yet
* error.c globals.c include/libxml/globals.h include/libxml/xmlerror.h:
  new error handling code, last error informations are stored
  in the parsing context or a global variable, new APIs to
  handle the xmlErrorPtr type.
* parser.c parserInternals.c valid.c : started migrating to the
  new error handling code, it's a royal pain.
* include/libxml/parser.h include/libxml/parserInternals.h:
  moved the definition of xmlNewParserCtxt()
* parser.c: small potential buffer access problem in push code
  provided by Justin Fletcher
* result/*.sax result/VC/PENesting* result/namespaces/*
  result/valid/*.err: some error messages were sligthly changed.
Daniel
This commit is contained in:
Daniel Veillard
2003-10-02 22:28:19 +00:00
parent e7acf431b8
commit 2b8c4a151b
34 changed files with 1021 additions and 511 deletions

View File

@@ -58,8 +58,9 @@ XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
@@ -105,6 +106,7 @@ struct _xmlGlobalState
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
xmlMallocFunc xmlMallocAtomic;
xmlError xmlLastError;
};
#ifdef __cplusplus
@@ -203,6 +205,13 @@ XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
#else
XMLPUBVAR xmlError xmlLastError;
#endif
/*
* Everything starting from the line below is

View File

@@ -15,6 +15,7 @@
#include <libxml/hash.h>
#include <libxml/valid.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#ifdef __cplusplus
extern "C" {
@@ -272,6 +273,11 @@ struct _xmlParserCtxt {
xmlNodePtr freeElems; /* List of freed element nodes */
int freeAttrsNr; /* number of freed attributes nodes */
xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
/*
* the complete error informations for the last error.
*/
xmlError lastError;
};
/**
@@ -977,6 +983,8 @@ XMLPUBFUN int XMLCALL
/*
* Parser contexts handling.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlNewParserCtxt (void);
XMLPUBFUN int XMLCALL
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL

View File

@@ -211,8 +211,6 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlNewParserCtxt (void);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,

View File

@@ -7,6 +7,70 @@
extern "C" {
#endif
/**
* 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;
/**
* xmlErrorDomain:
*
* Indicates where an error may have come from
*/
typedef enum {
XML_FROM_NONE = 0,
XML_FROM_PARSER, /* The XML parser */
XML_FROM_NAMESPACE, /* The XML Namespace module */
XML_FROM_DTD, /* The XML DTD validation */
XML_FROM_HTML, /* The HTML parser */
XML_FROM_MEMORY, /* The memory allocator */
XML_FROM_OUTPUT, /* The serialization code */
XML_FROM_IO, /* The Input/Output stack */
XML_FROM_XINCLUDE, /* The XInclude processing */
XML_FROM_XPATH, /* The XPath module */
XML_FROM_XPOINTER, /* The XPointer module */
XML_FROM_REGEXP, /* The regular expressions module */
XML_FROM_SCHEMAS, /* The W3C XML Schemas module */
XML_FROM_RELAXNG, /* The Relax-NG module */
XML_FROM_CATALOG, /* The Catalog module */
XML_FROM_C14N, /* The Canonicalization module */
XML_FROM_XSLT /* The XSLT engine from libxslt */
} 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 */
char *str3; /* extra string information */
int int1; /* extra number information */
int int2; /* extra number information */
};
/**
* xmlParserError:
*
* This is an error that the XML (or HTML) parser can generate
*/
typedef enum {
XML_ERR_OK = 0,
XML_ERR_INTERNAL_ERROR,
@@ -141,7 +205,11 @@ typedef enum {
XML_NS_ERR_QNAME,
XML_NS_ERR_ATTRIBUTE_REDEFINED,
XML_ERR_CONDSEC_INVALID_KEYWORD,
XML_ERR_VERSION_MISSING
XML_ERR_VERSION_MISSING,
XML_DTD_MIXED_CORRUPT,
XML_DTD_NO_DOC,
XML_DTD_NO_ELEM_NAME,
XML_DTD_NOTATION_REDEFINED
} xmlParserErrors;
/**
@@ -192,6 +260,40 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlParserPrintFileContext (xmlParserInputPtr input);
/*
* Extended error information routines
*/
XMLPUBFUN xmlErrorPtr XMLCALL
xmlGetLastError (void);
XMLPUBFUN void XMLCALL
xmlResetLastError (void);
XMLPUBFUN xmlErrorPtr XMLCALL
xmlCtxtGetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlCtxtResetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlResetError (xmlErrorPtr err);
XMLPUBFUN int XMLCALL
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
/*
* Intended for internal use mostly
*/
XMLPUBFUN void XMLCALL
xmlRaiseError (void *ctx,
int domain,
int code,
xmlErrorLevel level,
const char *file,
int line,
const char *str1,
const char *str2,
const char *str3,
int int1,
int int2,
const char *msg,
...);
#ifdef __cplusplus
}
#endif