40 const int DEFAULT_PARSER_OPTIONS = XML_PARSE_NOENT |
51 pContext_ = xmlNewParserCtxt();
56 "XML Parser initialized incorrectly (Context is NULL)"};
63 xmlFreeParserCtxt(pContext_);
72 xmlInitParserCtxt(pContext_);
75 xmlDocPtr pDoc = xmlCtxtReadFile(pContext_,
78 DEFAULT_PARSER_OPTIONS);
82 throw makeException<ParseException>(
83 "Failed to parse document in %s.\n\n" 84 "Possible reason(s):\n" 85 " * Document '%s' does not exist.\n",
91 if (pContext_->valid == 0)
95 xmlDtdPtr pDTD = xmlGetIntSubset(pDoc);
98 makeException<ValidateException>(
99 "Failed to parse document in %s.\n\n" 100 "Possible reason(s):\n" 101 " * %s is missing'\n" 102 " * %s inaccessible (network unreachable/http down).\n" 103 " * %s is incorrect (run xmllint to validate).\n",
105 (pDTD ? (
const char *) pDTD->SystemID :
"DTD"),
106 (pDTD ? (
const char *) pDTD->SystemID :
"DTD"),
107 (pDTD ? (
const char *) pDTD->SystemID :
"DTD"))};
111 throw validationException;
Validation-specific type of the EMANEException.
xmlDocPtr parse(const std::string &sURI)
Parse-specific type of the EMANEException.