diff --git a/src/xmpsample.cpp b/src/xmpsample.cpp index 9a4c5206..dbd65a99 100644 --- a/src/xmpsample.cpp +++ b/src/xmpsample.cpp @@ -14,6 +14,14 @@ try { // The XMP property container Exiv2::XmpData xmpData; + // ------------------------------------------------------------------------- + // Teaser: The quickest way to add simple XMP properties using Exiv2 + + xmpData["Xmp.dc.source"] = "xmpsample.cpp"; // a simple text value + xmpData["Xmp.dc.subject"] = "Palmtree"; // an array item + xmpData["Xmp.dc.subject"] = "Rubbertree"; // add a 2nd array item + xmpData["Xmp.dc.title"] = "lang=en-US Beach"; // a language alternative + // ------------------------------------------------------------------------- // Exiv2 has specialized values for simple XMP properties, arrays of simple // properties and language alternatives. @@ -36,12 +44,6 @@ try { v->read("Hello, World"); // qualifier xmpData.add(Exiv2::XmpKey("Xmp.dc.description"), v.get()); - // Or all of the above but using associative array style syntax - xmpData["Xmp.dc.format"] = "image/tiff"; // overwrites existing value - xmpData["Xmp.dc.subject"] = "Palmtree"; // adds a new array value - xmpData["Xmp.dc.subject"] = "Rubbertree"; // adds a second array item - xmpData["Xmp.dc.title"] = "lang=en-US Beach"; // a language alternative - // ------------------------------------------------------------------------- // 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 3c0a77fb..8b2629cb 100644 --- a/test/data/xmpparser-test.out +++ b/test/data/xmpparser-test.out @@ -279,11 +279,12 @@ Xmp.ns1.NestedStructProp/ns2:Outer/ns2:Middle/ns2:Inner/ns2:Field2 XmpText 12 > > \ No newline at end of file -Xmp.dc.format XmpText 10 image/tiff -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.dc.source XmpText 13 xmpsample.cpp Xmp.dc.subject XmpBag 2 Palmtree, Rubbertree Xmp.dc.title LangAlt 1 lang="en-US" Beach +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.xmpDM.videoFrameSize/stDim:w XmpText 2 16 Xmp.xmpDM.videoFrameSize/stDim:h XmpText 1 9 Xmp.xmpDM.videoFrameSize/stDim:unit XmpText 4 inch @@ -305,7 +306,19 @@ Xmp.xmpBJ.JobRef[2]/stJob:role XmpText 8 Best man xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#" xmlns:xapBJ="http://ns.adobe.com/xap/1.0/bj/" xmlns:stJob="http://ns.adobe.com/xap/1.0/sType/Job#" - dc:format="image/tiff"> + dc:source="xmpsample.cpp" + dc:format="image/jpeg"> + + + Palmtree + Rubbertree + + + + + Beach + + 1) The first creator @@ -322,17 +335,6 @@ Xmp.xmpBJ.JobRef[2]/stJob:role XmpText 8 Best man Hallo, Welt - - - Palmtree - Rubbertree - - - - - Beach - - James Bond secret agent