| 372 | |
| 373 | |
| 374 | QString OPFResource::GetUUIDIdentifierValue() |
| 375 | { |
| 376 | EnsureUUIDIdentifierPresent(); |
| 377 | QReadLocker locker(&GetLock()); |
| 378 | QString source = CleanSource::ProcessXML(GetText(),"application/oebps-package+xml"); |
| 379 | OPFParser p; |
| 380 | p.parse(source); |
| 381 | for (int i=0; i < p.m_metadata.count(); ++i) { |
| 382 | MetaEntry me = p.m_metadata.at(i); |
| 383 | if(me.m_name.startsWith("dc:identifier")) { |
| 384 | QString value = QString(me.m_content).remove("urn:uuid:"); |
| 385 | if (!QUuid(value).isNull()) { |
| 386 | return value; |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | // EnsureUUIDIdentifierPresent should ensure we |
| 391 | // never reach here. |
| 392 | Q_ASSERT(false); |
| 393 | return QString(); |
| 394 | } |
| 395 | |
| 396 | |
| 397 | void OPFResource::EnsureUUIDIdentifierPresent() |
no test coverage detected