[xml] How to create an ISO-8859-1 encoded xml file?


actually I'm tring to produce a XML-file using libxml2-2.3.5:

<?xml version="1.0" encoding="ISO-8859-1"?>

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);

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 
<?xml version="1.0" encoding="ISO-8859-1"?>

Thanks a lot for every advise


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