fixed bug #109160 on non-ASCII IDs Daniel

* xpath.c: fixed bug #109160 on non-ASCII IDs
Daniel
This commit is contained in:
Daniel Veillard 2003-03-26 21:40:13 +00:00
parent 642104e116
commit e209b33055
2 changed files with 21 additions and 14 deletions

View File

@ -1,3 +1,7 @@
Wed Mar 26 22:38:39 CET 2003 Daniel Veillard <daniel@veillard.com>
* xpath.c: fixed bug #109160 on non-ASCII IDs
Wed Mar 26 17:30:37 CET 2003 Daniel Veillard <daniel@veillard.com>
* parser.c: Norm suggested a nicer error message for xml:space values

31
xpath.c
View File

@ -5946,23 +5946,26 @@ xmlXPathGetElementsByIds (xmlDocPtr doc, const xmlChar *ids) {
while (IS_BLANK(*cur)) cur++;
while (*cur != 0) {
while ((IS_LETTER(*cur)) || (IS_DIGIT(*cur)) ||
(*cur == '.') || (*cur == '-') ||
(*cur == '_') || (*cur == ':') ||
(IS_COMBINING(*cur)) ||
(IS_EXTENDER(*cur)))
cur++;
if ((!IS_BLANK(*cur)) && (*cur != 0)) break;
while ((!IS_BLANK(*cur)) && (*cur != 0))
cur++;
ID = xmlStrndup(ids, cur - ids);
attr = xmlGetID(doc, ID);
if (attr != NULL) {
elem = attr->parent;
xmlXPathNodeSetAdd(ret, elem);
}
if (ID != NULL)
if (ID != NULL) {
if (xmlValidateNCName(ID, 1) == 0) {
attr = xmlGetID(doc, ID);
if (attr != NULL) {
if (attr->type == XML_ATTRIBUTE_NODE)
elem = attr->parent;
else if (attr->type == XML_ELEMENT_NODE)
elem = (xmlNodePtr) attr;
else
elem = NULL;
if (elem != NULL)
xmlXPathNodeSetAdd(ret, elem);
}
}
xmlFree(ID);
}
while (IS_BLANK(*cur)) cur++;
ids = cur;