void CellmlFile::retrieveCmetaIdsFromCellmlElement(iface::cellml_api::CellMLElement *pElement) { // Keep track of the given CellML element's cmeta:id QString cmetaId = QString::fromStdWString(pElement->cmetaId()); if (!cmetaId.isEmpty()) mUsedCmetaIds << cmetaId; // Do the same for all the child elements of the given CellML element ObjRef<iface::cellml_api::CellMLElementSet> childElements = pElement->childElements(); ObjRef<iface::cellml_api::CellMLElementIterator> childElementsIter = childElements->iterate(); try { for (ObjRef<iface::cellml_api::CellMLElement> childElement = childElementsIter->next(); childElement; childElement = childElementsIter->next()) { retrieveCmetaIdsFromCellmlElement(childElement); } } catch (...) { // Note: we should never reach this point, but it may still happen if a // CellML file contains a child element that is not known to the // CellML API. We are taking the view that this is a limitation of // the CellML API and shouldn't therefore generate an error for // something that should have been working fine in the first // place... } }