mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
fix the name() bug for elements in the default namespace reported by
* xpath.c: fix the name() bug for elements in the default namespace reported by Charlie Bozeman Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
||||
Sun Jul 8 16:26:00 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* xpath.c: fix the name() bug for elements in the default
|
||||
namespace reported by Charlie Bozeman
|
||||
|
||||
Sun Jul 8 15:11:05 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* SAX.c parser.c testXPath.c xpath.c: trying to fix #56948, this
|
||||
|
15
xpath.c
15
xpath.c
@ -4815,7 +4815,8 @@ xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* returned.
|
||||
*/
|
||||
static void
|
||||
xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs)
|
||||
{
|
||||
xmlXPathObjectPtr cur;
|
||||
|
||||
if (nargs == 0) {
|
||||
@ -4838,14 +4839,18 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
switch (cur->nodesetval->nodeTab[i]->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ATTRIBUTE_NODE:
|
||||
if (cur->nodesetval->nodeTab[i]->ns == NULL)
|
||||
valuePush(ctxt, xmlXPathNewString(
|
||||
cur->nodesetval->nodeTab[i]->name));
|
||||
if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
|
||||
(cur->nodesetval->nodeTab[i]->ns->prefix == NULL))
|
||||
valuePush(ctxt,
|
||||
xmlXPathNewString(cur->nodesetval->
|
||||
nodeTab[i]->name));
|
||||
|
||||
else {
|
||||
char name[2000];
|
||||
|
||||
snprintf(name, sizeof(name), "%s:%s",
|
||||
(char *) cur->nodesetval->nodeTab[i]->ns->prefix,
|
||||
(char *) cur->nodesetval->nodeTab[i]->ns->
|
||||
prefix,
|
||||
(char *) cur->nodesetval->nodeTab[i]->name);
|
||||
name[sizeof(name) - 1] = 0;
|
||||
valuePush(ctxt, xmlXPathNewCString(name));
|
||||
|
Reference in New Issue
Block a user