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

Function xmlValidateCheckMixed

ThirdParty/libxml2/vtklibxml2/valid.c:5442–5496  ·  view source on GitHub ↗

* xmlValidateCheckMixed: * @ctxt: the validation context * @cont: the mixed content model * @qname: the qualified name as appearing in the serialization * * Check if the given node is part of the content model. * * Returns 1 if yes, 0 if no, -1 in case of error */

Source from the content-addressed store, hash-verified

5440 * Returns 1 if yes, 0 if no, -1 in case of error
5441 */
5442static int
5443xmlValidateCheckMixed(xmlValidCtxtPtr ctxt,
5444 xmlElementContentPtr cont, const xmlChar *qname) {
5445 const xmlChar *name;
5446 int plen;
5447 name = xmlSplitQName3(qname, &plen);
5448
5449 if (name == NULL) {
5450 while (cont != NULL) {
5451 if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
5452 if ((cont->prefix == NULL) && (xmlStrEqual(cont->name, qname)))
5453 return(1);
5454 } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
5455 (cont->c1 != NULL) &&
5456 (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
5457 if ((cont->c1->prefix == NULL) &&
5458 (xmlStrEqual(cont->c1->name, qname)))
5459 return(1);
5460 } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
5461 (cont->c1 == NULL) ||
5462 (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
5463 xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT,
5464 "Internal: MIXED struct corrupted\n",
5465 NULL);
5466 break;
5467 }
5468 cont = cont->c2;
5469 }
5470 } else {
5471 while (cont != NULL) {
5472 if (cont->type == XML_ELEMENT_CONTENT_ELEMENT) {
5473 if ((cont->prefix != NULL) &&
5474 (xmlStrncmp(cont->prefix, qname, plen) == 0) &&
5475 (xmlStrEqual(cont->name, name)))
5476 return(1);
5477 } else if ((cont->type == XML_ELEMENT_CONTENT_OR) &&
5478 (cont->c1 != NULL) &&
5479 (cont->c1->type == XML_ELEMENT_CONTENT_ELEMENT)){
5480 if ((cont->c1->prefix != NULL) &&
5481 (xmlStrncmp(cont->c1->prefix, qname, plen) == 0) &&
5482 (xmlStrEqual(cont->c1->name, name)))
5483 return(1);
5484 } else if ((cont->type != XML_ELEMENT_CONTENT_OR) ||
5485 (cont->c1 == NULL) ||
5486 (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){
5487 xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT,
5488 "Internal: MIXED struct corrupted\n",
5489 NULL);
5490 break;
5491 }
5492 cont = cont->c2;
5493 }
5494 }
5495 return(0);
5496}
5497#endif /* LIBXML_REGEXP_ENABLED */
5498
5499/**

Callers 1

xmlValidatePushElementFunction · 0.85

Calls 3

xmlSplitQName3Function · 0.85
xmlStrEqualFunction · 0.85
xmlStrncmpFunction · 0.85

Tested by

no test coverage detected