Re: [xml] Urgent!! ERROR of Invalid IODEF (DTD Error)

Bipin Mistry wrote:
I am creating XML with xmlTextWriter...() functions.
I Where by whole XML is written properly...
I debug mode when I see buf->content contents it shows me proper DTD tags.

By for sending it to server via HTTP I need to convert it to char *
strcpy(pXmlBuff, (const char *) buf->content);
Is the way I am converting it to char *, Which is making DTD tag with junk
sample... is in the file attached here with.

Where you can notice the "42ac10-extension" insted of "% x-extension"
"0-extension;]>" insted of "%x-extension;]>"

I am unable to know how to fix this prob...
Definately it is in some of my code...
Am I awrong at copying to char* , should i use sone other datatype...

I am an Japanese environment developer, dose this MBCS environemt is
these problems.

Please suggest some solution to this.


It looks like the "%x-extension" string is being passed to a function
like printf (perhaps you use sprintf() instead of strcpy?) - the %x is
then seen as a format specifier for a hexadecimal value, and the next
function argument (or whatever's on the stack if no argument is given)
is used to provide that value (here, you get 0x42ac10 and 0x0).

In general, it's bad practice to have code like

  printf (my_variable);

when my_variable is not known to be a valid printf format string; in
such cases,

  printf ("%s", my_variable);

should be used instead (same goes for sprintf and the other variants).

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