A question to structures and flattened tagnames

Started by herb, May 08, 2018, 09:37:29 AM

Previous topic - Next topic

herb

Hallo Phil,

I did lots of tests to create structures and lists both using only flattened tag-names but also using -struct option.
A very good base for my tests was the "NewXMPxxxStruct" structure in your Example_config file, because there is also a nested structure "Things".

I created a structure with the following command
exiftool.exe -NewXMPxxxStruct=[{Things=[{What=w1,Where=w2}]},{Things=[{What=w8,Where=w9}]}] test.xmp
But I was unable to create an identical structure using flattened tagnames.
In all testcases only the nested structure was written/created.

I had asked this question also in "Questions to DarwinCore Tags" https://exiftool.org/forum/index.php/topic,9104.0.html, but was not sure how to interpret your answer.
Thanks for your help in advance.

Best regards
Herb

Phil Harvey

Hi Herb,

Nested structures are one thing, but nested lists are another.  The example you are using utilizes both.

It is not possible to fill arbitrary nested lists using completely flattened tags because new list items are always added to the innermost list.  For example, with the file you wrote:

% exiftool test.xmp -s -xmp:all
XMPToolkit                      : Image::ExifTool 10.95
NewXMPxxxStructThingsWhat       : w1, w8
NewXMPxxxStructThingsWhere      : w2, w9


Adding a new NewXMPxxxStructThingsWhat value will only write to the first NewXMPxxxStruct in the list because list operations manipulate the inner list of Things structures.  There is no way of using flattened tags to manipulate the What/Where elements in subsequent NewXMPxxxStruct structures.

This is a hard limitation of flattened tags.  But the good news is that the use of nested lists in XMP is not very common.

- 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 ($).

herb

Hello Phil,

thanks for your quick reply and the detailed explanations.

Best regards
Herb