Re: [xml] xmlTextReaderConstValue



On Thu, Jan 04, 2007 at 04:46:53PM -0500, Benyounes, Mohamed wrote:
Hi,

Here is an example of a xml node I am trying to parse: 

<thisNode>  </thisNode>

 

I am using xmlTextReaderConstValue to read the value of thisNode. The
problem is that if the node is made of only 1 or more spaces only, this
function returns a NULL. My question is, is there another function that

  WRONG !

paphio:~/XML -> cat tst.xml
<thisNode>  </thisNode>
paphio:~/XML -> gdb xmllint 
GNU gdb Red Hat Linux (6.5-16.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) b xmlTextReaderConstValue
Breakpoint 1 at 0x80efa15: file xmlreader.c, line 3529.
(gdb) r --stream --debug tst.xml
Starting program: /u/veillard/XML/xmllint --stream --debug tst.xml

Breakpoint 1, xmlTextReaderConstValue (reader=0x8732c70) at xmlreader.c:3529
3529        if (reader == NULL)
(gdb) c
Continuing.
0 1 thisNode 0 0

Breakpoint 1, xmlTextReaderConstValue (reader=0x8732c70) at xmlreader.c:3529
3529        if (reader == NULL)
(gdb) finish
Run till exit from #0  xmlTextReaderConstValue (reader=0x8732c70)
    at xmlreader.c:3529
0x0804a6a7 in processNode (reader=0x8732c70) at xmllint.c:1728
1728            value = xmlTextReaderConstValue(reader);
Value returned is $1 = (const xmlChar *) 0x87363f4 "  "
(gdb) 

  on the second node, the #text one, the value returned is the text content
not NULL. I.e. libxml2 operates as expected.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]