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

Function xmlValidateOneNamespace

ThirdParty/libxml2/vtklibxml2/valid.c:4411–4616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4409 */
4410
4411int
4412xmlValidateOneNamespace(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
4413xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
4414 /* xmlElementPtr elemDecl; */
4415 xmlAttributePtr attrDecl = NULL;
4416 int val;
4417 int ret = 1;
4418
4419 CHECK_DTD;
4420 if ((elem == NULL) || (elem->name == NULL)) return(0);
4421 if ((ns == NULL) || (ns->href == NULL)) return(0);
4422
4423 if (prefix != NULL) {
4424 xmlChar fn[50];
4425 xmlChar *fullname;
4426
4427 fullname = xmlBuildQName(elem->name, prefix, fn, 50);
4428 if (fullname == NULL) {
4429 xmlVErrMemory(ctxt);
4430 return(0);
4431 }
4432 if (ns->prefix != NULL) {
4433 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, fullname,
4434 ns->prefix, BAD_CAST "xmlns");
4435 if ((attrDecl == NULL) && (doc->extSubset != NULL))
4436 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, fullname,
4437 ns->prefix, BAD_CAST "xmlns");
4438 } else {
4439 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, fullname,
4440 BAD_CAST "xmlns", NULL);
4441 if ((attrDecl == NULL) && (doc->extSubset != NULL))
4442 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, fullname,
4443 BAD_CAST "xmlns", NULL);
4444 }
4445 if ((fullname != fn) && (fullname != elem->name))
4446 xmlFree(fullname);
4447 }
4448 if (attrDecl == NULL) {
4449 if (ns->prefix != NULL) {
4450 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
4451 ns->prefix, BAD_CAST "xmlns");
4452 if ((attrDecl == NULL) && (doc->extSubset != NULL))
4453 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
4454 ns->prefix, BAD_CAST "xmlns");
4455 } else {
4456 attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, elem->name,
4457 BAD_CAST "xmlns", NULL);
4458 if ((attrDecl == NULL) && (doc->extSubset != NULL))
4459 attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, elem->name,
4460 BAD_CAST "xmlns", NULL);
4461 }
4462 }
4463
4464
4465 /* Validity Constraint: Attribute Value Type */
4466 if (attrDecl == NULL) {
4467 if (ns->prefix != NULL) {
4468 xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_ATTRIBUTE,

Callers 3

xmlValidateElementFunction · 0.85
ifFunction · 0.85
xmlSAX2StartElementNsFunction · 0.85

Calls 9

xmlBuildQNameFunction · 0.85
xmlVErrMemoryFunction · 0.85
xmlGetDtdQAttrDescFunction · 0.85
xmlStrEqualFunction · 0.85
xmlAddIDFunction · 0.85
xmlAddRefFunction · 0.85
xmlGetDtdNotationDescFunction · 0.85

Tested by

no test coverage detected