0
我正在使用libxml来解析xml响应。我发现libxml通过读取xml文件头来检测编码。但我找不到如何获取检测encoding.I做了以下获得的libxml检测编码:如何使用libXML获取xml文件中的编码?
xmlCreatePushParserCtxt(&simpleSAXHandlerStruct, (__bridge void *)(self), [data bytes], [data length], NULL);
我碰到
xmlDetectCharEncoding(const unsigned char * in, int len)
返回检测到的编码,但不是来自第一行xml文件。
有什么想法?
感谢您的回应!你指出我正确的方向。我尝试了xmlParserCtxtPtr结构的myDoc属性。但它给了我空。还有xmlParserCtxtPtr结构的“编码”属性。这与你所指的一样吗? – iosDeveloper
@Jignesh看到我编辑的答案。 – nwellnhof
谢谢nwellnhof!我这样做,我相信第一块肯定会得到XML头异步加载数据... – iosDeveloper