[xml] How to create an ISO-8859-1 encoded xml file?
- From: Mark Ziegler <Mark Ziegler gmx de>
- To: xml gnome org
- Subject: [xml] How to create an ISO-8859-1 encoded xml file?
- Date: Wed, 11 Apr 2001 00:13:49 +0200
Hi,
actually I'm tring to produce a XML-file using libxml2-2.3.5:
<?xml version="1.0" encoding="ISO-8859-1"?>
<info>abc</info>
I wrote the following code for this job:
void DoIt(void)
{
xmlDocPtr doc;
xmlNodePtr n;
doc = xmlNewDoc("1.0");
n = xmlNewNode(NULL, "info");
xmlNodeSetContent(n, "abc");
xmlDocSetRootElement(doc, n);
xmlSaveFileEnc("test.xml",doc,"ISO-8859-1");
xmlFreeDoc(*pDoc);
}
But the result ist a runtime-error message:
"xmlSaveFileEnc: document not in UTF8 "
Why this? I think, all charactars are hold internally as UTF8?
Therefore my 1. question:
How to modify the code to get my "encoding=..." headline?
2. question:
What to do to insert german characters in the output (to get the following
result):
<?xml version="1.0" encoding="ISO-8859-1"?>
<info>äüö</info>
Thanks a lot for every advise
Mark
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]