-
There's a file that has a corrupted XMP packet, which can be read by exiftool, but exiv2 says
I understand that it's broken and it's OK. But maybe there's a way to overcome this? I'm using exiv2 as a C++ library. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 14 replies
-
@ribtoks There are options to delete/print/insert raw XMP packets.
Before you can read that XMP, could you figure out why the validator rejected it? Once you understand, it may be possible to modify the validator code to forgive and accept. |
Beta Was this translation helpful? Give feedback.
-
You can try commenting out this line of code: Line 685 in bf95347 It's the source of the error message that you're getting. It's only there as a security mitigation: the Adobe XMP library that we use is very buggy, so the purpose of that line of code is to do a pre-check of the XML to make sure it's valid before we call the Adobe library. If you trust the file that you're running exiv2 on, then you can safely skip the pre-check. |
Beta Was this translation helpful? Give feedback.
@ribtoks The XML is invalid, so every XML parser (including xmllint) will barf. You can't forgive or trick it, you have to repair the XML code.
readMetadata()
reads the raw XML from the file.At that moment, buf.pData_ has something like this: