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

Function validate_with

lib/common/xml.c:2418–2447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2416}
2417
2418static gboolean validate_with(xmlNode *xml, int method, gboolean to_logs)
2419{
2420 xmlDocPtr doc = NULL;
2421 gboolean valid = FALSE;
2422 int type = known_schemas[method].type;
2423 char *file = NULL;
2424
2425 CRM_CHECK(xml != NULL, return FALSE);
2426 doc = getDocPtr(xml);
2427 file = get_schema_path(known_schemas[method].location);
2428
2429 crm_trace("Validating with: %s (type=%d)", crm_str(file), type);
2430 switch(type) {
2431 case 0:
2432 valid = TRUE;
2433 break;
2434 case 1:
2435 valid = validate_with_dtd(doc, to_logs, file);
2436 break;
2437 case 2:
2438 valid = validate_with_relaxng(doc, to_logs, file, (relaxng_ctx_cache_t**)&(known_schemas[method].cache));
2439 break;
2440 default:
2441 crm_err("Unknown validator type: %d", type);
2442 break;
2443 }
2444
2445 free(file);
2446 return valid;
2447}
2448
2449#include <stdio.h>
2450static void dump_file(const char *filename)

Callers 2

validate_xmlFunction · 0.85
update_validationFunction · 0.85

Calls 4

getDocPtrFunction · 0.85
get_schema_pathFunction · 0.85
validate_with_dtdFunction · 0.85
validate_with_relaxngFunction · 0.85

Tested by

no test coverage detected