Author: tilman
Date: Wed Dec 17 12:28:38 2025
New Revision: 1930665
Log:
PDFBOX-6125: default to text in lenient mode
Modified:
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java
Modified:
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java
==============================================================================
---
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java
Wed Dec 17 12:17:44 2025 (r1930664)
+++
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java
Wed Dec 17 12:28:38 2025 (r1930665)
@@ -543,6 +543,13 @@ public class DomXmpParser
{
whatFound = firstChild instanceof Text ? "Text" :
firstChild.getClass().getName();
}
+ if (!strictParsing && firstChild instanceof Text)
+ {
+ // Default to text in lenient mode
+ // Improvement idea in the future: create an array and add the
text item.
+ manageSimpleType(xmp, property, Types.Text, container);
+ return;
+ }
throw new XmpParsingException(ErrorType.Format, "Invalid array
definition, expecting " + type.card()
+ " and found "
+ whatFound