mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-08 17:42:14 +03:00
starting to cleanup some of the problems exposed by the W3C/NIST
* SAX2.c parser.c valid.c: starting to cleanup some of the problems exposed by the W3C/NIST regression suite. * result/ent7.sax result/xml2.sax: small fixes. Daniel
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
Mon Sep 15 14:54:42 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* SAX2.c parser.c valid.c: starting to cleanup some of the
|
||||||
|
problems exposed by the W3C/NIST regression suite.
|
||||||
|
* result/ent7.sax result/xml2.sax: small fixes.
|
||||||
|
|
||||||
Mon Sep 15 11:46:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
Mon Sep 15 11:46:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* parser.c: more parser error factoring
|
* parser.c: more parser error factoring
|
||||||
|
70
SAX2.c
70
SAX2.c
@@ -1596,9 +1596,9 @@ decode:
|
|||||||
/**
|
/**
|
||||||
* xmlSAX2AttributeNs:
|
* xmlSAX2AttributeNs:
|
||||||
* @ctx: the user data (XML parser context)
|
* @ctx: the user data (XML parser context)
|
||||||
* @localname: the local name of the element
|
* @localname: the local name of the attribute
|
||||||
* @prefix: the element namespace prefix if available
|
* @prefix: the attribute namespace prefix if available
|
||||||
* @URI: the element namespace name if available
|
* @URI: the attribute namespace name if available
|
||||||
* @value: Start of the attribute value
|
* @value: Start of the attribute value
|
||||||
* @valueend: end of the attribute value
|
* @valueend: end of the attribute value
|
||||||
*
|
*
|
||||||
@@ -1618,11 +1618,6 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
|||||||
xmlNsPtr namespace = NULL;
|
xmlNsPtr namespace = NULL;
|
||||||
xmlChar *dup = NULL;
|
xmlChar *dup = NULL;
|
||||||
|
|
||||||
#if 0
|
|
||||||
TODO, check taht CDATA normalization is done at the
|
|
||||||
parser level !!!!!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: if prefix == NULL, the attribute is not in the default namespace
|
* Note: if prefix == NULL, the attribute is not in the default namespace
|
||||||
*/
|
*/
|
||||||
@@ -1662,31 +1657,50 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
|||||||
if (!ctxt->replaceEntities) {
|
if (!ctxt->replaceEntities) {
|
||||||
dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend);
|
dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend);
|
||||||
if (dup == NULL) {
|
if (dup == NULL) {
|
||||||
/*
|
if (*valueend == 0) {
|
||||||
* cheaper to finally allocate here than duplicate
|
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||||
* entry points in the full validation code
|
ctxt->myDoc, ctxt->node, ret, value);
|
||||||
*/
|
} else {
|
||||||
dup = xmlStrndup(value, valueend - value);
|
/*
|
||||||
|
* That should already be normalized.
|
||||||
|
* cheaper to finally allocate here than duplicate
|
||||||
|
* entry points in the full validation code
|
||||||
|
*/
|
||||||
|
dup = xmlStrndup(value, valueend - value);
|
||||||
|
|
||||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||||
ctxt->myDoc, ctxt->node, ret, dup);
|
ctxt->myDoc, ctxt->node, ret, dup);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
/*
|
||||||
TODO
|
* dup now contains a string of the flattened attribute
|
||||||
xmlChar *nvalnorm;
|
* content with entities substitued. Check if we need to
|
||||||
|
* apply an extra layer of normalization.
|
||||||
/*
|
|
||||||
* Do the last stage of the attribute normalization
|
|
||||||
* It need to be done twice ... it's an extra burden related
|
* It need to be done twice ... it's an extra burden related
|
||||||
* to the ability to keep references in attributes
|
* to the ability to keep references in attributes
|
||||||
*/
|
*/
|
||||||
nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc,
|
if (ctxt->attsSpecial != NULL) {
|
||||||
ctxt->node, fullname, dup);
|
xmlChar *nvalnorm;
|
||||||
if (nvalnorm != NULL) {
|
xmlChar fn[50];
|
||||||
xmlFree(dup);
|
xmlChar *fullname;
|
||||||
dup = nvalnorm;
|
|
||||||
|
fullname = xmlBuildQName(localname, prefix, fn, 50);
|
||||||
|
if (fullname != NULL) {
|
||||||
|
ctxt->vctxt.valid = 1;
|
||||||
|
nvalnorm = xmlValidCtxtNormalizeAttributeValue(
|
||||||
|
&ctxt->vctxt, ctxt->myDoc,
|
||||||
|
ctxt->node, fullname, dup);
|
||||||
|
if (ctxt->vctxt.valid != 1)
|
||||||
|
ctxt->valid = 0;
|
||||||
|
|
||||||
|
if ((fullname != fn) && (fullname != localname))
|
||||||
|
xmlFree(fullname);
|
||||||
|
if (nvalnorm != NULL) {
|
||||||
|
xmlFree(dup);
|
||||||
|
dup = nvalnorm;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||||
ctxt->myDoc, ctxt->node, ret, dup);
|
ctxt->myDoc, ctxt->node, ret, dup);
|
||||||
@@ -2221,7 +2235,7 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlSAX2DefaultVersionValue = 2;
|
static int xmlSAX2DefaultVersionValue = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlSAXDefaultVersion:
|
* xmlSAXDefaultVersion:
|
||||||
|
3
parser.c
3
parser.c
@@ -3024,10 +3024,10 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
|||||||
(c != '<')) {
|
(c != '<')) {
|
||||||
if (c == 0) break;
|
if (c == 0) break;
|
||||||
if (c == '&') {
|
if (c == '&') {
|
||||||
|
in_space = 0;
|
||||||
if (NXT(1) == '#') {
|
if (NXT(1) == '#') {
|
||||||
int val = xmlParseCharRef(ctxt);
|
int val = xmlParseCharRef(ctxt);
|
||||||
|
|
||||||
in_space = 0;
|
|
||||||
if (val == '&') {
|
if (val == '&') {
|
||||||
if (ctxt->replaceEntities) {
|
if (ctxt->replaceEntities) {
|
||||||
if (len > buf_size - 10) {
|
if (len > buf_size - 10) {
|
||||||
@@ -3071,7 +3071,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) {
|
|||||||
} else {
|
} else {
|
||||||
buf[len++] = ent->content[0];
|
buf[len++] = ent->content[0];
|
||||||
}
|
}
|
||||||
in_space = 0;
|
|
||||||
} else if ((ent != NULL) &&
|
} else if ((ent != NULL) &&
|
||||||
(ctxt->replaceEntities != 0)) {
|
(ctxt->replaceEntities != 0)) {
|
||||||
xmlChar *rep;
|
xmlChar *rep;
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
xmlSAXUserParseFile returned error 27
|
|
||||||
SAX.setDocumentLocator()
|
SAX.setDocumentLocator()
|
||||||
SAX.startDocument()
|
SAX.startDocument()
|
||||||
SAX.internalSubset(item, , )
|
SAX.internalSubset(item, , )
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
xmlSAXUserParseFile returned error 27
|
|
||||||
SAX.setDocumentLocator()
|
SAX.setDocumentLocator()
|
||||||
SAX.startDocument()
|
SAX.startDocument()
|
||||||
SAX.internalSubset(test, , )
|
SAX.internalSubset(test, , )
|
||||||
|
9
valid.c
9
valid.c
@@ -3319,17 +3319,10 @@ xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|||||||
xmlEntityPtr ent;
|
xmlEntityPtr ent;
|
||||||
|
|
||||||
ent = xmlGetDocEntity(doc, value);
|
ent = xmlGetDocEntity(doc, value);
|
||||||
|
/* yeah it's a bit messy... */
|
||||||
if ((ent == NULL) && (doc->standalone == 1)) {
|
if ((ent == NULL) && (doc->standalone == 1)) {
|
||||||
doc->standalone = 0;
|
doc->standalone = 0;
|
||||||
ent = xmlGetDocEntity(doc, value);
|
ent = xmlGetDocEntity(doc, value);
|
||||||
if (ent != NULL) {
|
|
||||||
VERROR(ctxt->userData,
|
|
||||||
"standalone problem: attribute %s reference entity \"%s\" in external subset\n",
|
|
||||||
name, value);
|
|
||||||
/* WAIT to get answer from the Core WG on this
|
|
||||||
ret = 0;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ent == NULL) {
|
if (ent == NULL) {
|
||||||
VERROR(ctxt->userData,
|
VERROR(ctxt->userData,
|
||||||
|
Reference in New Issue
Block a user