[libxml++] Re: Problems using libxml++



Hi,

Bastian_Pfennigschmidt/CODESCO/DE codesco com wrote:


Hello,

I've tried to read and write an XML file using your great library - but I'm running into some problems,
it would be very nice, if you could give me some code snippets.


Did you have a look to the examples ? If you think something important is missing in it, just tell us.

Here are my problems:

1. When I create an XML using write_to_string or write_to_file and there are special characters, like German umlauts, they are not converted into entities. The XML file is UTF-8 encoded.

mXMLParser->get_document()->write_to_string("UTF-8");

When I try to parse the output, I got a parsing error, because the special characters are not valid in UTF-8.


Don't forget that in-memory libxml++ encoding is supposed to be UTF-8. Any call to a function of the API is waiting for UTF-8 encoded strings. So if you gave it ISO-xxx encoded string with special characters this probably led to your problem.


And my second problem:

I'm using write_to_file_formatted to get a formated file. If I use write_to_file I get a document with only to lines. But if I parse this formatted file again and write it back to file, the formatting are gone (see my attachment).


The formatting was gone with write_to_file_formatted ? Or did you use write_to_file the second time ?



Many thanks for your help


Your welcome.

BTW please use the mailing list next time you need help.


Cheers,

Christophe






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