ExifTool Forum

ExifTool => Developers => Topic started by: herb on May 08, 2018, 09:37:29 AM

Title: A question to structures and flattened tagnames
Post by: herb on May 08, 2018, 09:37:29 AM
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 (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
Title: Re: A question to structures and flattened tagnames
Post by: Phil Harvey on May 08, 2018, 10:01:43 AM
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

Title: Re: A question to structures and flattened tagnames
Post by: herb on May 08, 2018, 11:42:13 AM
Hello Phil,

thanks for your quick reply and the detailed explanations.

Best regards
Herb