mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
more parser error factoring Daniel
* parser.c: more parser error factoring Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Mon Sep 15 11:46:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* parser.c: more parser error factoring
|
||||||
|
|
||||||
Sun Sep 14 21:53:39 PDT 2003 William Brack <wbrack@mmm.com.hk>
|
Sun Sep 14 21:53:39 PDT 2003 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* HTMLtree.c: Fixed bug 121394 - missing ns on attributes
|
* HTMLtree.c: Fixed bug 121394 - missing ns on attributes
|
||||||
|
166
parser.c
166
parser.c
@ -445,6 +445,33 @@ xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|||||||
ctxt->disableSAX = 1;
|
ctxt->disableSAX = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlFatalErrMsgStr:
|
||||||
|
* @ctxt: an XML parser context
|
||||||
|
* @error: the error number
|
||||||
|
* @msg: the error message
|
||||||
|
* @val: a string value
|
||||||
|
*
|
||||||
|
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||||
|
const char *msg, const xmlChar *val)
|
||||||
|
{
|
||||||
|
if (ctxt == NULL) {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlFatalErr: no context !\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ctxt->errNo = error;
|
||||||
|
if ((ctxt->sax == NULL) || (ctxt->sax->error == NULL))
|
||||||
|
return;
|
||||||
|
ctxt->sax->error(ctxt->userData, msg, val);
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
if (ctxt->recovery == 0)
|
||||||
|
ctxt->disableSAX = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlNsErr:
|
* xmlNsErr:
|
||||||
* @ctxt: an XML parser context
|
* @ctxt: an XML parser context
|
||||||
@ -1564,11 +1591,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
|
|||||||
if ((ctxt->standalone == 1) ||
|
if ((ctxt->standalone == 1) ||
|
||||||
((ctxt->hasExternalSubset == 0) &&
|
((ctxt->hasExternalSubset == 0) &&
|
||||||
(ctxt->hasPErefs == 0))) {
|
(ctxt->hasPErefs == 0))) {
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"PEReference: %%%s; not found\n", name);
|
"PEReference: %%%s; not found\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* [ VC: Entity Declared ]
|
* [ VC: Entity Declared ]
|
||||||
@ -1628,12 +1652,9 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
|
|||||||
xmlParseTextDecl(ctxt);
|
xmlParseTextDecl(ctxt);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER,
|
||||||
ctxt->sax->error(ctxt->userData,
|
"PEReference: %s is not a parameter entity\n",
|
||||||
"xmlParserHandlePEReference: %s is not a parameter entity\n",
|
|
||||||
name);
|
name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2474,9 +2495,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
|
|||||||
int first = CUR_SCHAR(cur, l);
|
int first = CUR_SCHAR(cur, l);
|
||||||
|
|
||||||
if (!IS_LETTER(first) && (first != '_')) {
|
if (!IS_LETTER(first) && (first != '_')) {
|
||||||
if ((ctxt != NULL) && (ctxt->sax != NULL) &&
|
xmlFatalErrMsgStr(ctxt, XML_NS_ERR_QNAME,
|
||||||
(ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Name %s is not XML Namespace compliant\n",
|
"Name %s is not XML Namespace compliant\n",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
@ -3678,12 +3697,8 @@ xmlParseComment(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
if (!IS_CHAR(cur)) {
|
if (!IS_CHAR(cur)) {
|
||||||
ctxt->errNo = XML_ERR_COMMENT_NOT_FINISHED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Comment not terminated \n<!--%.50s\n", buf);
|
"Comment not terminated \n<!--%.50s\n", buf);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
} else {
|
} else {
|
||||||
if (input != ctxt->input) {
|
if (input != ctxt->input) {
|
||||||
@ -3868,12 +3883,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
cur = CUR;
|
cur = CUR;
|
||||||
if (!IS_BLANK(cur)) {
|
if (!IS_BLANK(cur)) {
|
||||||
ctxt->errNo = XML_ERR_SPACE_REQUIRED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
"ParsePI: PI %s space expected\n", target);
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"xmlParsePI: PI %s space expected\n", target);
|
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
cur = CUR_CHAR(l);
|
cur = CUR_CHAR(l);
|
||||||
@ -3904,12 +3915,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
if (cur != '?') {
|
if (cur != '?') {
|
||||||
ctxt->errNo = XML_ERR_PI_NOT_FINISHED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
"ParsePI: PI %s never end ...\n", target);
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"xmlParsePI: PI %s never end ...\n", target);
|
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
if (input != ctxt->input) {
|
if (input != ctxt->input) {
|
||||||
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
|
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
|
||||||
@ -4242,12 +4249,8 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
if (RAW != '>') {
|
if (RAW != '>') {
|
||||||
ctxt->errNo = XML_ERR_ENTITY_NOT_FINISHED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"xmlParseEntityDecl: entity %s not terminated\n", name);
|
"xmlParseEntityDecl: entity %s not terminated\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
if (input != ctxt->input) {
|
if (input != ctxt->input) {
|
||||||
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
|
||||||
@ -5145,12 +5148,8 @@ xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name,
|
|||||||
*result = NULL;
|
*result = NULL;
|
||||||
|
|
||||||
if (RAW != '(') {
|
if (RAW != '(') {
|
||||||
ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"xmlParseElementContentDecl : %s '(' expected\n", name);
|
"xmlParseElementContentDecl : %s '(' expected\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
NEXT;
|
NEXT;
|
||||||
@ -6030,13 +6029,9 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
if ((ctxt->standalone == 1) ||
|
if ((ctxt->standalone == 1) ||
|
||||||
((ctxt->hasExternalSubset == 0) &&
|
((ctxt->hasExternalSubset == 0) &&
|
||||||
(ctxt->hasPErefs == 0))) {
|
(ctxt->hasPErefs == 0))) {
|
||||||
ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Entity '%s' not defined\n", name);
|
"Entity '%s' not defined\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
ctxt->valid = 0;
|
ctxt->valid = 0;
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
|
ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
@ -6052,12 +6047,8 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
* unparsed entity
|
* unparsed entity
|
||||||
*/
|
*/
|
||||||
else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
|
else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
|
||||||
ctxt->errNo = XML_ERR_UNPARSED_ENTITY;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Entity reference to unparsed entity %s\n", name);
|
"Entity reference to unparsed entity %s\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6067,12 +6058,8 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
*/
|
*/
|
||||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
||||||
(ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
(ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
|
||||||
ctxt->errNo = XML_ERR_ENTITY_IS_EXTERNAL;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Attribute references external entity '%s'\n", name);
|
"Attribute references external entity '%s'\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* [ WFC: No < in Attribute Values ]
|
* [ WFC: No < in Attribute Values ]
|
||||||
@ -6085,12 +6072,8 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
(!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
|
(!xmlStrEqual(ent->name, BAD_CAST "lt")) &&
|
||||||
(ent->content != NULL) &&
|
(ent->content != NULL) &&
|
||||||
(xmlStrchr(ent->content, '<'))) {
|
(xmlStrchr(ent->content, '<'))) {
|
||||||
ctxt->errNo = XML_ERR_LT_IN_ATTRIBUTE;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"'<' in entity '%s' is not allowed in attributes values\n", name);
|
"'<' in entity '%s' is not allowed in attributes values\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6100,12 +6083,9 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
|||||||
switch (ent->etype) {
|
switch (ent->etype) {
|
||||||
case XML_INTERNAL_PARAMETER_ENTITY:
|
case XML_INTERNAL_PARAMETER_ENTITY:
|
||||||
case XML_EXTERNAL_PARAMETER_ENTITY:
|
case XML_EXTERNAL_PARAMETER_ENTITY:
|
||||||
ctxt->errNo = XML_ERR_ENTITY_IS_PARAMETER;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
"Attempt to reference the parameter entity '%s'\n",
|
||||||
ctxt->sax->error(ctxt->userData,
|
name);
|
||||||
"Attempt to reference the parameter entity '%s'\n", name);
|
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -6217,12 +6197,8 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
|||||||
if ((ctxt->standalone == 1) ||
|
if ((ctxt->standalone == 1) ||
|
||||||
((ctxt->hasExternalSubset == 0) &&
|
((ctxt->hasExternalSubset == 0) &&
|
||||||
(ctxt->hasPErefs == 0))) {
|
(ctxt->hasPErefs == 0))) {
|
||||||
ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Entity '%s' not defined\n", name);
|
"Entity '%s' not defined\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
|
ctxt->errNo = XML_WAR_UNDECLARED_ENTITY;
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
|
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
|
||||||
@ -6374,13 +6350,8 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) {
|
|||||||
if ((ctxt->standalone == 1) ||
|
if ((ctxt->standalone == 1) ||
|
||||||
((ctxt->hasExternalSubset == 0) &&
|
((ctxt->hasExternalSubset == 0) &&
|
||||||
(ctxt->hasPErefs == 0))) {
|
(ctxt->hasPErefs == 0))) {
|
||||||
ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
|
||||||
if ((!ctxt->disableSAX) &&
|
|
||||||
(ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"PEReference: %%%s; not found\n", name);
|
"PEReference: %%%s; not found\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* [ VC: Entity Declared ]
|
* [ VC: Entity Declared ]
|
||||||
@ -6508,12 +6479,8 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
|
|||||||
if ((ctxt->standalone == 1) ||
|
if ((ctxt->standalone == 1) ||
|
||||||
((ctxt->hasExternalSubset == 0) &&
|
((ctxt->hasExternalSubset == 0) &&
|
||||||
(ctxt->hasPErefs == 0))) {
|
(ctxt->hasPErefs == 0))) {
|
||||||
ctxt->errNo = XML_ERR_UNDECLARED_ENTITY;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"PEReference: %%%s; not found\n", name);
|
"PEReference: %%%s; not found\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* [ VC: Entity Declared ]
|
* [ VC: Entity Declared ]
|
||||||
@ -6738,12 +6705,8 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
|||||||
val = xmlParseAttValue(ctxt);
|
val = xmlParseAttValue(ctxt);
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
} else {
|
} else {
|
||||||
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Specification mandate value for attribute %s\n", name);
|
"Specification mandate value for attribute %s\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6769,13 +6732,9 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
|||||||
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
||||||
*(ctxt->space) = 1;
|
*(ctxt->space) = 1;
|
||||||
else {
|
else {
|
||||||
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
||||||
val);
|
val);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7481,12 +7440,8 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
|
|||||||
val = xmlParseAttValueInternal(ctxt, len, alloc, normalize);
|
val = xmlParseAttValueInternal(ctxt, len, alloc, normalize);
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
} else {
|
} else {
|
||||||
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Specification mandate value for attribute %s\n", name);
|
"Specification mandate value for attribute %s\n", name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7512,13 +7467,9 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
|
|||||||
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
||||||
*(ctxt->space) = 1;
|
*(ctxt->space) = 1;
|
||||||
else {
|
else {
|
||||||
ctxt->errNo = XML_ERR_ATTRIBUTE_WITHOUT_VALUE;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
||||||
val);
|
val);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8064,12 +8015,8 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) {
|
|||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
ctxt->instate = XML_PARSER_CONTENT;
|
ctxt->instate = XML_PARSER_CONTENT;
|
||||||
if (cur != '>') {
|
if (cur != '>') {
|
||||||
ctxt->errNo = XML_ERR_CDATA_NOT_FINISHED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_CDATA_NOT_FINISHED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"CData section not finished\n%.50s\n", buf);
|
"CData section not finished\n%.50s\n", buf);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
xmlFree(buf);
|
xmlFree(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -9483,14 +9430,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
if (RAW == '>') {
|
if (RAW == '>') {
|
||||||
NEXT;
|
NEXT;
|
||||||
} else {
|
} else {
|
||||||
ctxt->errNo = XML_ERR_GT_REQUIRED;
|
xmlFatalErrMsgStr(ctxt, XML_ERR_GT_REQUIRED,
|
||||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
|
||||||
ctxt->sax->error(ctxt->userData,
|
|
||||||
"Couldn't find end of Start Tag %s\n",
|
"Couldn't find end of Start Tag %s\n",
|
||||||
name);
|
name);
|
||||||
ctxt->wellFormed = 0;
|
|
||||||
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
|
|
||||||
|
|
||||||
nodePop(ctxt);
|
nodePop(ctxt);
|
||||||
spacePop(ctxt);
|
spacePop(ctxt);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user