| 2416 | } |
| 2417 | |
| 2418 | static 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> |
| 2450 | static void dump_file(const char *filename) |
no test coverage detected