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

Function xmlValidateElementDecl

ThirdParty/libxml2/vtklibxml2/valid.c:4099–4211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4097 */
4098
4099int
4100xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
4101 xmlElementPtr elem) {
4102 int ret = 1;
4103 xmlElementPtr tst;
4104 const xmlChar *localName;
4105 xmlChar *prefix;
4106
4107 CHECK_DTD;
4108
4109 if (elem == NULL) return(1);
4110
4111#if 0
4112#ifdef LIBXML_REGEXP_ENABLED
4113 /* Build the regexp associated to the content model */
4114 ret = xmlValidBuildContentModel(ctxt, elem);
4115#endif
4116#endif
4117
4118 /* No Duplicate Types */
4119 if (elem->etype == XML_ELEMENT_TYPE_MIXED) {
4120 xmlElementContentPtr cur, next;
4121 const xmlChar *name;
4122
4123 cur = elem->content;
4124 while (cur != NULL) {
4125 if (cur->type != XML_ELEMENT_CONTENT_OR) break;
4126 if (cur->c1 == NULL) break;
4127 if (cur->c1->type == XML_ELEMENT_CONTENT_ELEMENT) {
4128 name = cur->c1->name;
4129 next = cur->c2;
4130 while (next != NULL) {
4131 if (next->type == XML_ELEMENT_CONTENT_ELEMENT) {
4132 if ((xmlStrEqual(next->name, name)) &&
4133 (xmlStrEqual(next->prefix, cur->c1->prefix))) {
4134 if (cur->c1->prefix == NULL) {
4135 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4136 "Definition of %s has duplicate references of %s\n",
4137 elem->name, name, NULL);
4138 } else {
4139 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4140 "Definition of %s has duplicate references of %s:%s\n",
4141 elem->name, cur->c1->prefix, name);
4142 }
4143 ret = 0;
4144 }
4145 break;
4146 }
4147 if (next->c1 == NULL) break;
4148 if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break;
4149 if ((xmlStrEqual(next->c1->name, name)) &&
4150 (xmlStrEqual(next->c1->prefix, cur->c1->prefix))) {
4151 if (cur->c1->prefix == NULL) {
4152 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,
4153 "Definition of %s has duplicate references to %s\n",
4154 elem->name, name, NULL);
4155 } else {
4156 xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR,

Callers 1

xmlSAX2ElementDeclFunction · 0.85

Calls 5

xmlStrEqualFunction · 0.85
xmlSplitQName4Function · 0.85
xmlVErrMemoryFunction · 0.85
xmlHashLookup2Function · 0.85

Tested by

no test coverage detected