Re: [xml] best way of converting xmlChar* to char*



On Wed, Dec 23, 2009 at 10:40:21AM -0500, Michel Audette wrote:
Dear fellow XML developers,

I was able to find a way of converting from char* to xmlChar* via
xmlCharStrdup, but my collaborators and I were wondering if there were
a function that does the reverser conversion, from xmlChar* to char*,
other than a cast.

  http://xmlsoft.org/FAQ.html#Developer item 12

We prefer to do this with a function than a cast if possible.

  If you're asking for a function, then that means you didn't
understand the concept behind xmlChar*

  If your char * points to a zero terminated string in UTF-8 encoding
then a cast *is* the proper way. If it's not that will depend on your
encoding and no generic function can do it one way or another, except
an encoding conversion function like iconv.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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