简体   繁体   中英

Reading XML by LIBXML2 issue

When i tried to read xml by c program i use libxml2 . but i am facing error in xmlparsefile is there any problem with predefined function xmlparsefile ?

xmlDocPtr doc;
xmlNodePtr cur;
doc = xmlParseFile("sample.xml");//here doc cannot read anything..
if (doc == NULL ) 
{
    fprintf(stderr,"Document not parsed successfully. \n");
    xmlFreeDoc(doc);
    return;
}
cur = xmlDocGetRootElement(doc);//Unhandled Exception occurs

Could anyone please help to solve this issue?

Why do you have a backquote before xmlDocPtr ? However, giving it absolute path of the file should fix the problem. Say you have the file sample.txt in /home/Desktop/MyDocsSample/sample.txt , then you should give the parser the absolute path.

EDIT

The link I told you in the comment He seem to have your same issue

Edit 2

msvcrt.dll and msvcp60.dll If you didn't have these dlls course your installation crashed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM