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

On Wed, May 25, 2005 at 09:12:08AM +0300, Antti Mäkinen wrote:
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 

  I'm a bit puzzled by your question. I do not know "STL Map", I have no idea
if this may have an influence. All I can tell is:
   - the xmlChar* string obtained from libxml2 is encoded in UTF-8
     (UTF-8 encoding and ASCII encoding match for characters in the ASCII range)
   - the string may be deallocated if you free the document or if you
     free the XPath object which was returned, I assume that's the
     problem you're facing.

   otherwise no idea.


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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