开发者

failed to load external entity xml file

开发者 https://www.devze.com 2023-01-28 20:50 出处:网络
I am parsing xml file by using libxml2.0, the code is below here. I 开发者_开发百科am getting error as Failed to load external entity.

I am parsing xml file by using libxml2.0, the code is below here.

I 开发者_开发百科am getting error as Failed to load external entity.

xmlDocPtr xmlDocumentPtr = xmlParseFile(inXMLFilePath.c_str()); 

I am getting null for the pointer xmlDocPtr xmlDocumentPtr;

What could be the reason for this?


Does the XML have a DTD? The DTD could be embedded or included by reference to a URI. The error implies that the DTD has an external entity and libxml2 could not find the definition for it. Check the DTD for <!ENTITY entity_name ...>. The entity declaration may refer to a URI that could not be found.

Another possiblity is that the XML references a entity without a declaration in any DTD e.g. &entity_name; appears in the XML but there is no corresponding <!ENTITY entity_name ...> declaration.

Also the error message should have had the name of the entity or the URI of the DTD after it. Did it?

0

精彩评论

暂无评论...
验证码 换一张
取 消