MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / validate_with_dtd

Function validate_with_dtd

lib/common/xml.c:2207–2248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2205}
2206
2207static gboolean
2208validate_with_dtd(
2209 xmlDocPtr doc, gboolean to_logs, const char *dtd_file)
2210{
2211 gboolean valid = TRUE;
2212
2213 xmlDtdPtr dtd = NULL;
2214 xmlValidCtxtPtr cvp = NULL;
2215
2216 CRM_CHECK(doc != NULL, return FALSE);
2217 CRM_CHECK(dtd_file != NULL, return FALSE);
2218
2219 dtd = xmlParseDTD(NULL, (const xmlChar *)dtd_file);
2220 CRM_CHECK(dtd != NULL, crm_err("Could not find/parse %s", dtd_file); goto cleanup);
2221
2222 cvp = xmlNewValidCtxt();
2223 CRM_CHECK(cvp != NULL, goto cleanup);
2224
2225 if(to_logs) {
2226 cvp->userData = (void *) LOG_ERR;
2227 cvp->error = (xmlValidityErrorFunc) xml_log;
2228 cvp->warning = (xmlValidityWarningFunc) xml_log;
2229 } else {
2230 cvp->userData = (void *) stderr;
2231 cvp->error = (xmlValidityErrorFunc) fprintf;
2232 cvp->warning = (xmlValidityWarningFunc) fprintf;
2233 }
2234
2235 if (!xmlValidateDtd(cvp, doc, dtd)) {
2236 valid = FALSE;
2237 }
2238
2239 cleanup:
2240 if(cvp) {
2241 xmlFreeValidCtxt(cvp);
2242 }
2243 if(dtd) {
2244 xmlFreeDtd(dtd);
2245 }
2246
2247 return valid;
2248}
2249
2250xmlNode *first_named_child(xmlNode *parent, const char *name)
2251{

Callers 1

validate_withFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected