Merge pull request #1077 from langfr/bugfix/XMPParser
Remove leading characters from extracted XMP metadata.
This commit is contained in:
@@ -127,7 +127,7 @@ public class PDFValidator extends Validator {
|
|||||||
final ZUGFeRDImporter zi = new ZUGFeRDImporter();
|
final ZUGFeRDImporter zi = new ZUGFeRDImporter();
|
||||||
zi.doIgnoreCalculationErrors();//of course the calculation will still be schematron checked
|
zi.doIgnoreCalculationErrors();//of course the calculation will still be schematron checked
|
||||||
zi.setInputStream(inputStream);
|
zi.setInputStream(inputStream);
|
||||||
final String xmp = zi.getXMP();
|
final String xmp = zi.getXMP().substring(zi.getXMP().indexOf('<'));
|
||||||
|
|
||||||
final Document docXMP;
|
final Document docXMP;
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,15 @@ public class PDFValidatorTest extends ResourceCase {
|
|||||||
|
|
||||||
assertEquals(true, actual
|
assertEquals(true, actual
|
||||||
.contains("<error type=\"28\">XMP Metadata: Could not parse XMP metadata (XML invalid)</error>"));
|
.contains("<error type=\"28\">XMP Metadata: Could not parse XMP metadata (XML invalid)</error>"));
|
||||||
|
|
||||||
|
contents = getResourceAsByteArray("103767-Invoice-2026-03-24-1.pdf");
|
||||||
|
|
||||||
|
pv.setFilenameAndContents("103767-Invoice-2026-03-24-1.pdf", contents);
|
||||||
|
vc.clear();
|
||||||
|
pv.validate();
|
||||||
|
actual = pv.getXMLResult();
|
||||||
|
|
||||||
|
assertEquals(false, actual.contains("<error"));
|
||||||
} catch (final IrrecoverableValidationError e) {
|
} catch (final IrrecoverableValidationError e) {
|
||||||
// ignore, will be in XML output anyway
|
// ignore, will be in XML output anyway
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
validator/src/test/resources/103767-Invoice-2026-03-24-1.pdf
Normal file
BIN
validator/src/test/resources/103767-Invoice-2026-03-24-1.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user