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

Function xmlXIncludeMergeEntities

ThirdParty/libxml2/vtklibxml2/xinclude.c:1241–1292  ·  view source on GitHub ↗

* xmlXIncludeMergeEntities: * @ctxt: an XInclude context * @doc: the including doc * @from: the included doc * * Implements the entity merge * * Returns 0 if merge succeeded, -1 if some processing failed */

Source from the content-addressed store, hash-verified

1239 * Returns 0 if merge succeeded, -1 if some processing failed
1240 */
1241static int
1242xmlXIncludeMergeEntities(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
1243 xmlDocPtr from) {
1244 xmlNodePtr cur;
1245 xmlDtdPtr target, source;
1246
1247 if (ctxt == NULL)
1248 return(-1);
1249
1250 if ((from == NULL) || (from->intSubset == NULL))
1251 return(0);
1252
1253 target = doc->intSubset;
1254 if (target == NULL) {
1255 cur = xmlDocGetRootElement(doc);
1256 if (cur == NULL)
1257 return(-1);
1258 target = xmlCreateIntSubset(doc, cur->name, NULL, NULL);
1259 if (target == NULL) {
1260 xmlXIncludeErrMemory(ctxt);
1261 return(-1);
1262 }
1263 }
1264
1265 source = from->intSubset;
1266 if ((source != NULL) && (source->entities != NULL)) {
1267 xmlXIncludeMergeData data;
1268
1269 data.ctxt = ctxt;
1270 data.doc = doc;
1271
1272 xmlHashScan((xmlHashTablePtr) source->entities,
1273 xmlXIncludeMergeEntity, &data);
1274 }
1275 source = from->extSubset;
1276 if ((source != NULL) && (source->entities != NULL)) {
1277 xmlXIncludeMergeData data;
1278
1279 data.ctxt = ctxt;
1280 data.doc = doc;
1281
1282 /*
1283 * don't duplicate existing stuff when external subsets are the same
1284 */
1285 if ((!xmlStrEqual(target->ExternalID, source->ExternalID)) &&
1286 (!xmlStrEqual(target->SystemID, source->SystemID))) {
1287 xmlHashScan((xmlHashTablePtr) source->entities,
1288 xmlXIncludeMergeEntity, &data);
1289 }
1290 }
1291 return(0);
1292}
1293
1294/**
1295 * xmlXIncludeLoadDoc:

Callers 1

xmlXIncludeLoadDocFunction · 0.85

Calls 5

xmlDocGetRootElementFunction · 0.85
xmlCreateIntSubsetFunction · 0.85
xmlXIncludeErrMemoryFunction · 0.85
xmlHashScanFunction · 0.85
xmlStrEqualFunction · 0.85

Tested by

no test coverage detected