| 4097 | */ |
| 4098 | |
| 4099 | int |
| 4100 | xmlValidateElementDecl(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, |
no test coverage detected