MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSchematronAddPattern

Function xmlSchematronAddPattern

ThirdParty/libxml2/vtklibxml2/schematron.c:559–586  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

557 * Returns the new pointer or NULL in case of error
558 */
559static xmlSchematronPatternPtr
560xmlSchematronAddPattern(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:

Callers 1

Calls 1

xmlSchematronPErrMemoryFunction · 0.85

Tested by

no test coverage detected