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?
精彩评论