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:
31
xpath.c
31
xpath.c
@ -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;
|
||||
|
Reference in New Issue
Block a user