xmlParseFile VS xmlReadFile(libxml2的) [英] xmlParseFile vs xmlReadFile (libxml2)

查看:675
本文介绍了xmlParseFile VS xmlReadFile(libxml2的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的libxml2库读取XML文件中写入一些C code。似乎有为此两个不同的功能, xmlParseFile 和<一个HREF =htt​​p://xmlsoft.org/html/libxml-parser.html#xmlReadFile相对=nofollow> xmlReadFile 以及和我不知道它们之间的区别(除了一个事实,即xmlReadFile()需要一些额外的参数)。

I'm writing some C code using the libxml2 library to read an XML file. There seem to be two different functions for this purpose, xmlParseFile and xmlReadFile, and and I'm not sure of the difference between them (besides the fact that xmlReadFile() takes some additional parameters).

在libxml2的网站上的例子有时使用xmlParseFile和一些使用xmlReadFile。

The examples on the libxml2 website sometimes use xmlParseFile and some use xmlReadFile.

所以,当你应该使用xmlParseFile,你应该使用时xmlReadFile?
我一直没能找到任何解释这一点。

So when should you use xmlParseFile and when should you use xmlReadFile? I haven't been able to find anything that explains this.

推荐答案

xmlReadFile()是有点更强大,因为它是能够采取的网址,而不是一个本地文件路径,并允许指定更多的选择(的 http://xmlsoft.org/html/libxml-parser.html#xmlParserOption ),所以我倾向于用它代替xmlParseFile的()。也就是说,如果你正在分析本地XML文件,而不是使用分析器选项,您将被罚款与xmlParseFile()。

xmlReadFile() is a bit more powerful as it is able to take an URL instead of a local file path, and allows to specify more options (http://xmlsoft.org/html/libxml-parser.html#xmlParserOption), so I tend to use it instead of xmlParseFile(). That said, if you are parsing a local XML file and not using the parser options, you will be fine with xmlParseFile().

这篇关于xmlParseFile VS xmlReadFile(libxml2的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆