[xml] xmlSplitQName2 problem and patch
- From: Aleksey Sanin <aleksey aleksey com>
- To: xml <xml gnome org>
- Subject: [xml] xmlSplitQName2 problem and patch
- Date: Tue, 17 Feb 2004 16:17:44 -0800
Daniel,
I think I found a small problem with xmlSplitQName2() function and I would
lake to confirm with you that this is actually a bug. The
xmlSplitQName2() function
returns NULL when QName does not have a prefix and this sounds wrong to me.
Prefix in QName is optional and a QName with Local Part only (for
example, "foo") is
a valid QName. The xmlSplitQName2() function in this case should just
return
the Local Part and set prefix to NULL.
Thanks,
Aleksey
Index: tree.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/tree.c,v
retrieving revision 1.305
diff -u -r1.305 tree.c
--- tree.c 11 Feb 2004 13:25:00 -0000 1.305
+++ tree.c 18 Feb 2004 00:25:28 -0000
@@ -263,9 +263,16 @@
while ((name[len] != 0) && (name[len] != ':'))
len++;
- if (name[len] == 0)
- return(NULL);
-
+ if (name[len] == 0) {
+ /* we don't have prefix */
+ ret = xmlStrdup(name);
+ if (ret == NULL) {
+ xmlTreeErrMemory("QName split");
+ return(NULL);
+ }
+ return(ret);
+ }
+
*prefix = xmlStrndup(name, len);
if (*prefix == NULL) {
xmlTreeErrMemory("QName split");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]