ExifTool > Archives

Help on user defined XMP structure

(1/1)

Archive:
[Originally posted by anvoit on 2010-02-15 11:00:56.764487-08]

Hi Phil,

I have another problem defining a user defined XMP structure and I'd like to ask for help because I'm stuck.

I have defined this config file for exiftool


--- Code: ---%Image::ExifTool::UserDefined = (
   'Image::ExifTool::XMP::Main' => {
      AvPicasa => {
         SubDirectory => {
            Name => 'AvPicasa',
            TagTable => 'Image::ExifTool::UserDefined::AvPicasa',
         },
      },
   },
);

%Image::ExifTool::UserDefined::AvPicasa = (
   GROUPS => { 0 => 'XMP', 1 => 'XMP-AvPicasa', 2 => 'Image' },
   NAMESPACE => { 'AvPicasa' => 'http://ns.anvo-it.de/AvPicasa/1.0/' },
   WRITABLE => 'string',

   AvPicasaInfo => {
      SubDirectory => { },
      Struct => 'AvPicasaInfo',
      List => 'Bag',
   },

   AvPicasaInfoPicasaName => {
      Name => 'PicasaName',
      List => 1,
   },
   AvPicasaInfoPicasaDisplayName => {
      Name => 'PicasaDisplayName',
      List => 1,
   },
   AvPicasaInfoPicasaId => {
      Name => 'PicasaId',
      List => 1,
   },
);

%Image::ExifTool::UserDefined::xmpStruct = (
   AvPicasaInfo => {
      NAMESPACE => { 'AvPicasaInfo' => 'http://ns.anvo-it.de/AvPicasa/1.0/AvPicasaInfo#' },
      PicasaName => { },
      PicasaDisplayName => { },
      PicasaId => { },
   },
);
and get this result


--- Code: ---<rdf:Description rdf:about="" xmlns:AvPicasa="http://ns.anvo-it.de/AvPicasa/1.0/" xmlns:AvPicasaInfo="http://ns.anvo-it.de/AvPicasa/1.0/AvPicasaInfo#">
    <AvPicasa:AvPicasaInfo>
        <rdf:Bag>
            <rdf:li rdf:parseType="Resource">
                <AvPicasaInfo:PicasaDisplayName>Phil</AvPicasaInfo:PicasaDisplayName>
                <AvPicasaInfo:PicasaId>b0c570de0e5b43c9</AvPicasaInfo:PicasaId>
                <AvPicasaInfo:PicasaName>Phil</AvPicasaInfo:PicasaName>
            </rdf:li>
        </rdf:Bag>
    </AvPicasa:AvPicasaInfo>
</rdf:Description>
But i would like to get something like this (analog to the XMP-MP structure):


--- Code: ---<rdf:Description rdf:about="" xmlns:AvPicasa="http://ns.anvo-it.de/AvPicasa/1.0/" xmlns:AvPicasaInfo="http://ns.anvo-it.de/AvPicasa/1.0/AvPicasaInfo#" xmlns:AvPicasaInfo="http://ns.anvo-it.de/AvPicasa/1.0/AvPicasaInfoElem#">
    <AvPicasa:PicasaInfo>
        <AvPicasaInfo:PicasaInfos>        
            <rdf:Bag>
                <rdf:li rdf:parseType="Resource">
                    <AvPicasaInfoElem:PicasaDisplayName>Phil</AvPicasaInfoElem:PicasaDisplayName>
                    <AvPicasaInfoElem:PicasaId>b0c570de0e5b43c9</AvPicasaInfoElem:PicasaId>
                    <AvPicasaInfoElem:PicasaName>Phil</AvPicasaInfoElem:PicasaName>
                </rdf:li>
            </rdf:Bag>
        </AvPicasaInfo:PicasaInfos>
    </AvPicasa:PicasaInfo>
</rdf:Description>
Maybe I'm doing something wrong. I studied the XMP.pm source, but I didn't get it right.
Basically I don't understand how to specify another nesting level (like in XMP-MP the MPRI:Regions element).

May I ask for your help?

Thanks,

Andreas

Archive:
[Originally posted by exiftool on 2010-02-15 12:47:40.139986-08]

I don't see why you want to duplicate the unnecessary nesting
level used in the MP tags.  Personally I much prefer the way
you have done it.

But if you must add an extra unnecessary layer of complexity,
then take a look at the MP RegionInfo and Regions structures
in XMP.pm and WriteXMP.pl because you have just missed one
layer.

 
- Phil

Phil Harvey:
Although the config file shown in the previous post will should still work, the definition of user-defined structures has been simplified as of ExifTool version 8.46.  The corresponding config file now looks like this:


--- Code: ---%Image::ExifTool::UserDefined = (
   'Image::ExifTool::XMP::Main' => {
      AvPicasa => {
         SubDirectory => {
            Name => 'AvPicasa',
            TagTable => 'Image::ExifTool::UserDefined::AvPicasa',
         },
      },
   },
);

%Image::ExifTool::UserDefined::AvPicasa = (
   GROUPS => { 0 => 'XMP', 1 => 'XMP-AvPicasa', 2 => 'Image' },
   NAMESPACE => { 'AvPicasa' => 'http://ns.anvo-it.de/AvPicasa/1.0/' },
   WRITABLE => 'string',

   AvPicasaInfo => {
      Struct => {
         NAMESPACE => { 'AvPicasaInfo' => 'http://ns.anvo-it.de/AvPicasa/1.0/AvPicasaInfo#' },
         STRUCT_NAME => 'AvPicasaInfo',
         PicasaName => { },
         PicasaDisplayName => { },
         PicasaId => { },
      },
      List => 'Bag',
   },
   # shorten our flattened tag names
   AvPicasaInfoPicasaName => {
      Name => 'PicasaName',
      Flat => 1,
   },
   AvPicasaInfoPicasaDisplayName => {
      Name => 'PicasaDisplayName',
      Flat => 1,
   },
   AvPicasaInfoPicasaId => {
      Name => 'PicasaId',
      Flat => 1,
   },
);

1; # end
--- End code ---

See the config file documentation for details.

- Phil

Navigation

[0] Message Index

Go to full version