Newbie question about custom xml tags

Started by nitrokev, January 24, 2015, 03:02:30 PM

Previous topic - Next topic

nitrokev

Ok this is probably very basic and obvious, but I just want to make sure I'm doing things the right way

I want to add lots of product specifications and features from a csv file, which I have working using the config below.

%Image::ExifTool::UserDefined = (
    # new XMP namespaces (ie. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        IndesitCompany => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::IndesitCompany',
                # (see the definition of this table below)
            },
        },
         },
    # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique: The Require/Desire elements list tags
        # that must/may exist, and the keys of these hashes are used as
        # indices in the @val array of the ValueConv expression to derive
        # the composite tag value.  All Require'd tags must exist for the
        # Composite tag to be evaluated.  If no Require'd tags are specified,
        # then at least one of the Desire'd tags must exist.  See the
        # Composite table in Image::ExifTool::Exif for more examples.
       
        # generate a description for this file type
        FileTypeDescription => {
            Require => 'FileType',
            ValueConv => 'GetFileType($val,1) || $val',
        },
    },
);

# Custom XMP Namespace for IndesitCompany.
%Image::ExifTool::UserDefined::IndesitCompany = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-IndesitCompany', 2 => 'Image' },
    NAMESPACE     => { 'IndesitCompany' => 'http://ns.artisan-creative.co.uk/IndesitCompany/' },
    WRITABLE      => 'string',

SubBrand => { },
Colour => { },
ModelColours => { },
WashingCapacity => { },
Spinrpm => { },
EnergyRating => { },
UserInterface => { },
ColourCareTechnology => { },
SteamTechnology => { },
AntiStain => { },
AntiStainQuick => { },
AntiAllergy => { },
WoolmarkPlatinum => { },
SuperSilentMotor => { },
SuperWash => { },
SmartWash => { },
SmartTech => { },
TimeZone => { },
EcoCycles => { },
);

#------------------------------------------------------------------------------
1;  #end


Is this the right way to go about this, should more generic features like Color and Sub Brand be defined somewhere else, rather than in a user defined tag.

For the specs such as EcoCycles => {}, the value will be yes/no should I do anything extra to specify this?

Thanks for any help

Phil Harvey

To me, what you have done looks like the right way to go about this.

Normally a yes/no value in XMP is represented by a boolean, which can be "True" or "False".

EcoCycles => { Writable => 'boolean' },

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

nitrokev