Commit eff45a92 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

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
parent c2f83d1f
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>
 
* ChangeLog NEWS configure.in doc/*: preparing release 2.6.15
......
......@@ -4136,6 +4136,7 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
ctxt->replaceEntities = 0;
ctxt->linenumbers = xmlLineNumbersDefaultValue;
ctxt->html = 1;
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
ctxt->vctxt.userData = ctxt;
ctxt->vctxt.error = xmlParserValidityError;
ctxt->vctxt.warning = xmlParserValidityWarning;
......
......@@ -14,7 +14,9 @@ ChangeLog.html
describes the recents commits
to the CVS at
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
source tree (Thomas Fitzsimmons)
- bug fixes: HTML parser on broken ASCII chars in names (William), Python
......
......@@ -1562,7 +1562,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
* If it's the Document root, finish the DTD validation and
* 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;
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
......@@ -1571,7 +1571,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
if (chk < 0)
ctxt->wellFormed = 0;
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
ctxt->vctxt.finishDtd = 1;
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
}
#endif /* LIBXML_VALID_ENABLED */
......@@ -2132,7 +2132,7 @@ xmlSAX2StartElementNs(void *ctx,
* If it's the Document root, finish the DTD validation and
* 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;
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
......@@ -2141,7 +2141,7 @@ xmlSAX2StartElementNs(void *ctx,
if (chk < 0)
ctxt->wellFormed = 0;
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
ctxt->vctxt.finishDtd = 1;
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
}
#endif /* LIBXML_VALID_ENABLED */
}
......
......@@ -446,7 +446,9 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
with_docbook="yes"
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"
fi
STATIC_BINARIES="-static"
dnl -Wcast-qual -ansi
else
......
......@@ -58,6 +58,21 @@ typedef void (*xmlValidityWarningFunc) (void *ctx,
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:
* An xmlValidCtxt is used for error reporting when validating.
......@@ -75,7 +90,7 @@ struct _xmlValidCtxt {
int nodeMax; /* Max depth of the parsing stack */
xmlNodePtr *nodeTab; /* array of nodes */
int finishDtd; /* finished validating the Dtd ? */
unsigned int finishDtd; /* finished validating the Dtd ? */
xmlDocPtr doc; /* the document */
int valid; /* temporary validity check result */
......
......@@ -1630,6 +1630,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
if (ctxt->keepBlanks == 0)
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0;
ctxt->vctxt.userData = ctxt;
ctxt->vctxt.error = xmlParserValidityError;
ctxt->vctxt.warning = xmlParserValidityWarning;
......
......@@ -3505,6 +3505,7 @@ static PyMethodDef libxmlMethods[] = {
#ifdef LIBXML_SCHEMAS_ENABLED
{(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
{(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
{(char *)"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL},
#endif
#ifdef LIBXML_C14N_ENABLED
#ifdef LIBXML_OUTPUT_ENABLED
......
......@@ -59,7 +59,12 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = 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;
}
}
if (extra)
__xmlRaiseError(NULL, channel, data,
......@@ -92,7 +97,12 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = 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;
}
}
if (extra)
__xmlRaiseError(NULL, channel, data,
......@@ -132,7 +142,12 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = 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;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0,
......@@ -168,7 +183,12 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = 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;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0,
......@@ -202,7 +222,12 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = 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;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_WARNING, NULL, 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment