diff --git a/src/error.cpp b/src/error.cpp index 83d7d212..a64e428c 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -89,6 +89,7 @@ namespace Exiv2 { ErrMsg( 44, N_("Failed to determine property name from path %1, namespace %2")), // %1=property path, %2=namespace ErrMsg( 45, N_("Schema namespace %1 is not registered with the XMP Toolkit")), // %1=namespace ErrMsg( 46, N_("No namespace registered for prefix `%1'")), // %1=prefix + ErrMsg( 47, N_("Aliases are not supported. Please send this XMP packet to ahuggel@gmx.net `%1', `%2', `%3'")), // %1=namespace, %2=property path, %3=value // Last error message (message is not used) ErrMsg( -2, N_("(Unknown Error)")) diff --git a/src/xmp.cpp b/src/xmp.cpp index ae32b895..e6a2998a 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -413,7 +413,7 @@ namespace Exiv2 { printNode(schemaNs, propPath, propValue, opt); #endif if (XMP_PropIsAlias(opt)) { - // Todo: What should we do with these? Skip for now + throw Error(47, schemaNs, propPath, propValue); continue; } if (XMP_NodeIsSchema(opt)) { @@ -422,7 +422,7 @@ namespace Exiv2 { if (XmpProperties::prefix(schemaNs).empty()) { std::string prefix; bool ret = meta.GetNamespacePrefix(schemaNs.c_str(), &prefix); - if (!ret) throw Exiv2::Error(45, schemaNs); + if (!ret) throw Error(45, schemaNs); prefix = prefix.substr(0, prefix.size() - 1); XmpProperties::registerNs(schemaNs, prefix); } diff --git a/src/xmpsample.cpp b/src/xmpsample.cpp index aa717405..3057e08d 100644 --- a/src/xmpsample.cpp +++ b/src/xmpsample.cpp @@ -24,7 +24,7 @@ try { // ------------------------------------------------------------------------- // Any properties can be set provided the namespace is known. Values of any - // type can be assigned to an Xmpdatum (requires an output operator). The + // type can be assigned to an Xmpdatum, if they have an output operator. The // default XMP value type for unknown properties is a simple text value. xmpData["Xmp.dc.one"] = -1; @@ -33,6 +33,8 @@ try { xmpData["Xmp.dc.four"] = uint16_t(255); xmpData["Xmp.dc.five"] = int32_t(256); xmpData["Xmp.dc.six"] = false; + + // In addition, there is a dedicated assignment operator for Exiv2::Value Exiv2::XmpTextValue val("Seven"); xmpData["Xmp.dc.seven"] = val; @@ -58,6 +60,13 @@ try { v->read("Hello, World"); // qualifier xmpData.add(Exiv2::XmpKey("Xmp.dc.description"), v.get()); + // According to the XMP specification, Xmp.tiff.ImageDescription is an + // alias for Xmp.dc.description. Exiv2 treats an alias just like any + // other property and leaves it to the application to implement specific + // behaviour if desired. + xmpData["Xmp.tiff.ImageDescription"] = "TIFF image description"; + xmpData["Xmp.tiff.ImageDescription"] = "lang=de-DE TIFF Bildbeschreibung"; + // ------------------------------------------------------------------------- // Register a namespace which Exiv2 doesn't know yet. This is only needed // when properties are added manually. If the XMP metadata is read from an diff --git a/test/data/xmpparser-test.out b/test/data/xmpparser-test.out index 4bf0c04f..7ae5e818 100644 --- a/test/data/xmpparser-test.out +++ b/test/data/xmpparser-test.out @@ -31,7 +31,7 @@ Xmp.exif.NativeDigest XmpText 414 36864,40960,40961,37 2c2 < --- -> +> 35d34 < Blue Square Test File - .jpg 37a37 @@ -100,7 +100,7 @@ Xmp.wine.Recommend XmpText 5 False 2c2 < --- -> +> 4c4 < --- > -> +> > > xmlns:ns1="ns:test1/" @@ -292,6 +292,7 @@ Xmp.dc.seven XmpText 5 Seven Xmp.dc.format XmpText 10 image/jpeg Xmp.dc.creator XmpSeq 3 1) The first creator, 2) The second creator, 3) And another one Xmp.dc.description LangAlt 2 lang="de-DE" Hallo, Welt, lang="x-default" Hello, World +Xmp.tiff.ImageDescription LangAlt 2 lang="de-DE" TIFF Bildbeschreibung, lang="x-default" TIFF image description Xmp.xmpDM.videoFrameSize/stDim:w XmpText 2 16 Xmp.xmpDM.videoFrameSize/stDim:h XmpText 1 9 Xmp.xmpDM.videoFrameSize/stDim:unit XmpText 4 inch @@ -304,11 +305,12 @@ Xmp.xmpBJ.JobRef[1]/stJob:role XmpText 12 Photographer Xmp.xmpBJ.JobRef[2]/stJob:name XmpText 16 Wedding ceremony Xmp.xmpBJ.JobRef[2]/stJob:role XmpText 8 Best man - + James Bond secret agent + + + TIFF image description + TIFF Bildbeschreibung + +