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

Function xmlValidateElementContent

ThirdParty/libxml2/vtklibxml2/valid.c:5078–5362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5076 */
5077
5078static int
5079xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
5080 xmlElementPtr elemDecl, int warn, xmlNodePtr parent) {
5081 int ret = 1;
5082#ifndef LIBXML_REGEXP_ENABLED
5083 xmlNodePtr repl = NULL, last = NULL, tmp;
5084#endif
5085 xmlNodePtr cur;
5086 xmlElementContentPtr cont;
5087 const xmlChar *name;
5088
5089 if ((elemDecl == NULL) || (parent == NULL) || (ctxt == NULL))
5090 return(-1);
5091 cont = elemDecl->content;
5092 name = elemDecl->name;
5093
5094#ifdef LIBXML_REGEXP_ENABLED
5095 /* Build the regexp associated to the content model */
5096 if (elemDecl->contModel == NULL)
5097 ret = xmlValidBuildContentModel(ctxt, elemDecl);
5098 if (elemDecl->contModel == NULL) {
5099 return(-1);
5100 } else {
5101 xmlRegExecCtxtPtr exec;
5102
5103 if (!xmlRegexpIsDeterminist(elemDecl->contModel)) {
5104 return(-1);
5105 }
5106 ctxt->nodeMax = 0;
5107 ctxt->nodeNr = 0;
5108 ctxt->nodeTab = NULL;
5109 exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL);
5110 if (exec == NULL) {
5111 xmlVErrMemory(ctxt);
5112 return(-1);
5113 }
5114 cur = child;
5115 while (cur != NULL) {
5116 switch (cur->type) {
5117 case XML_ENTITY_REF_NODE:
5118 /*
5119 * Push the current node to be able to roll back
5120 * and process within the entity
5121 */
5122 if ((cur->children != NULL) &&
5123 (cur->children->children != NULL)) {
5124 nodeVPush(ctxt, cur);
5125 cur = cur->children->children;
5126 continue;
5127 }
5128 break;
5129 case XML_TEXT_NODE:
5130 if (xmlIsBlankNode(cur))
5131 break;
5132 ret = 0;
5133 goto fail;
5134 case XML_CDATA_SECTION_NODE:
5135 /* TODO */

Callers 1

xmlValidateOneElementFunction · 0.85

Calls 15

xmlRegexpIsDeterministFunction · 0.85
xmlRegNewExecCtxtFunction · 0.85
xmlVErrMemoryFunction · 0.85
nodeVPushFunction · 0.85
xmlIsBlankNodeFunction · 0.85
xmlBuildQNameFunction · 0.85
xmlRegExecPushStringFunction · 0.85
nodeVPopFunction · 0.85
xmlRegFreeExecCtxtFunction · 0.85
xmlValidateElementTypeFunction · 0.85

Tested by

no test coverage detected