[xml] Hi, two questions



Hi,

I'm using libxml2 for parsing a file. Whether my file
is like this:

<node>
  some text
</node>

<node>some text</node>

How can I do if I want to get node's contents without
carriage returns? I've been trying with
xmlKeepBlanksDefault, but it doesn't seem to be te
correct option, and haven't seen anyother one for
this.

My second question is, I'm filling up a linked list as
xml parses the file. I've implemented a *traverse*
function, so I can see this was done successfuly.

Everything works fine but for the last variable within
my list, which is a char *image. This node can be
present on my block or can be not (depending if there
is an image associated with my data's block).

The thing is, when I print it as xml parses it's ok.
But in my traverse function, it gives me segfault.

I tried to use gdb, set ulimit -c unlimited, and this
is what it says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 2811)]
0xb7df95de in _IO_vfprintf (s=0xb7eb0180,
format=0x8049766 "    Image: %s\n", ap=0xbffff9cc)
    at vfprintf.c:1528
1528    vfprintf.c: Not such file or directory
        in vfprintf.c

In my traverse I've got:

  if(data->image)
    printf("image: %s\n", data->image);

I'm not an xml expert (as you can notice), but I've
used libxml before for small things and this never
happened before. Could anyone please tell me why does
this occur?

Kind Regards, and happy new year.


                
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. 
http://uk.security.yahoo.com



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