Skip to content

Commit 322675f

Browse files
committed
PDFBOX-5660: refactor
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930282 13f79535-47bb-0310-9956-ffa450edef68
1 parent 1ba3a0c commit 322675f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

xmpbox/src/main/java/org/apache/xmpbox/xml/DomXmpParser.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,13 @@ else if (attr.getPrefix() == null && XmpConstants.ABOUT_NAME.equals(attr.getLoca
232232
else if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix()))
233233
{
234234
String namespace = attr.getValue();
235-
if (!strictParsing && !tm.isStructuredTypeNamespace(namespace))
235+
if (!strictParsing && !tm.isStructuredTypeNamespace(namespace) &&
236+
xmp.getSchema(namespace) == null && tm.getSchemaFactory(namespace) == null)
236237
{
237238
// PDFBOX-5128: Add the schema on the fly if it can't be found
238239
// PDFBOX-5649: But only if the namespace isn't already known
239240
// because this adds a namespace without property descriptions
240-
String prefix = attr.getLocalName();
241-
242-
XMPSchema schema = xmp.getSchema(namespace);
243-
if (schema == null && tm.getSchemaFactory(namespace) == null)
244-
{
245-
tm.addNewNameSpace(namespace, prefix);
246-
}
241+
tm.addNewNameSpace(namespace, attr.getLocalName());
247242
}
248243
}
249244
else

0 commit comments

Comments
 (0)