string Package::PackageID() const { XPathWrangler xpath(_opf, {{"opf", OPFNamespace}, {"dc", DCNamespace}}); XPathWrangler::StringList strings = xpath.Strings("//*[@id=/opf:package/@unique-identifier]/text()"); if ( strings.empty() ) return string::EmptyString; return strings[0]; }
string Package::PackageID() const { #if EPUB_COMPILER_SUPPORTS(CXX_INITIALIZER_LISTS) XPathWrangler xpath(_opf, {{"opf", OPFNamespace}, {"dc", DCNamespace}}); #else XPathWrangler::NamespaceList __m; __m["opf"] = OPFNamespace; __m["dc"] = DCNamespace; XPathWrangler xpath(_opf, __m); #endif XPathWrangler::StringList strings = xpath.Strings("//*[@id=/opf:package/@unique-identifier]/text()"); if ( strings.empty() ) return string::EmptyString; return strings[0]; }