mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
applied patch from Rob Richards for xml:space and xml:lang handling with
* parser.c include/libxml/xmlerror.h: applied patch from Rob Richards for xml:space and xml:lang handling with SAX2 api. Daniel
This commit is contained in:
parent
d846768e27
commit
d892557d99
@ -1,3 +1,8 @@
|
||||
Thu Jun 9 00:33:50 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c include/libxml/xmlerror.h: applied patch from Rob Richards
|
||||
for xml:space and xml:lang handling with SAX2 api.
|
||||
|
||||
Wed Jun 8 19:41:38 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* globals.c: applied patch from Morten Welinder, closing bug #306901
|
||||
|
@ -195,6 +195,7 @@ typedef enum {
|
||||
XML_WAR_NS_URI, /* 99 */
|
||||
XML_WAR_NS_URI_RELATIVE, /* 100 */
|
||||
XML_ERR_MISSING_ENCODING, /* 101 */
|
||||
XML_WAR_SPACE_VALUE, /* 102 */
|
||||
XML_NS_ERR_XML_NAMESPACE = 200,
|
||||
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
|
||||
XML_NS_ERR_QNAME, /* 202 */
|
||||
|
61
parser.c
61
parser.c
@ -6747,9 +6747,9 @@ xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlChar **value) {
|
||||
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
||||
*(ctxt->space) = 1;
|
||||
else {
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||
xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE,
|
||||
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
||||
val);
|
||||
val, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7414,7 +7414,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
|
||||
const xmlChar **prefix, xmlChar **value,
|
||||
int *len, int *alloc) {
|
||||
const xmlChar *name;
|
||||
xmlChar *val;
|
||||
xmlChar *val, *internal_val = NULL;
|
||||
int normalize = 0;
|
||||
|
||||
*value = NULL;
|
||||
@ -7452,33 +7452,40 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt,
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that xml:lang conforms to the specification
|
||||
* No more registered as an error, just generate a warning now
|
||||
* since this was deprecated in XML second edition
|
||||
*/
|
||||
if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "xml:lang"))) {
|
||||
if (!xmlCheckLanguageID(val)) {
|
||||
xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE,
|
||||
"Malformed value for xml:lang : %s\n",
|
||||
val, NULL);
|
||||
}
|
||||
}
|
||||
if (*prefix == ctxt->str_xml) {
|
||||
/*
|
||||
* Check that xml:lang conforms to the specification
|
||||
* No more registered as an error, just generate a warning now
|
||||
* since this was deprecated in XML second edition
|
||||
*/
|
||||
if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "lang"))) {
|
||||
internal_val = xmlStrndup(val, *len);
|
||||
if (!xmlCheckLanguageID(internal_val)) {
|
||||
xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE,
|
||||
"Malformed value for xml:lang : %s\n",
|
||||
internal_val, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that xml:space conforms to the specification
|
||||
*/
|
||||
if (xmlStrEqual(name, BAD_CAST "xml:space")) {
|
||||
if (xmlStrEqual(val, BAD_CAST "default"))
|
||||
*(ctxt->space) = 0;
|
||||
else if (xmlStrEqual(val, BAD_CAST "preserve"))
|
||||
*(ctxt->space) = 1;
|
||||
else {
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
|
||||
/*
|
||||
* Check that xml:space conforms to the specification
|
||||
*/
|
||||
if (xmlStrEqual(name, BAD_CAST "space")) {
|
||||
internal_val = xmlStrndup(val, *len);
|
||||
if (xmlStrEqual(internal_val, BAD_CAST "default"))
|
||||
*(ctxt->space) = 0;
|
||||
else if (xmlStrEqual(internal_val, BAD_CAST "preserve"))
|
||||
*(ctxt->space) = 1;
|
||||
else {
|
||||
xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE,
|
||||
"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
|
||||
val);
|
||||
internal_val, NULL);
|
||||
}
|
||||
}
|
||||
if (internal_val) {
|
||||
xmlFree(internal_val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*value = val;
|
||||
return(name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user