[xml] Tutorial Troubles?



Hi all,

I'm trying to use libxml as an HTML parser for a project of mine, and
I'm running into some strange problems traversing the tree generated by
a call to:  

htmlParseFile(filename, NULL);

It seems that when I try to use xmlNodePtr's to get around the tree
after the return, I get a lot of null pointers.  For instance, if the
following code works:

node = xmlGetLastChild(node);

but 

node = node->children;

always gives a null value.  Also, 'node->next' is always null, but
'node->previous' does not seem to be.  I tried to use the tutorial, and
got a compile error:

getvalue.cc: In function `void getReference(xmlDoc *, xmlNode *)':
getvalue.cc:13: passing `const char *' as argument 2 of
`xmlGetProp(xmlNode *, const xmlChar *)' changes signedness

when I cast it, it compiled, but I get segmentation faults whenever I
run it.  I'm running a Gentoo system, and the libxml packages I have are
2.4.24 for libxml2 and 1.8.17 for libxml (these may be Gentoo package
numbers, unfortunately I'm not sure how they map to libxml version
numbers, or even if there is a difference).
I'm using gcc 2.95.3

Any help is greatly appreciated.

Thanks,

-Andrew

Attachment: signature.asc
Description: This is a digitally signed message part



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