Skip to content

Commit 8217dda

Browse files
committed
PDFBOX-5660: refactor
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1931035 13f79535-47bb-0310-9956-ffa450edef68
1 parent c478f71 commit 8217dda

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -695,30 +695,27 @@ private AbstractField parseLiElement(XMPMetadata xmp, QName descriptor, Element
695695
loadAttributes(af, liElement);
696696
return af;
697697
}
698+
// PDFBOX-4325: assume it is structured
699+
AbstractStructuredType af;
700+
try
701+
{
702+
af = tm.instanciateStructuredType(type, descriptor.getLocalPart());
703+
}
704+
catch (BadFieldValueException ex)
705+
{
706+
throw new XmpParsingException(ErrorType.InvalidType, "Parsing of structured type failed", ex);
707+
}
708+
loadAttributes(af, liElement);
709+
PropertiesDescription pm;
710+
if (type.isStructured())
711+
{
712+
pm = tm.getStructuredPropMapping(type);
713+
}
698714
else
699715
{
700-
// PDFBOX-4325: assume it is structured
701-
AbstractStructuredType af;
702-
try
703-
{
704-
af = tm.instanciateStructuredType(type, descriptor.getLocalPart());
705-
}
706-
catch (BadFieldValueException ex)
707-
{
708-
throw new XmpParsingException(ErrorType.InvalidType, "Parsing of structured type failed", ex);
709-
}
710-
loadAttributes(af, liElement);
711-
PropertiesDescription pm;
712-
if (type.isStructured())
713-
{
714-
pm = tm.getStructuredPropMapping(type);
715-
}
716-
else
717-
{
718-
pm = tm.getDefinedDescriptionByNamespace(liElement.getNamespaceURI(), liElement.getLocalName());
719-
}
720-
return tryParseAttributesAsProperties(tm, liElement, af, pm, null);
716+
pm = tm.getDefinedDescriptionByNamespace(liElement.getNamespaceURI(), liElement.getLocalName());
721717
}
718+
return tryParseAttributesAsProperties(tm, liElement, af, pm, null);
722719
}
723720

724721
private void loadAttributes(AbstractField sp, Element element)

0 commit comments

Comments
 (0)