Bug #1354

Inconsistency with long XMP namespaces (e.g. 'Iptc4xmpExt')

Added by Jens Georg 7 months ago. Updated 7 months ago.

Status:ClosedStart date:23 May 2018
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:xmpEstimated time:1.00 hour
Target version:0.27

Description

I have an upstream ticket at GExiv2 that deals with problems registering the Iptc4xmpExt namespace. The user found out that there is some issue with how the namespaces are written:

Quoting from the bug:

There is an inconsistency in how Exiv2 writes XMP data.

  1. Create an empty XMP file:
    echo "<x:xmpmeta x:xmptk='XMP Core 4.4.0-Exiv2' xmlns:x='adobe:ns:meta/'></x:xmpmeta>" >test.xmp
  2. Write some tags:
    exiv2 -M"set Xmp.iptc.Location XmpText West Wallaby St" test.xmp
    exiv2 -M"set Xmp.iptcExt.DigitalSourcefileType XmpText camerajpeg" test.xmp
  3. Look at the file:
    more test.xmp
    <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
    <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about="" 
    xmlns:iptcExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" 
    xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 
    iptcExt:DigitalSourcefileType="camerajpeg" 
    Iptc4xmpCore:Location="West Wallaby St"/>
    </rdf:RDF>
    </x:xmpmeta>
    <?xpacket end="w"?>
    

Note that the Xmp.iptc tag uses the proper Iptc4xmpCore namespace but the Xmp.iptcExt tag does not use the proper Iptc4xmpExt namespace. I'm not enough of an XMP expert to say if this is a bug or not.

History

#1 Updated by Jens Georg 7 months ago

Forgot the link to the original ticket: [[https://gitlab.gnome.org/GNOME/gexiv2/issues/24]]

#2 Updated by Jim Easterbrook 7 months ago

As the author of the original bug report I should point out that recent versions of exiv2 seem to be a bit more fussy about XMP syntax. To create a usable empty XMP file I now need to do this:

echo '<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmp:CreatorTool="{}"/></rdf:RDF></x:xmpmeta><?xpacket end="w"?>' >test.xmp

I have a workaround for my original problem, and this report is only about an apparent inconsistency in the handling of XMP namespaces, so it's not a high priority.

#3 Updated by Robin Mills 7 months ago

  • Category set to xmp
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.27

Jim and Jens:

There has been very few changes (if any) to the XMP code in Exiv2 during the 10 years in which I have been contributing to Exiv2.

We have a "work-in-progress" project to enable Exiv2 to be build with Adobe's 2016 Edition of XMPsdk and expect that to be part of Exiv2 v0.27 which we hope will reach RC1 in September 2018 and be released at the end of 2018.

I haven't understood the bug report as the XML looks correct to me. Exiv2 has about 50 predefined namespaces. Specifically for Iptc:

530 rmills@rmillsmbp:~/clanmills $ exiv2 -vV --grep xmlns | grep -i Iptc
xmlns=Iptc4xmpCore:http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/
xmlns=Iptc4xmpExt:http://iptc.org/std/Iptc4xmpExt/2008-02-29/
xmlns=acdsee:http://ns.acdsee.com/iptc/1.0/
531 rmills@rmillsmbp:~/clanmills $ 
So the out XML/XMP correctly declares/uses the namespaces Iptc4xmpCore and Iptc4xmpExt
<rdf:Description
     xmlns:iptcExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" 
     xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 
     rdf:about="" 
     iptcExt:DigitalSourcefileType="camerajpeg" 
     Iptc4xmpCore:Location="West Wallaby St" 
/>
I'm a little surprised that the command:
exiv2 -M"set Xmp.iptc.Location XmpText West Wallaby St" test.xmp
becomes the tags:
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 
Iptc4xmpCore:Location="West Wallaby St"
However it doesn't seem wrong either!

I believe there have been changes to the predefined namespaces in the library. Perhaps the namespace "iptc" has morphed into Iptc4xmpCore over the years.

#4 Updated by Phil Harvey 7 months ago

The odd thing is that "iptcExt" is being written as the namespace prefix, while Robin shows that "Iptc4xmpExt" is the prefix defined in Exiv2. I don't understand this, but technically you can use any namespace prefix you want provided the URI is correct in the xmlns definition.

So I don't think this should count as a bug. However, having said this, it is nice to use the recommended prefixes for maximum compatibility with stupid apps that may not properly use the prefixes to look up the URI.

- Phil

#5 Updated by Robin Mills 7 months ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100
  • Estimated time set to 1.00

Phil. Thanks for contributing to this discussion. I think the capitalisation here is bizarre. I've run commands above on exiv2 v0.26:

913 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ cp ~/Stonehenge.jpg .
914 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ exiv2 -M"set Xmp.iptc.Location  XmpText  West Wallaby St" Stonehenge.jpg 
915 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ exiv2 -M"set Xmp.iptcExt.DigitalSourcefileType  XmpText  camerajpeg" Stonehenge.jpg 
916 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ exiv2 -pX Stonehenge.jpg | xmllint --format -
<?xml version="1.0"?>
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description
      xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 
      xmlns:iptcExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" 
      rdf:about="" 
      Iptc4xmpCore:Location="West Wallaby St" 
      iptcExt:DigitalSourcefileType="camerajpeg"/>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

And on the Work-in-progress version with Adobe's 2016 XMPsdk:
917 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ $ bin/exiv2 --verbose --version --grep adobe_xmp
exiv2 0.26 001a00 (64 bit build)
adobe_xmpsdk=2016
918 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ cp ~/Stonehenge.jpg .
919 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ bin/exiv2 -M"set Xmp.iptc.Location  XmpText  West Wallaby St" Stonehenge.jpg 
920 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ bin/exiv2 -M"set Xmp.iptcExt.DigitalSourcefileType  XmpText  camerajpeg" Stonehenge.jpg 
921 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ bin/exiv2 -pX Stonehenge.jpg | xmllint --format -
<?xml version="1.0"?>
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.6.0">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description 
      xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 
      xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" 
      rdf:about="" 
      Iptc4xmpCore:Location="West Wallaby St" 
      Iptc4xmpExt:DigitalSourcefileType="camerajpeg" 
    />
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
922 rmills@rmillsmm:~/gnu/github/piponazo/exiv2/build $ 
You'll notice that the XMP/xml was written by XMP Core 5.6.0 and the mysterious capitalisation has been rectified.

We intend to retain the existing xmpsdk/ code in Exiv2 for version v.027 and to offer an option to build with Adobe XMPsdk 2016. We're not going to change the default build as it adds build complexity for limited gain. For sure, the existing code has provided solid service for many years. The motivation for offering Adobe XMPsdk 2016 is to enable applications to link and use Adobe's library from their application.

I'm going to mark this "closed". The behaviour is strange, however it's not wrong!

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux