[xml] Problems with xmlChar* as a key in STL Map



Hi,

I have a problem after getting an xmlChar* from a node with XPath. I manage 
to get the xmlChar* (for example "and", "or", "not") easily from the node, 
but the problems arise, when I use the acquired xmlChar* as a key in a STL 
Map.

If I compare the the acquired xmlChar* with another xmlChar*, which is 
created like... 

  xmlChar* test = BAD_CAST "and";

...with xmlStrcmp, the result is that the strings are the same. This test 
string I can use for searching a certain key in STL Map and it works. Why 
is it, that the xmlChar* acquired with XPath from a node does not work when 
trying to find a key in STL Map? Does that have something to do with 
encoding or what, or with the method that STL Map uses for comparing 
strings?

sincerely,
Antti Mäkinen







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