Author Topic: Tag does not exist  (Read 1870 times)

barbaraf

  • Newbie
  • *
  • Posts: 6
Tag does not exist
« on: April 10, 2014, 06:01:19 PM »
Hi,

We have a Perl program that has been in use for about a year and that uses v. 9.13 of Image::ExifTool. The program adds metadata in some pre-existing fields, and also adds a custom field "date.issued" to the Dublin Core XMP tag set. This is not the latest version of ExifTool, I know, but it has worked well for what we needed so we didn't tinker with it.

Someone else in the office started using the program and installed v. 9.53 of Image::ExifTool. When he runs the program, he gets an error that the "Tag 'date.issued' does not exist".

This is the way the custom field is defined in the Perl program:

my $exifTool = new Image::ExifTool;

%Image::ExifTool::UserDefined = (
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::dc' => {
        'date.issued'  => { },
    },
);

If I change the field name to "dateIssued", the program works. Unfortunately, we have to set the field name to "date.issued" to meet a client specification.

Can someone tell me the correct way to add this field so that the more recent versions of ExifTool will recognize it?

Thanks for your help.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: Tag does not exist
« Reply #1 on: April 10, 2014, 08:51:32 PM »
ExifTool tag names should not have "." in them.  Older versions of ExifTool did not properly check for illegal characters in user-defined XMP tags when automatically generating the tag name from the ID.  ExifTool 9.45 fixed this, and removes the illegal characters in the name, so you should now access this tag with the name "DateIssued" (even though the ID is "date.issued").  Legal characters in tag names are A-Z, a-z, 0-9, - and _.

It is unfortunate that this broke your script, but it was necessary because there may be other unexpected problems that could arise if ExifTool allowed illegal names like this.

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

barbaraf

  • Newbie
  • *
  • Posts: 6
Re: Tag does not exist
« Reply #2 on: April 11, 2014, 12:03:20 PM »
Thank you for your quick reply.

I made this change to the program:

%Image::ExifTool::UserDefined = (
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::dc' => {
      'date.issued'  => { Name => 'dateIssued', },
    },
);

I also changed the SetNewValue call to reference the new name "XMP-dc:dateIssued" instead of the old "XMP-dc:date.issued".

The program seems to generate the required "date.issued" field in the pdf's xmp now without error.

Can you confirm that these are the changes I need to make?

Thanks again for the help.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: Tag does not exist
« Reply #3 on: April 11, 2014, 12:08:40 PM »
You shouldn't have needed to change the UserDefined definition, because "DateIssued" should now be the automatically generated Name.  If you want to add a Name, it should begin with a capital ("DateIssued"), although this is being a bit picky.  I guess that adding a Name is a good idea though, because then your script will work for either version of ExifTool.

- Phil

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

barbaraf

  • Newbie
  • *
  • Posts: 6
Re: Tag does not exist
« Reply #4 on: April 11, 2014, 12:10:42 PM »
Got it. Thank you so much for clearing this up for me.