mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-20 03:52:25 +03:00
register xmlSchemaSetValidErrors, patch from Brent Hendricks in the
* python/libxml.c: register xmlSchemaSetValidErrors, patch from Brent Hendricks in the mailing-list * include/libxml/valid.h HTMLparser.c SAX2.c valid.c parserInternals.c: fix #156626 and more generally how to find out if a validation contect is part of a parsing context or not. This can probably be improved to make 100% sure that vctxt->userData is the parser context too. It's a bit hairy because we can't change the xmlValidCtxt structure without breaking the ABI since this change xmlParserCtxt information indexes. Daniel
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
Fri Oct 29 14:03:36 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* python/libxml.c: register xmlSchemaSetValidErrors, patch from
|
||||||
|
Brent Hendricks in the mailing-list
|
||||||
|
* include/libxml/valid.h HTMLparser.c SAX2.c valid.c
|
||||||
|
parserInternals.c: fix #156626 and more generally how to find out
|
||||||
|
if a validation contect is part of a parsing context or not. This
|
||||||
|
can probably be improved to make 100% sure that vctxt->userData
|
||||||
|
is the parser context too. It's a bit hairy because we can't
|
||||||
|
change the xmlValidCtxt structure without breaking the ABI since
|
||||||
|
this change xmlParserCtxt information indexes.
|
||||||
|
|
||||||
Wed Oct 27 19:26:20 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
Wed Oct 27 19:26:20 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* ChangeLog NEWS configure.in doc/*: preparing release 2.6.15
|
* ChangeLog NEWS configure.in doc/*: preparing release 2.6.15
|
||||||
|
@@ -4136,6 +4136,7 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
|
|||||||
ctxt->replaceEntities = 0;
|
ctxt->replaceEntities = 0;
|
||||||
ctxt->linenumbers = xmlLineNumbersDefaultValue;
|
ctxt->linenumbers = xmlLineNumbersDefaultValue;
|
||||||
ctxt->html = 1;
|
ctxt->html = 1;
|
||||||
|
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
|
||||||
ctxt->vctxt.userData = ctxt;
|
ctxt->vctxt.userData = ctxt;
|
||||||
ctxt->vctxt.error = xmlParserValidityError;
|
ctxt->vctxt.error = xmlParserValidityError;
|
||||||
ctxt->vctxt.warning = xmlParserValidityWarning;
|
ctxt->vctxt.warning = xmlParserValidityWarning;
|
||||||
|
4
NEWS
4
NEWS
@@ -14,7 +14,9 @@ ChangeLog.html
|
|||||||
describes the recents commits
|
describes the recents commits
|
||||||
to the CVS at
|
to the CVS at
|
||||||
http://cvs.gnome.org/viewcvs/libxml2/
|
http://cvs.gnome.org/viewcvs/libxml2/
|
||||||
code base.There is the list of public releases:2.6.15: Oct 27 2004 - security fixes on the nanoftp and nanohttp modules
|
code base.There is the list of public releases:
|
||||||
|
2.6.15: Oct 27 2004:
|
||||||
|
- security fixes on the nanoftp and nanohttp modules
|
||||||
- build fixes: xmllint detection bug in configure, building outside the
|
- build fixes: xmllint detection bug in configure, building outside the
|
||||||
source tree (Thomas Fitzsimmons)
|
source tree (Thomas Fitzsimmons)
|
||||||
- bug fixes: HTML parser on broken ASCII chars in names (William), Python
|
- bug fixes: HTML parser on broken ASCII chars in names (William), Python
|
||||||
|
8
SAX2.c
8
SAX2.c
@@ -1562,7 +1562,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
|||||||
* If it's the Document root, finish the DTD validation and
|
* If it's the Document root, finish the DTD validation and
|
||||||
* check the document root element for validity
|
* check the document root element for validity
|
||||||
*/
|
*/
|
||||||
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) {
|
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
|
||||||
int chk;
|
int chk;
|
||||||
|
|
||||||
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
||||||
@@ -1571,7 +1571,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
|||||||
if (chk < 0)
|
if (chk < 0)
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
||||||
ctxt->vctxt.finishDtd = 1;
|
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
|
||||||
}
|
}
|
||||||
#endif /* LIBXML_VALID_ENABLED */
|
#endif /* LIBXML_VALID_ENABLED */
|
||||||
|
|
||||||
@@ -2132,7 +2132,7 @@ xmlSAX2StartElementNs(void *ctx,
|
|||||||
* If it's the Document root, finish the DTD validation and
|
* If it's the Document root, finish the DTD validation and
|
||||||
* check the document root element for validity
|
* check the document root element for validity
|
||||||
*/
|
*/
|
||||||
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) {
|
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
|
||||||
int chk;
|
int chk;
|
||||||
|
|
||||||
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
||||||
@@ -2141,7 +2141,7 @@ xmlSAX2StartElementNs(void *ctx,
|
|||||||
if (chk < 0)
|
if (chk < 0)
|
||||||
ctxt->wellFormed = 0;
|
ctxt->wellFormed = 0;
|
||||||
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
||||||
ctxt->vctxt.finishDtd = 1;
|
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
|
||||||
}
|
}
|
||||||
#endif /* LIBXML_VALID_ENABLED */
|
#endif /* LIBXML_VALID_ENABLED */
|
||||||
}
|
}
|
||||||
|
@@ -446,7 +446,9 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
|
|||||||
with_docbook="yes"
|
with_docbook="yes"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if test "${CC}" = "gcc" ; then
|
||||||
CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
|
CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
|
||||||
|
fi
|
||||||
STATIC_BINARIES="-static"
|
STATIC_BINARIES="-static"
|
||||||
dnl -Wcast-qual -ansi
|
dnl -Wcast-qual -ansi
|
||||||
else
|
else
|
||||||
|
@@ -58,6 +58,21 @@ typedef void (*xmlValidityWarningFunc) (void *ctx,
|
|||||||
const char *msg,
|
const char *msg,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
|
#ifdef IN_LIBXML
|
||||||
|
/**
|
||||||
|
* XML_CTXT_FINISH_DTD_0:
|
||||||
|
*
|
||||||
|
* Special value for finishDtd field when embedded in an xmlParserCtxt
|
||||||
|
*/
|
||||||
|
#define XML_CTXT_FINISH_DTD_0 0xabcd1234
|
||||||
|
/**
|
||||||
|
* XML_CTXT_FINISH_DTD_1:
|
||||||
|
*
|
||||||
|
* Special value for finishDtd field when embedded in an xmlParserCtxt
|
||||||
|
*/
|
||||||
|
#define XML_CTXT_FINISH_DTD_1 0xabcd1235
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xmlValidCtxt:
|
* xmlValidCtxt:
|
||||||
* An xmlValidCtxt is used for error reporting when validating.
|
* An xmlValidCtxt is used for error reporting when validating.
|
||||||
@@ -75,7 +90,7 @@ struct _xmlValidCtxt {
|
|||||||
int nodeMax; /* Max depth of the parsing stack */
|
int nodeMax; /* Max depth of the parsing stack */
|
||||||
xmlNodePtr *nodeTab; /* array of nodes */
|
xmlNodePtr *nodeTab; /* array of nodes */
|
||||||
|
|
||||||
int finishDtd; /* finished validating the Dtd ? */
|
unsigned int finishDtd; /* finished validating the Dtd ? */
|
||||||
xmlDocPtr doc; /* the document */
|
xmlDocPtr doc; /* the document */
|
||||||
int valid; /* temporary validity check result */
|
int valid; /* temporary validity check result */
|
||||||
|
|
||||||
|
@@ -1630,6 +1630,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
|
|||||||
if (ctxt->keepBlanks == 0)
|
if (ctxt->keepBlanks == 0)
|
||||||
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||||
|
|
||||||
|
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
|
||||||
ctxt->vctxt.userData = ctxt;
|
ctxt->vctxt.userData = ctxt;
|
||||||
ctxt->vctxt.error = xmlParserValidityError;
|
ctxt->vctxt.error = xmlParserValidityError;
|
||||||
ctxt->vctxt.warning = xmlParserValidityWarning;
|
ctxt->vctxt.warning = xmlParserValidityWarning;
|
||||||
|
@@ -3505,6 +3505,7 @@ static PyMethodDef libxmlMethods[] = {
|
|||||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
{(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
|
{(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
|
||||||
{(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
|
{(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
|
||||||
|
{(char *)"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_C14N_ENABLED
|
#ifdef LIBXML_C14N_ENABLED
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
|
25
valid.c
25
valid.c
@@ -59,8 +59,13 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
channel = ctxt->error;
|
channel = ctxt->error;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
|
/* Use the special values to detect if it is part of a parsing
|
||||||
|
context */
|
||||||
|
if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
|
||||||
|
(ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
|
||||||
pctxt = ctxt->userData;
|
pctxt = ctxt->userData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (extra)
|
if (extra)
|
||||||
__xmlRaiseError(NULL, channel, data,
|
__xmlRaiseError(NULL, channel, data,
|
||||||
pctxt, NULL, XML_FROM_VALID, XML_ERR_NO_MEMORY,
|
pctxt, NULL, XML_FROM_VALID, XML_ERR_NO_MEMORY,
|
||||||
@@ -92,8 +97,13 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
channel = ctxt->error;
|
channel = ctxt->error;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
|
/* Use the special values to detect if it is part of a parsing
|
||||||
|
context */
|
||||||
|
if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
|
||||||
|
(ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
|
||||||
pctxt = ctxt->userData;
|
pctxt = ctxt->userData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (extra)
|
if (extra)
|
||||||
__xmlRaiseError(NULL, channel, data,
|
__xmlRaiseError(NULL, channel, data,
|
||||||
pctxt, NULL, XML_FROM_VALID, error,
|
pctxt, NULL, XML_FROM_VALID, error,
|
||||||
@@ -132,8 +142,13 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
channel = ctxt->error;
|
channel = ctxt->error;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
|
/* Use the special values to detect if it is part of a parsing
|
||||||
|
context */
|
||||||
|
if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
|
||||||
|
(ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
|
||||||
pctxt = ctxt->userData;
|
pctxt = ctxt->userData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
||||||
XML_ERR_ERROR, NULL, 0,
|
XML_ERR_ERROR, NULL, 0,
|
||||||
(const char *) str1,
|
(const char *) str1,
|
||||||
@@ -168,8 +183,13 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
channel = ctxt->error;
|
channel = ctxt->error;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
|
/* Use the special values to detect if it is part of a parsing
|
||||||
|
context */
|
||||||
|
if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
|
||||||
|
(ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
|
||||||
pctxt = ctxt->userData;
|
pctxt = ctxt->userData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
||||||
XML_ERR_ERROR, NULL, 0,
|
XML_ERR_ERROR, NULL, 0,
|
||||||
(const char *) str1,
|
(const char *) str1,
|
||||||
@@ -202,8 +222,13 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
channel = ctxt->error;
|
channel = ctxt->error;
|
||||||
data = ctxt->userData;
|
data = ctxt->userData;
|
||||||
|
/* Use the special values to detect if it is part of a parsing
|
||||||
|
context */
|
||||||
|
if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) ||
|
||||||
|
(ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) {
|
||||||
pctxt = ctxt->userData;
|
pctxt = ctxt->userData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
|
||||||
XML_ERR_WARNING, NULL, 0,
|
XML_ERR_WARNING, NULL, 0,
|
||||||
(const char *) str1,
|
(const char *) str1,
|
||||||
|
Reference in New Issue
Block a user