Hi,

 I know this issue might have been asked a thousand times over, but  I am not 
able to resolve the issue. My situation is this.


1.       I have an xml file called b.xml whose encoding attribute is UTF-16. 
(attached along with this email)

2.       I embed this file as a resource into my visual studio project.

3.       When the project starts up, I read this file into a variable and need 
to pass it to Libxml2 to parse. How do I accomplish it?

The problems:


1.       I cannot read the file into a char* as this file contains  wide 
characters. So I load them on to a wstring.  After which I realized  Libxml2 
constraints of not allowing wchar strings. So I am trying to convert my wchar* 
to char* .

2.       Again I have 2 options here : either bad cast it or use 
WidetoMultiByte to convert to char*. I did both of them.



3.       After this,  I called XmlReadMemory API in which I understand I can 
specify the encoding. I  gave NULL and UTF-16 in 2 separate attempts.



4.       At the end of it, I cannot correctly parse and I get a NULL xmlDocPtr. 
Any ideas on how should I go about solving this?


Thanks,
Ram


ÿþ<?xml version="1.0" encoding="utf-16"?>

<SoftwareComponent> Sample Text

  

</SoftwareComponent>
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to