Re: [xml] libXML, C++ and reinterpret_cast

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Sun Oct 15 2000 - 15:44:59 EDT


On Sun, Oct 15, 2000 at 03:13:57PM -0400, Don Pellegrino wrote:
>
> I am using libXML with C++ and I have found that my code is very ugly
> due to reinterpret_cast's all over the place. The problem seems to
> be that xmlChar is an unsigned char and my c style strings are signed
> char's. So for example, to use xmlGetProp my commands look like this:
>
> xmlwidth = xmlGetProp(node,
> reinterpret_cast<const unsigned char *>
> ("width"));
>
> Is there a cleaner way to interact with xmlChar's without doing casts
> for all of it's occurances?

  no, one need to cast. It's a good reminder taht the sring has to be
made of UTF8 chars and not anything else !

> Also, is there a way to read and write numerics in the tree with
> libXML without using atoi and itoa?

  No, libxml don't have a type system more elaborated than XML-1.0
or DOM ... it's strings.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 16:43:15 EDT