/** * Add a new namespace Mapping for specific schema declared in PDF/A Extension schema * * @param desc The schemaDescription associated to the schema * @throws XmpUnknownValueTypeException When a Value Type associated is unknown */ public void setNamespaceDefinition(SchemaDescription desc) throws XmpUnknownValueTypeException { PropMapping propMap = new PropMapping(desc.getNameSpaceURI()); List<PDFAPropertyDescription> props = desc.getProperties(); for (int i = 0; i < props.size(); i++) { String type = getValueTypeEquivalence(desc, props.get(i).getValueTypeValue()); propMap.addNewProperty(props.get(i).getNameValue(), type, null); if (type.equals("Field")) { declareAssociatedFieldType(desc, props.get(i).getValueTypeValue(), propMap); } } String nsName = desc.getPrefix(); String ns = desc.getNameSpaceURI(); nsMaps.put(ns, new XMPSchemaFactory(nsName, ns, XMPSchema.class, propMap)); }
/** * Check if a non basic value type used is describes in the schema which inlude a property with a * such type * * @param desc The schema description associated to the schema which declare a property with * specific value type * @param definedValueType The value type name to find in value types descriptions * @return The description of this specific value type * @throws XmpUnknownValueTypeException If no declaration found */ private PDFAValueTypeDescription findValueTypeDescription( SchemaDescription desc, String definedValueType) throws XmpUnknownValueTypeException { List<PDFAValueTypeDescription> values = desc.getValueTypes(); for (PDFAValueTypeDescription val : values) { if (definedValueType.equals(val.getTypeNameValue())) { return val; } } throw new XmpUnknownValueTypeException( "ValueType '" + definedValueType + "' is unknown. no declaration found in this schema"); }