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

Function xmlCheckDefaultedAttributes

ThirdParty/libxml2/vtklibxml2/SAX2.c:1318–1466  ·  view source on GitHub ↗

* xmlCheckDefaultedAttributes: * * Check defaulted attributes from the DTD */

Source from the content-addressed store, hash-verified

1316 * Check defaulted attributes from the DTD
1317 */
1318static void
1319xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name,
1320 const xmlChar *prefix, const xmlChar **atts) {
1321 xmlElementPtr elemDecl;
1322 const xmlChar *att;
1323 int internal = 1;
1324 int i;
1325
1326 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix);
1327 if (elemDecl == NULL) {
1328 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix);
1329 internal = 0;
1330 }
1331
1332process_external_subset:
1333
1334 if (elemDecl != NULL) {
1335 xmlAttributePtr attr = elemDecl->attributes;
1336 /*
1337 * Check against defaulted attributes from the external subset
1338 * if the document is stamped as standalone
1339 */
1340 if ((ctxt->myDoc->standalone == 1) &&
1341 (ctxt->myDoc->extSubset != NULL) &&
1342 (ctxt->validate)) {
1343 while (attr != NULL) {
1344 if ((attr->defaultValue != NULL) &&
1345 (xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset,
1346 attr->elem, attr->name,
1347 attr->prefix) == attr) &&
1348 (xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
1349 attr->elem, attr->name,
1350 attr->prefix) == NULL)) {
1351 xmlChar *fulln;
1352
1353 if (attr->prefix != NULL) {
1354 fulln = xmlStrdup(attr->prefix);
1355 if (fulln != NULL)
1356 fulln = xmlStrcat(fulln, BAD_CAST ":");
1357 if (fulln != NULL)
1358 fulln = xmlStrcat(fulln, attr->name);
1359 } else {
1360 fulln = xmlStrdup(attr->name);
1361 }
1362 if (fulln == NULL) {
1363 xmlSAX2ErrMemory(ctxt);
1364 break;
1365 }
1366
1367 /*
1368 * Check that the attribute is not declared in the
1369 * serialization
1370 */
1371 att = NULL;
1372 if (atts != NULL) {
1373 i = 0;
1374 att = atts[i];
1375 while (att != NULL) {

Callers 1

xmlSAX2StartElementFunction · 0.85

Calls 7

xmlGetDtdQElementDescFunction · 0.85
xmlGetDtdQAttrDescFunction · 0.85
xmlStrdupFunction · 0.85
xmlStrcatFunction · 0.85
xmlSAX2ErrMemoryFunction · 0.85
xmlStrEqualFunction · 0.85
xmlBuildQNameFunction · 0.85

Tested by

no test coverage detected