* xmlParseCRNG_bindDatatypePrefix: * @ctxt: a compact RNG parser context * @prefix: the datatype prefix * @namespace: the datatype identifier * * implements bindDatatypePrefix of the RELAX NG Compact Syntax Appendix A * * Returns 0 in case of success and -1 in case of error */
| 522 | * Returns 0 in case of success and -1 in case of error |
| 523 | */ |
| 524 | static int |
| 525 | xmlParseCRNG_bindDatatypePrefix(xmlCRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED, |
| 526 | const xmlChar *prefix, |
| 527 | const xmlChar *namespace) |
| 528 | { |
| 529 | int ret; |
| 530 | |
| 531 | if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xsd")) && |
| 532 | (!xmlStrEqual(namespace, |
| 533 | BAD_CAST "http://www.w3.org/2001/XMLSchema-datatypes"))) { |
| 534 | ERROR("The \"xsd\" prefix must be bound to \"http://www.w3.org/2001/XMLSchema-datatypes\""); |
| 535 | return(-1); |
| 536 | } |
| 537 | if (ctxt->datatypes == NULL) |
| 538 | ctxt->datatypes = xmlHashCreate(10); |
| 539 | if (ctxt->datatypes == NULL) { |
| 540 | ERROR("Failed to create namespace hash table"); |
| 541 | return(-1); |
| 542 | } |
| 543 | ret = xmlHashAddEntry(ctxt->datatypes, prefix, |
| 544 | (void *) namespace); |
| 545 | if (ret < 0) { |
| 546 | ERROR("Redefinition of datatype"); |
| 547 | return(-1); |
| 548 | } |
| 549 | return(0); |
| 550 | } |
| 551 | |
| 552 | /** |
| 553 | * xmlParseCRNG_lookupPrefix: |
no test coverage detected