| OLD | NEW |
| 1 /* | 1 /* |
| 2 * relaxng.c : implementation of the Relax-NG handling and validity checking | 2 * relaxng.c : implementation of the Relax-NG handling and validity checking |
| 3 * | 3 * |
| 4 * See Copyright for the status of this software. | 4 * See Copyright for the status of this software. |
| 5 * | 5 * |
| 6 * Daniel Veillard <veillard@redhat.com> | 6 * Daniel Veillard <veillard@redhat.com> |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * TODO: | 10 * TODO: |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 * xmlRngPErr: | 500 * xmlRngPErr: |
| 501 * @ctxt: a Relax-NG parser context | 501 * @ctxt: a Relax-NG parser context |
| 502 * @node: the node raising the error | 502 * @node: the node raising the error |
| 503 * @error: the error code | 503 * @error: the error code |
| 504 * @msg: message | 504 * @msg: message |
| 505 * @str1: extra info | 505 * @str1: extra info |
| 506 * @str2: extra info | 506 * @str2: extra info |
| 507 * | 507 * |
| 508 * Handle a Relax NG Parsing error | 508 * Handle a Relax NG Parsing error |
| 509 */ | 509 */ |
| 510 static void | 510 static void LIBXML_ATTR_FORMAT(4,0) |
| 511 xmlRngPErr(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node, int error, | 511 xmlRngPErr(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node, int error, |
| 512 const char *msg, const xmlChar * str1, const xmlChar * str2) | 512 const char *msg, const xmlChar * str1, const xmlChar * str2) |
| 513 { | 513 { |
| 514 xmlStructuredErrorFunc schannel = NULL; | 514 xmlStructuredErrorFunc schannel = NULL; |
| 515 xmlGenericErrorFunc channel = NULL; | 515 xmlGenericErrorFunc channel = NULL; |
| 516 void *data = NULL; | 516 void *data = NULL; |
| 517 | 517 |
| 518 if (ctxt != NULL) { | 518 if (ctxt != NULL) { |
| 519 if (ctxt->serror != NULL) | 519 if (ctxt->serror != NULL) |
| 520 schannel = ctxt->serror; | 520 schannel = ctxt->serror; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 534 * xmlRngVErr: | 534 * xmlRngVErr: |
| 535 * @ctxt: a Relax-NG validation context | 535 * @ctxt: a Relax-NG validation context |
| 536 * @node: the node raising the error | 536 * @node: the node raising the error |
| 537 * @error: the error code | 537 * @error: the error code |
| 538 * @msg: message | 538 * @msg: message |
| 539 * @str1: extra info | 539 * @str1: extra info |
| 540 * @str2: extra info | 540 * @str2: extra info |
| 541 * | 541 * |
| 542 * Handle a Relax NG Validation error | 542 * Handle a Relax NG Validation error |
| 543 */ | 543 */ |
| 544 static void | 544 static void LIBXML_ATTR_FORMAT(4,0) |
| 545 xmlRngVErr(xmlRelaxNGValidCtxtPtr ctxt, xmlNodePtr node, int error, | 545 xmlRngVErr(xmlRelaxNGValidCtxtPtr ctxt, xmlNodePtr node, int error, |
| 546 const char *msg, const xmlChar * str1, const xmlChar * str2) | 546 const char *msg, const xmlChar * str1, const xmlChar * str2) |
| 547 { | 547 { |
| 548 xmlStructuredErrorFunc schannel = NULL; | 548 xmlStructuredErrorFunc schannel = NULL; |
| 549 xmlGenericErrorFunc channel = NULL; | 549 xmlGenericErrorFunc channel = NULL; |
| 550 void *data = NULL; | 550 void *data = NULL; |
| 551 | 551 |
| 552 if (ctxt != NULL) { | 552 if (ctxt != NULL) { |
| 553 if (ctxt->serror != NULL) | 553 if (ctxt->serror != NULL) |
| 554 schannel = ctxt->serror; | 554 schannel = ctxt->serror; |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2208 return (xmlCharStrdup("No top grammar defined\n")); | 2208 return (xmlCharStrdup("No top grammar defined\n")); |
| 2209 case XML_RELAXNG_ERR_EXTRADATA: | 2209 case XML_RELAXNG_ERR_EXTRADATA: |
| 2210 return (xmlCharStrdup("Extra data in the document\n")); | 2210 return (xmlCharStrdup("Extra data in the document\n")); |
| 2211 default: | 2211 default: |
| 2212 return (xmlCharStrdup("Unknown error !\n")); | 2212 return (xmlCharStrdup("Unknown error !\n")); |
| 2213 } | 2213 } |
| 2214 if (msg[0] == 0) { | 2214 if (msg[0] == 0) { |
| 2215 snprintf(msg, 1000, "Unknown error code %d\n", err); | 2215 snprintf(msg, 1000, "Unknown error code %d\n", err); |
| 2216 } | 2216 } |
| 2217 msg[1000 - 1] = 0; | 2217 msg[1000 - 1] = 0; |
| 2218 return (xmlStrdup((xmlChar *) msg)); | 2218 xmlChar *result = xmlCharStrdup(msg); |
| 2219 return (xmlEscapeFormatString(&result)); |
| 2219 } | 2220 } |
| 2220 | 2221 |
| 2221 /** | 2222 /** |
| 2222 * xmlRelaxNGShowValidError: | 2223 * xmlRelaxNGShowValidError: |
| 2223 * @ctxt: the validation context | 2224 * @ctxt: the validation context |
| 2224 * @err: the error number | 2225 * @err: the error number |
| 2225 * @node: the node | 2226 * @node: the node |
| 2226 * @child: the node child generating the problem. | 2227 * @child: the node child generating the problem. |
| 2227 * @arg1: the first argument | 2228 * @arg1: the first argument |
| 2228 * @arg2: the second argument | 2229 * @arg2: the second argument |
| (...skipping 8819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11048 * TODO: build error codes | 11049 * TODO: build error codes |
| 11049 */ | 11050 */ |
| 11050 if (ret == -1) | 11051 if (ret == -1) |
| 11051 return (1); | 11052 return (1); |
| 11052 return (ret); | 11053 return (ret); |
| 11053 } | 11054 } |
| 11054 | 11055 |
| 11055 #define bottom_relaxng | 11056 #define bottom_relaxng |
| 11056 #include "elfgcchack.h" | 11057 #include "elfgcchack.h" |
| 11057 #endif /* LIBXML_SCHEMAS_ENABLED */ | 11058 #endif /* LIBXML_SCHEMAS_ENABLED */ |
| OLD | NEW |