Error - The name "XML" is not legal for JDOM/XML Namespace prefixs

Started by dmphan2, July 16, 2018, 12:42:50 PM

Previous topic - Next topic

dmphan2

Hi Phil,

We have some video files captured by new Sony camera that we ran into this error.  I ran this exiftool command to obtain an XMP file for metadata extraction, programmatically:

exiftool --ZIP:* --Track1:* --PDF:* --XMP-xmpMM:Subject --XMP-photoshop:History --XMP-crss:SavedSettings* --IFD0:ProfileHueSatMapData1 --IFD0:ProfileHueSatMapData2 --XMP-crs:all --ExifIFD:ImageWidth --ExifIFD:ImageHeight -m -X -c "%.6f Degrees" /user/temp/SFF2017_6-29_B-Roll_0006.mp4

Here is a snippet of the output XMP file:

<?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='/user/temp/SFF2017_6-29_B-Roll_0006.mp4'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 10.48'
  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:QuickTime='http://ns.exiftool.ca/QuickTime/QuickTime/1.0/'
  xmlns:XMP-x='http://ns.exiftool.ca/XMP/XMP-x/1.0/'
  xmlns:XMP-xmp='http://ns.exiftool.ca/XMP/XMP-xmp/1.0/'
  xmlns:XMP-xmpMM='http://ns.exiftool.ca/XMP/XMP-xmpMM/1.0/'
  xmlns:XMP-dc='http://ns.exiftool.ca/XMP/XMP-dc/1.0/'
  xmlns:XMP-xmpRights='http://ns.exiftool.ca/XMP/XMP-xmpRights/1.0/'
  xmlns:XMP-lr='http://ns.exiftool.ca/XMP/XMP-lr/1.0/'
  xmlns:XMP-xmpDM='http://ns.exiftool.ca/XMP/XMP-xmpDM/1.0/'
  xmlns:XML='http://ns.exiftool.ca/XML/XML/1.0/'
  xmlns:Track2='http://ns.exiftool.ca/QuickTime/Track2/1.0/'
  xmlns:Track3='http://ns.exiftool.ca/QuickTime/Track3/1.0/'
  xmlns:Composite='http://ns.exiftool.ca/Composite/1.0/'>
<ExifTool:ExifToolVersion>10.48</ExifTool:ExifToolVersion>
<System:FileName>SFF2017_6-29_B-Roll_0006.mp4</System:FileName>
...

All is good except our java program threw out this error:
Thread-21653 2018-07-16 10:15:10,682 | ERROR | session=423315460 | user=tsuper     | stderr | org.jdom.IllegalNameException: The name "XML" is not legal for JDOM/XML Namespace prefixs: Namespace prefixes cannot begin with "xml" in any combination of case.

Looking at the XMP output, I think this line caused the issue: xmlns:XML='http://ns.exiftool.ca/XML/XML/1.0/'

My question for you is: is there way I can configure Exiftool to use different namespace other than "XML" namespace? I tried to use a custom configuration file but was not successful. My custom configuration file, which I copied from one of your, is listed below:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        myxmp => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::myxmp',
                # (see the definition of this table below)
            },
        },
    },
);

# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'myxmp', which corresponds to
# an ExifTool family 1 group name of 'XMP-myxmp'.
%Image::ExifTool::UserDefined::myxmp = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-myxmp', 2 => 'Image' },
    NAMESPACE     => { 'myxmp' => 'http://ns.exiftool.ca/XML/XML/1.0/' },
    WRITABLE      => 'string',
    Family  => { },
    Genus   => { },
    Species => { },
);
1;  #end

Thank you,
Dewey Phan,
Smithsonian Institution

Phil Harvey

Hi Dewey,

This is unfortunate since the -X namespace prefixes are currently hardwired to the ExifTool family 1 group names.

For now, maybe omitting the XML tags from the output would allow you to work around the problem:

exiftool -X --xml:all FILE

But if you really need the XML tags then you'll either have to filter the ExifTool XML output to change the prefix manually (using "sed" for example), or I would need to modify ExifTool to allow this somehow.

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

dmphan2

Hi Phil,

Thank you very much for your super fast response!  I do appreciate it. For now, I have to exclude the XML tag like what you suggested in order to process a load of back log video files. If you can modify the code to allow renaming name space option, that would be great.

Thank you again,
Dewey Phan,
Smithsonian Institution

StarGeek

Quote from: dmphan2 on July 16, 2018, 02:13:46 PMSmithsonian Institution

No comment on the problem, I just want to say how freakin' cool it is that the Smithsonian is using your program, Phil.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

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