* xmlSchematronAddPattern: * @ctxt: the schema parsing context * @schema: a schema structure * @node: the node hosting the pattern * @id: the id or name of the pattern * * Add a pattern to a schematron * * Returns the new pointer or NULL in case of error */
| 557 | * Returns the new pointer or NULL in case of error |
| 558 | */ |
| 559 | static xmlSchematronPatternPtr |
| 560 | xmlSchematronAddPattern(xmlSchematronParserCtxtPtr ctxt, |
| 561 | xmlSchematronPtr schema, xmlNodePtr node, xmlChar *name) |
| 562 | { |
| 563 | xmlSchematronPatternPtr ret; |
| 564 | |
| 565 | if ((ctxt == NULL) || (schema == NULL) || (node == NULL) || (name == NULL)) |
| 566 | return(NULL); |
| 567 | |
| 568 | ret = (xmlSchematronPatternPtr) xmlMalloc(sizeof(xmlSchematronPattern)); |
| 569 | if (ret == NULL) { |
| 570 | xmlSchematronPErrMemory(ctxt); |
| 571 | return (NULL); |
| 572 | } |
| 573 | memset(ret, 0, sizeof(xmlSchematronPattern)); |
| 574 | ret->name = name; |
| 575 | ret->next = NULL; |
| 576 | if (schema->patterns == NULL) { |
| 577 | schema->patterns = ret; |
| 578 | } else { |
| 579 | xmlSchematronPatternPtr prev = schema->patterns; |
| 580 | |
| 581 | while (prev->next != NULL) |
| 582 | prev = prev->next; |
| 583 | prev->next = ret; |
| 584 | } |
| 585 | return (ret); |
| 586 | } |
| 587 | |
| 588 | /** |
| 589 | * xmlSchematronFreePatterns: |
no test coverage detected