[xml] xmlParseFile;encode - newbie question



Hi

I'm using libxml2-2.6.17 and my question is:

If I parse a file and there is an ampersand '&' in one of the elements, then the function xmlParseFile return NULL.
If I change the & to & or remove it, then it works.

So I guess I must encode/convert the data in the file first before sending it to xmlParseFile.

How will I encode the data?

xml data:

....
<name>Murray & Karl</name>
....


c code:

xmlDocPtr doc;

doc = xmlParseFile("myfile.xml");

if (doc == NULL)
   printf("Error parsing file");
else
   //run through tree


Thanks in advance


Regards,
Pieter




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