Minor issue with Comments in XMP files

Started by Curtis, April 28, 2016, 08:46:17 PM

Previous topic - Next topic

Curtis

Hi Phil,
In testing my program that uses exiftool I discovered what may be a minor issue.  It seems exiftool does not pay attention to comments delineated by <!--comment --> in XMP input files.  Following two XMP files (severely reduced version of your XMP2.xmp test file) give the same output from exiftool using the -struct -X -t -l options.

This is obviously not critical if it has not been noticed before, but just thought you would like to know, or am I missing something?

Curtis

Without comment:
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.1-111">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about=""
      xmlns:dc="http://purl.org/dc/elements/1.1/">
      <dc:rights>
        <rdf:Alt>
          <rdf:li xml:lang='x-default'>© Copyright Phil Harvey</rdf:li>
          <rdf:li xml:lang='fr'>© Droit d'auteur Phil Harvey</rdf:li>
        </rdf:Alt>
      </dc:rights>
      <dc:subject>
        <rdf:Bag>
          <rdf:li>test1</rdf:li>
        </rdf:Bag>
      </dc:subject>
     </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>


With comment (dc:Subject commented out)
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="3.1.1-111">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about=""
      xmlns:dc="http://purl.org/dc/elements/1.1/">
      <dc:rights>
        <rdf:Alt>
          <rdf:li xml:lang='x-default'>© Copyright Phil Harvey</rdf:li>
          <rdf:li xml:lang='fr'>© Droit d'auteur Phil Harvey</rdf:li>
        </rdf:Alt>
      </dc:rights>
      <!--<dc:subject>
        <rdf:Bag>
          <rdf:li>test1</rdf:li>
        </rdf:Bag>
      </dc:subject>-->
     </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>


both give the same output from exitool:
<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='D:/XMP Comment test.xmp'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 10.15'
  xmlns:ExifTool='http://ns.exiftool.ca/ExifTool/1.0/'
  xmlns:System='http://ns.exiftool.ca/File/System/1.0/'
  xmlns:File='http://ns.exiftool.ca/File/1.0/'
  xmlns:XMP-x='http://ns.exiftool.ca/XMP/XMP-x/1.0/'
  xmlns:XMP-dc='http://ns.exiftool.ca/XMP/XMP-dc/1.0/'>
<ExifTool:ExifToolVersion>
  <rdf:Description et:id='ExifToolVersion' et:table='Extra'>
   <et:desc>ExifTool Version Number</et:desc>
   <et:prt>10.15</et:prt>
  </rdf:Description>
</ExifTool:ExifToolVersion>
<System:FileName>
  <rdf:Description et:id='FileName' et:table='Extra'>
   <et:desc>File Name</et:desc>
   <et:prt>XMP Comment test.xmp</et:prt>
  </rdf:Description>
</System:FileName>
<System:Directory>
  <rdf:Description et:id='Directory' et:table='Extra'>
   <et:desc>Directory</et:desc>
   <et:prt>D:/Test Problem files A</et:prt>
  </rdf:Description>
</System:Directory>
<System:FileSize>
  <rdf:Description et:id='FileSize' et:table='Extra'>
   <et:desc>File Size</et:desc>
   <et:prt>667 bytes</et:prt>
   <et:val>667</et:val>
  </rdf:Description>
</System:FileSize>
<System:FileModifyDate>
  <rdf:Description et:id='FileModifyDate' et:table='Extra'>
   <et:desc>File Modification Date/Time</et:desc>
   <et:prt>2016:04:28 17:12:04-07:00</et:prt>
  </rdf:Description>
</System:FileModifyDate>
<System:FileAccessDate>
  <rdf:Description et:id='FileAccessDate' et:table='Extra'>
   <et:desc>File Access Date/Time</et:desc>
   <et:prt>2016:04:28 17:12:04-07:00</et:prt>
  </rdf:Description>
</System:FileAccessDate>
<System:FileCreateDate>
  <rdf:Description et:id='FileCreateDate' et:table='Extra'>
   <et:desc>File Creation Date/Time</et:desc>
   <et:prt>2016:04:28 17:06:08-07:00</et:prt>
  </rdf:Description>
</System:FileCreateDate>
<System:FilePermissions>
  <rdf:Description et:id='FilePermissions' et:table='Extra'>
   <et:desc>File Permissions</et:desc>
   <et:prt>rw-rw-rw-</et:prt>
   <et:val>666</et:val>
  </rdf:Description>
</System:FilePermissions>
<File:FileType>
  <rdf:Description et:id='FileType' et:table='Extra'>
   <et:desc>File Type</et:desc>
   <et:prt>XMP</et:prt>
  </rdf:Description>
</File:FileType>
<File:FileTypeExtension>
  <rdf:Description et:id='FileTypeExtension' et:table='Extra'>
   <et:desc>File Type Extension</et:desc>
   <et:prt>xmp</et:prt>
   <et:val>XMP</et:val>
  </rdf:Description>
</File:FileTypeExtension>
<File:MIMEType>
  <rdf:Description et:id='MIMEType' et:table='Extra'>
   <et:desc>MIME Type</et:desc>
   <et:prt>application/rdf+xml</et:prt>
  </rdf:Description>
</File:MIMEType>
<XMP-x:XMPToolkit>
  <rdf:Description et:id='xmptk' et:table='XMP::x'>
   <et:desc>XMP Toolkit</et:desc>
   <et:prt>3.1.1-111</et:prt>
  </rdf:Description>
</XMP-x:XMPToolkit>
<XMP-dc:Rights>
  <rdf:Description et:id='rights' et:table='XMP::dc'>
   <et:desc>Rights</et:desc>
   <et:prt>© Copyright Phil Harvey</et:prt>
  </rdf:Description>
</XMP-dc:Rights>
<XMP-dc:Rights-fr>
  <rdf:Description et:id='rights-fr' xml:lang='fr' et:table='XMP::dc'>
   <et:desc>Rights (fr)</et:desc>
   <et:prt>© Droit d&#39;auteur Phil Harvey</et:prt>
  </rdf:Description>
</XMP-dc:Rights-fr>
<XMP-dc:Subject>
  <rdf:Description et:id='subject' et:table='XMP::dc'>
   <et:desc>Subject</et:desc>
   <et:prt>
    <rdf:Bag>
     <rdf:li>test1</rdf:li>
    </rdf:Bag>
   </et:prt>
  </rdf:Description>
</XMP-dc:Subject>
</rdf:Description>
</rdf:RDF>

Phil Harvey

Hi Curtis,

You're right.  ExifTool's parsing is very flexible to try to pull the XML out of a variety of formats, and it manages to also pull XML out of the comments.

I hadn't thought about this until now, but maybe I should add code to properly ignore the comments (or maybe put them into the Comment tag?).

Thanks for pointing this out.

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

Curtis

Hi Phil,

Seems like exiftool should just ignore the comments,  I could see where it could get messy putting them into the Comment tag if the .XMP file was heavily commented for some reason.

My 2 cents.....
Curtis

Phil Harvey

Sounds sensible.  I'll look into fixing this for 10.17.

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