use of org.apache.xmpbox.type.PDFATypeType in project pdfbox by apache.
the class PdfaExtensionHelper method populatePDFASchemaType.
private static void populatePDFASchemaType(XMPMetadata meta, PDFASchemaType st, TypeMapping tm) throws XmpParsingException {
String namespaceUri = st.getNamespaceURI().trim();
String prefix = st.getPrefixValue();
ArrayProperty properties = st.getProperty();
ArrayProperty valueTypes = st.getValueType();
XMPSchemaFactory xsf = tm.getSchemaFactory(namespaceUri);
// retrieve namespaces
if (xsf == null) {
// create namespace with no field
tm.addNewNameSpace(namespaceUri, prefix);
xsf = tm.getSchemaFactory(namespaceUri);
}
// populate value type
if (valueTypes != null) {
for (AbstractField af2 : valueTypes.getAllProperties()) {
if (af2 instanceof PDFATypeType) {
populatePDFAType(meta, (PDFATypeType) af2, tm);
}
}
}
// populate properties
if (properties == null) {
throw new XmpParsingException(ErrorType.RequiredProperty, "Missing pdfaSchema:property in type definition");
}
for (AbstractField af2 : properties.getAllProperties()) {
if (af2 instanceof PDFAPropertyType) {
populatePDFAPropertyType((PDFAPropertyType) af2, tm, xsf);
}
// TODO unmanaged ?
}
}
Aggregations