简体   繁体   中英

How to fix “I/O warning : failed to load external entity ”file.xml“”? libxml2, macOS

Whenever I'm trying to run the executable file of my C programme I'm getting the same warning when it should load an XML file: I/O warning : failed to load external entity "file.xml"", etc.

I've checked the working directory and it's fine. Every solution I've seen here is for PHP and sadly doesn't apply here. Everything works correctly in build mode.

I'm including the library with:

#include <libxml/parser.h>

And then opening the files with:

xmlDoc *node_file1 = xmlReadFile(FILENAME_ONE, NULL, 0);
xmlNode *root_el = xmlDocGetRootElement(node_file1);
  1. Right click on the executables like this image and select show in finder. Right click on the executables

  2. Place your XML file in the same location as the executables. xml and exe file in the same directory

  3. Run the project. Hope that will fix the problem

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