[xml] LoadExternalEntity

Hello everyone,
I am an novice to libxml library.
When I trying to parse some xml and html files, I encounter a problem that there are entities in html can't be recognized by xmlparser, such as   and ¢
After lots of searching, I had found I have to load external entity to resolve these entities.

The following is the code I have tried in objective C:
The variable data can be regard as a input file.
xmlParserCtxtPtr ctxt= xmlCreateMemoryParserCtxt([data bytes], [data length]); xmlLoadExternalEntity("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", "HTMLlat1", ctxt); xmlLoadExternalEntity("http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent", "HTMLspecial", ctxt); xmlLoadExternalEntity("http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent", "HTMLsymbol", ctxt);
docNode = xmlCtxtReadMemory(ctxt, [data bytes], [data length], NULL, NULL, 5);

However, the entities still can't be resolved. Does I misunderstood the usage of the API?

By the way, I have tried to use html parser instead, but there is another problem: html parser can't recognized xlink tag that defined in xml. Does there some parameter or function to solve this problem?

Any Help Apperciated! 

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