1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

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

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;