Bug: Exiftool can generate XMP syntax with both rdf:value and content

Started by bertbos, December 31, 2018, 11:06:33 AM

Previous topic - Next topic

bertbos

I have an image with GPS data in XMP. In particular, it contains latitude information in this format:

<exif:GPSLatitude xml:lang="x-default" rdf:value="53,2.5000000000"/>

Exitfool correctly reads this data and prints:

GPS Latitude                    : 53 deg 2' 30.00"

But when I try to change the latitude with a command like

exiftool -GPSLatitude=54,2.15N image2.jpg

The result is a file with incorrect XMP data (see attached). The image now contains this line in its XMP data:

<exif:GPSLatitude rdf:value='53,2.5000000000' xml:lang='x-default'>54,2.15N</exif:GPSLatitude>

I.e., exiftool has added the new latitude, but has not removed the old one. A property in XMP cannot have both a value attribute and a content.

Phil Harvey

This happens because the original XMP is written incorrectly.  It should use neither xml:lang nor rdf:value.  ExifTool preserves these (unrecognized) attributes when it writes the contents of this tag.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bertbos

Are you sure? If I understand RDF and XMP correctly, rdf:value is a predefined property, without semantics of its own, but used to create qualified values. Section C.2.12 [1] shows the syntax with rdf:value as an attribute instead of an element.

In my example,

<exif:GPSLatitude xml:lang="x-default" rdf:value="53,2.5000000000"/>

exif:GPSLatitude is a "simple qualified property": the value is "53,2.5000000000" and it has only one qualifier, xml:lang. I.e., it is the same as

<exif:GPSLatitude xml:lang="x-default">
<rdf:Description>
  <rdf:value>53,2.5000000000</rdf:value>
</rdf:Description>
</exif:GPSLatitude>


The XMP specification section 7.8 says that this form "should not" be used if the only qualifier is just xml:lang. But "should not" doesn't mean it's invalid.

Adobe's XMP Toolkit implements the rdf:value attribute (and thus exempi does, too), and it seems exiftool also understands it. It just doesn't write it.

[1] https://wwwimages2.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2016-08/XMPSpecificationPart1.pdf

Phil Harvey

OK.  I'll have to look into this when I get a chance.

XMP uses a restricted form of the RDF/XML syntax, but perhaps you are right that this is allowed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Ouch.  Right.  Qualified properties.  I remember now.  Yuk.  I've never seen these used by anyone, and ExifTool doesn't yet support these...  I'll see what I can do.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Sorry to be so long in getting around to this.  ExifTool 11.62 will contain a patch to remove the old rdf:value when writing a property like this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).