Re: [xml] Converting to xmlChar type

On Mon, 21 Feb 2005 11:55:53 -0600, Thomas Jones <admin buddhalinux org> wrote:
Hello all,

I am having issues trying to convert a character string to the xmlChar data
type. Admittedly, I am a new programmer so please bear with me --- I am
trying to figure this out as much as possible on my end. Here is the code
snippets that apply:


static const char* gdsXMLSource;

GenDigSig::GenDigSig(const char* UserXML, const char* UserKey, const char*

   gdsXMLSource = UserXML;
   gdsKeySource = UserKey;
   gdsCertificateSource = UserCert;

doc = xmlParseFile(GenDigSig::getGenDigSigXMLSource());
   if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
       fprintf(stderr, "Error: unable to parse file \"%s\"\n",
       goto done;

Here is the resultant error:

error: invalid conversion from `const char*' to `const  xmlChar*'

I had read in one post that I may need to utilize iconv. But am not sure if it
applies to my issue(s).

I think you should just be able to do:

doc = xmlParseFile(BAD_CAST GenDigSig::getGenDigSigXMLSource());

But I'm not sure it's a good idea. Could anyone more experienced
comment on this? I'm new to libxml2 myself.

Best regards,
Aron Stansvik

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