xmlParseFile vs xmlReadFile (libxml2)

对着背影说爱祢 提交于 2019-12-06 11:55:34

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().

xmlReadFile() is more powerful and latest version for parsing the XML. I am also using it in place of xmlParseFile().

I have xml arriving in character buffer 'msg' on TCP pipe so I use libxml2 call xmlReadDoc() instead as following with options XML_PARSE_NOBLANKS and XML_PARSE_OLD10

xmlDocPtr parsed_xml_dom;
parsed_xml_dom = xmlReadDoc((xmlChar *)(msg), NULL, NULL, XML_PARSE_NOBLANKS| XML_PARSE_OLD10);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!