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

Function xmlValidateOneCdataElement

ThirdParty/libxml2/vtklibxml2/valid.c:5374–5429  ·  view source on GitHub ↗

* xmlValidateCdataElement: * @ctxt: the validation context * @doc: a document instance * @elem: an element instance * * Check that an element follows #CDATA * * returns 1 if valid or 0 otherwise */

Source from the content-addressed store, hash-verified

5372 * returns 1 if valid or 0 otherwise
5373 */
5374static int
5375xmlValidateOneCdataElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
5376 xmlNodePtr elem) {
5377 int ret = 1;
5378 xmlNodePtr cur, child;
5379
5380 if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) ||
5381 (elem->type != XML_ELEMENT_NODE))
5382 return(0);
5383
5384 child = elem->children;
5385
5386 cur = child;
5387 while (cur != NULL) {
5388 switch (cur->type) {
5389 case XML_ENTITY_REF_NODE:
5390 /*
5391 * Push the current node to be able to roll back
5392 * and process within the entity
5393 */
5394 if ((cur->children != NULL) &&
5395 (cur->children->children != NULL)) {
5396 nodeVPush(ctxt, cur);
5397 cur = cur->children->children;
5398 continue;
5399 }
5400 break;
5401 case XML_COMMENT_NODE:
5402 case XML_PI_NODE:
5403 case XML_TEXT_NODE:
5404 case XML_CDATA_SECTION_NODE:
5405 break;
5406 default:
5407 ret = 0;
5408 goto done;
5409 }
5410 /*
5411 * Switch to next element
5412 */
5413 cur = cur->next;
5414 while (cur == NULL) {
5415 cur = nodeVPop(ctxt);
5416 if (cur == NULL)
5417 break;
5418 cur = cur->next;
5419 }
5420 }
5421done:
5422 ctxt->nodeMax = 0;
5423 ctxt->nodeNr = 0;
5424 if (ctxt->nodeTab != NULL) {
5425 xmlFree(ctxt->nodeTab);
5426 ctxt->nodeTab = NULL;
5427 }
5428 return(ret);
5429}
5430
5431#ifdef LIBXML_REGEXP_ENABLED

Callers 1

xmlValidateOneElementFunction · 0.85

Calls 2

nodeVPushFunction · 0.85
nodeVPopFunction · 0.85

Tested by

no test coverage detected