| 359 | } |
| 360 | |
| 361 | ProjectFile::Metadata ProjectFile::parseMetadata() const |
| 362 | { |
| 363 | auto project = ZipTools::open(stdFile); |
| 364 | if (!project) { |
| 365 | return {}; |
| 366 | } |
| 367 | |
| 368 | ProjectFile::Metadata meta; |
| 369 | std::unique_ptr<std::istream> str(project->getInputStream("Document.xml")); |
| 370 | if (str) { |
| 371 | static const std::array gLS = { chLatin_L, chLatin_S, chNull }; |
| 372 | |
| 373 | DOMImplementation* impl = DOMImplementationRegistry::getDOMImplementation(gLS.data()); |
| 374 | DOMLSParser* domBuilder = impl->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, nullptr); |
| 375 | DOMLSInput* input = impl->createLSInput(); |
| 376 | |
| 377 | try { |
| 378 | Base::StdInputSource inputSource(*str, stdFile.c_str()); |
| 379 | |
| 380 | input->setByteStream(&inputSource); |
| 381 | MetaDataParser filter(meta); |
| 382 | domBuilder->setFilter(&filter); |
| 383 | domBuilder->getDomConfig()->setParameter(XMLUni::fgDOMEntities, false); |
| 384 | domBuilder->parse(input); |
| 385 | } |
| 386 | catch (const XMLException&) { |
| 387 | // Do nothing |
| 388 | } |
| 389 | catch (const DOMException&) { |
| 390 | // Do nothing |
| 391 | } |
| 392 | |
| 393 | input->release(); |
| 394 | domBuilder->release(); |
| 395 | } |
| 396 | |
| 397 | return meta; |
| 398 | } |
| 399 | |
| 400 | ProjectFile::Metadata ProjectFile::getMetadata() const |
| 401 | { |
nothing calls this directly
no test coverage detected