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

Function xmlValidateElement

ThirdParty/libxml2/vtklibxml2/valid.c:6208–6271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6206 */
6207
6208int
6209xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr root) {
6210 xmlNodePtr elem;
6211 xmlAttrPtr attr;
6212 xmlNsPtr ns;
6213 const xmlChar *value;
6214 int ret = 1;
6215
6216 if (root == NULL) return(0);
6217
6218 CHECK_DTD;
6219
6220 elem = root;
6221 while (1) {
6222 ret &= xmlValidateOneElement(ctxt, doc, elem);
6223
6224 if (elem->type == XML_ELEMENT_NODE) {
6225 attr = elem->properties;
6226 while (attr != NULL) {
6227 if (attr->children == NULL)
6228 value = xmlStrdup(BAD_CAST "");
6229 else
6230 value = xmlNodeListGetString(doc, attr->children, 0);
6231 if (value == NULL) {
6232 xmlVErrMemory(ctxt);
6233 ret = 0;
6234 } else {
6235 ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
6236 xmlFree((char *)value);
6237 }
6238 attr= attr->next;
6239 }
6240
6241 ns = elem->nsDef;
6242 while (ns != NULL) {
6243 if (elem->ns == NULL)
6244 ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
6245 ns, ns->href);
6246 else
6247 ret &= xmlValidateOneNamespace(ctxt, doc, elem,
6248 elem->ns->prefix, ns,
6249 ns->href);
6250 ns = ns->next;
6251 }
6252
6253 if (elem->children != NULL) {
6254 elem = elem->children;
6255 continue;
6256 }
6257 }
6258
6259 while (1) {
6260 if (elem == root)
6261 goto done;
6262 if (elem->next != NULL)
6263 break;
6264 elem = elem->parent;
6265 }

Callers 2

xmlValidateDtdFunction · 0.85
xmlValidateDocumentFunction · 0.85

Calls 6

xmlValidateOneElementFunction · 0.85
xmlStrdupFunction · 0.85
xmlNodeListGetStringFunction · 0.85
xmlVErrMemoryFunction · 0.85
xmlValidateOneAttributeFunction · 0.85
xmlValidateOneNamespaceFunction · 0.85

Tested by

no test coverage detected