You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by gb...@apache.org on 2012/10/26 19:48:43 UTC

svn commit: r1402595 [2/2] - in /pdfbox/branches/xmpbox-refactoring/xmpbox/src: main/java/org/apache/padaf/xmpbox/schema/ main/java/org/apache/padaf/xmpbox/type/ main/java/org/apache/padaf/xmpbox/xml/ test/java/org/apache/padaf/xmpbox/ test/java/org/ap...

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/DomXmpParser.java Fri Oct 26 17:48:41 2012
@@ -24,11 +24,15 @@ import org.apache.padaf.xmpbox.type.Abst
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.AbstractStructuredType;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.Attribute;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.Cardinality;
 import org.apache.padaf.xmpbox.type.ComplexPropertyContainer;
 import org.apache.padaf.xmpbox.type.PropMapping;
+import org.apache.padaf.xmpbox.type.PropertyType;
 import org.apache.padaf.xmpbox.type.TypeDescription;
 import org.apache.padaf.xmpbox.type.TypeMapping;
+import org.apache.padaf.xmpbox.type.Types;
 import org.apache.padaf.xmpbox.xml.XmpParsingException.ErrorType;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Comment;
@@ -153,7 +157,7 @@ public class DomXmpParser {
 				String prefix = property.getPrefix();
 				String name = property.getLocalName();
 				String namespace = property.getNamespaceURI();
-				String type = checkPropertyDefinition(xmp, DomHelper.getQName(property));
+				PropertyType type = checkPropertyDefinition(xmp, DomHelper.getQName(property));
 				// create the container 
 				if (!tm.isDefinedSchema(namespace)) {
 					throw new XmpParsingException(ErrorType.NoSchema,"This namespace is not a schema or a structured type : "+namespace);
@@ -169,18 +173,29 @@ public class DomXmpParser {
 				try {
 					if (type==null) {
 						if (strictParsing) {
-							throw new XmpParsingException(ErrorType.NoType, "No type defined for {"+namespace+"}"+name);
+							throw new XmpParsingException(ErrorType.InvalidType, "No type defined for {"+namespace+"}"+name);
 						} else {
 							// use it as string
-							manageSimpleType (xmp, property, "Text", container);
+							manageSimpleType (xmp, property, Types.Text, container);
 						}
-					} else if (type.equals("Lang Alt")) {
+					} else if (type.type()==Types.LangAlt) {
 						manageLangAlt (xmp, property, container);
-					} else if (tm.isSimpleType(type)) {
-						manageSimpleType (xmp, property, type, container);
 					} else if (tm.isArrayType(type)) {
 						manageArray(xmp,property,type,container);
-					} else if (tm.isStructuredType(type)) {
+					} else if (type.type().isSimple()) {
+						manageSimpleType (xmp, property, type.type(), container);
+					} else if (tm.isStructuredType(type.type())) {
+						if (DomHelper.isParseTypeResource(property)) {
+							AbstractStructuredType ast = parseLiDescription(xmp, DomHelper.getQName(property), property);
+							ast.setPrefix(prefix);
+							container.addProperty(ast);
+						} else {
+							Element inner = DomHelper.getFirstChildElement(property);
+							AbstractStructuredType ast = parseLiDescription(xmp, DomHelper.getQName(property), inner);
+							ast.setPrefix(prefix);
+							container.addProperty(ast);
+						}
+					} else if (type.type()==Types.DefinedType) {
 						if (DomHelper.isParseTypeResource(property)) {
 							AbstractStructuredType ast = parseLiDescription(xmp, DomHelper.getQName(property), property);
 							ast.setPrefix(prefix);
@@ -205,7 +220,7 @@ public class DomXmpParser {
 		}
 	}
 
-	private void manageSimpleType (XMPMetadata xmp, Element property, String type, ComplexPropertyContainer container) throws XmpParsingException {
+	private void manageSimpleType (XMPMetadata xmp, Element property, Types type, ComplexPropertyContainer container) throws XmpParsingException {
 		TypeMapping tm = xmp.getTypeMapping();
 		String prefix = property.getPrefix();
 		String name = property.getLocalName();
@@ -216,28 +231,29 @@ public class DomXmpParser {
 				name, 
 				property.getTextContent(),
 				type);
+		loadAttributes(sp, property);
 		container.addProperty(sp);
 	}
 
-	private void manageArray (XMPMetadata xmp, Element property, String type, ComplexPropertyContainer container) throws XmpParsingException, BadFieldValueException {
+	private void manageArray (XMPMetadata xmp, Element property, PropertyType type, ComplexPropertyContainer container) throws XmpParsingException, BadFieldValueException {
 		//		nsFinder.push(property);
 		try {
 			TypeMapping tm = xmp.getTypeMapping();
 			String prefix = property.getPrefix();
 			String name = property.getLocalName();
 			String namespace = property.getNamespaceURI();
-			String at = tm.getArrayType(type);
+//			Cardinality at = tm.getArrayType(type);
 			Element bagOrSeq = DomHelper.getUniqueElementChild(property);
 			// ensure this is the good type of array
 			if (bagOrSeq==null) {
 				// not an array
-				throw new XmpParsingException(ErrorType.Format,"Invalid array definition, expecting "+at+" and found nothing");
+				throw new XmpParsingException(ErrorType.Format,"Invalid array definition, expecting "+type.card()+" and found nothing");
 			}
-			if (!bagOrSeq.getLocalName().equals(at)) {
+			if (!bagOrSeq.getLocalName().equals(type.card().name())) {
 				// not the good array type
-				throw new XmpParsingException(ErrorType.Format,"Invalid array type, expecting "+at+" and found "+bagOrSeq.getLocalName());
+				throw new XmpParsingException(ErrorType.Format,"Invalid array type, expecting "+type.card()+" and found "+bagOrSeq.getLocalName());
 			}
-			ArrayProperty array = tm.createArrayProperty(namespace, prefix, name, at);
+			ArrayProperty array = tm.createArrayProperty(namespace, prefix, name, type.card());
 			container.addProperty(array);
 			List<Element> lis=  DomHelper.getElementChildren(bagOrSeq);
 
@@ -255,7 +271,7 @@ public class DomXmpParser {
 	}
 
 	private void manageLangAlt (XMPMetadata xmp, Element property, ComplexPropertyContainer container) throws XmpParsingException, BadFieldValueException {
-		manageArray(xmp,property,"Alt Lang",container);
+		manageArray(xmp,property,TypeMapping.createPropertyType(Types.LangAlt, Cardinality.Alt),container);
 	}
 
 
@@ -268,9 +284,9 @@ public class DomXmpParser {
 				String prefix = property.getPrefix();
 				String name = property.getLocalName();
 				String namespace = property.getNamespaceURI();
-				String dtype = checkPropertyDefinition(xmp, DomHelper.getQName(property));
-				TypeDescription<AbstractStructuredType> td = tm.getStructuredDescription(dtype);
-				String ptype = td.getProperties().getPropertyType(name);
+				PropertyType dtype = checkPropertyDefinition(xmp, DomHelper.getQName(property));
+				TypeDescription<AbstractStructuredType> td = tm.getStructuredDescription(dtype.type());
+				PropertyType ptype = td.getProperties().getPropertyType(name);
 				// create property
 				nsFinder.push(property);
 				try {
@@ -279,15 +295,15 @@ public class DomXmpParser {
 							throw new XmpParsingException(ErrorType.NoType, "No type defined for {"+namespace+"}"+name);
 						} else {
 							// use it as string
-							manageSimpleType (xmp, property, "Text", parentContainer);
+							manageSimpleType (xmp, property, Types.Text, parentContainer);
 						}
-					} else if (ptype.equals("Lang Alt")) {
+					} else if (ptype.type()==Types.LangAlt) {
 						manageLangAlt (xmp, property, parentContainer);
-					} else if (tm.isSimpleType(ptype)) {
-						manageSimpleType (xmp, property, ptype, parentContainer);
 					} else if (tm.isArrayType(ptype)) {
 						manageArray(xmp,property,ptype,parentContainer);
-					} else if (tm.isStructuredType(ptype)) {
+					} else if (ptype.type().isSimple()) {
+						manageSimpleType (xmp, property, ptype.type(), parentContainer);
+					} else if (tm.isStructuredType(ptype.type())) {
 						if (DomHelper.isParseTypeResource(property)) {
 							AbstractStructuredType ast = parseLiDescription(xmp, DomHelper.getQName(property), property);
 							ast.setPrefix(prefix);
@@ -331,7 +347,8 @@ public class DomXmpParser {
 						descriptor.getPrefix(), 
 						descriptor.getLocalPart(), 
 						text,
-						"Text");
+						Types.Text);
+				loadAttributes(sp, liElement);
 				return sp;
 			}
 		} finally {
@@ -339,6 +356,17 @@ public class DomXmpParser {
 		}
 	}
 
+	private void loadAttributes (AbstractSimpleProperty sp, Element element) {
+		NamedNodeMap nnm = element.getAttributes();
+		for (int i=0; i < nnm.getLength() ; i++) {
+			Attr attr = (Attr)nnm.item(i);
+			if (!XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) {
+				Attribute attribute = new Attribute(XMLConstants.XML_NS_URI,attr.getLocalName(), attr.getValue());
+				sp.setAttribute(attribute);
+			}
+		}
+	}
+	
 	private AbstractStructuredType parseLiDescription (XMPMetadata xmp, QName descriptor, Element liElement) throws XmpParsingException, BadFieldValueException {
 		//		nsFinder.push(liElement);
 		try {
@@ -350,42 +378,32 @@ public class DomXmpParser {
 			}
 			// Instantiate abstract structured type with hint from first element
 			Element first = elements.get(0);
-			String ctype = checkPropertyDefinition(xmp, DomHelper.getQName(first));
-			AbstractStructuredType ast = instanciateStructured(tm, ctype, descriptor.getLocalPart());
+			PropertyType ctype = checkPropertyDefinition(xmp, DomHelper.getQName(first));
+			AbstractStructuredType ast = instanciateStructured(tm, ctype.type(), descriptor.getLocalPart(),first.getNamespaceURI());
 			ast.setNamespace(descriptor.getNamespaceURI());
 			ast.setPrefix(descriptor.getPrefix());
 
-			TypeDescription<AbstractStructuredType> td = tm.getStructuredDescription(ctype);
+			TypeDescription<AbstractStructuredType> td = tm.getStructuredDescription(ctype.type());
+			if (td==null) {
+				td = tm.getDefinedDescriptionByNamespace(first.getNamespaceURI());
+			}
 			PropMapping pm = td.getProperties();
 			for (Element element : elements) {
 				String prefix = element.getPrefix();
 				String name = element.getLocalName();
 				String namespace = element.getNamespaceURI();
-				String type = pm.getPropertyType(name);
-				if (tm.isSimpleType(type)) {
+				PropertyType type = pm.getPropertyType(name);
+				if (type.type().isSimple()) {
 					AbstractSimpleProperty sp = tm.instanciateSimpleProperty(
 							namespace, 
 							prefix, 
 							name, 
 							element.getTextContent(),
-							type);
+							type.type());
+					loadAttributes(sp,element);
 					ast.getContainer().addProperty(sp);
-				} else if (tm.isStructuredType(type)) {
-					// create a new structured type
-					AbstractStructuredType inner = instanciateStructured(tm, type, name);
-					inner.setNamespace(namespace);
-					inner.setPrefix(prefix);
-					ast.getContainer().addProperty(inner);
-					ComplexPropertyContainer cpc = inner.getContainer();
-					if (DomHelper.isParseTypeResource(element)) {
-						parseDescriptionInner(xmp, element, cpc);
-					} else {
-						Element descElement = DomHelper.getFirstChildElement(element);
-						parseDescriptionInner(xmp,descElement,cpc);
-					}
-				} else if (tm.getArrayType(type)!=null) {
-					String at = tm.getArrayType(type);
-					ArrayProperty array = tm.createArrayProperty(namespace, prefix, name, at);
+				} else if (tm.isArrayType(type)) {
+					ArrayProperty array = tm.createArrayProperty(namespace, prefix, name, type.card());
 					ast.getContainer().addProperty(array);
 
 
@@ -397,6 +415,19 @@ public class DomXmpParser {
 							array.addProperty(ast2);
 						}
 					}
+				} else if (tm.isStructuredType(type.type())) {
+					// create a new structured type
+					AbstractStructuredType inner = instanciateStructured(tm, type.type(), name,null);
+					inner.setNamespace(namespace);
+					inner.setPrefix(prefix);
+					ast.getContainer().addProperty(inner);
+					ComplexPropertyContainer cpc = inner.getContainer();
+					if (DomHelper.isParseTypeResource(element)) {
+						parseDescriptionInner(xmp, element, cpc);
+					} else {
+						Element descElement = DomHelper.getFirstChildElement(element);
+						parseDescriptionInner(xmp,descElement,cpc);
+					}
 				} else {
 					throw new XmpParsingException(ErrorType.NoType, "Unidentified element to parse "+element+" (type="+type+")");
 				}
@@ -529,13 +560,16 @@ public class DomXmpParser {
 		// end of document
 	}
 
-	private AbstractStructuredType instanciateStructured (TypeMapping tm, String type, String name) throws BadFieldValueException {
+	private AbstractStructuredType instanciateStructured (TypeMapping tm, Types type, String name, String structuredNamespace) throws BadFieldValueException {
 		TypeDescription<AbstractStructuredType> td = null;
 		td = tm.getStructuredDescription(type);
+		if (td==null) {
+			td = tm.getDefinedDescriptionByNamespace(structuredNamespace);
+		}
 		return tm.instanciateStructuredType(td,name);
 	}
 
-	private String checkPropertyDefinition (XMPMetadata xmp, QName prop) throws XmpParsingException {
+	private PropertyType checkPropertyDefinition (XMPMetadata xmp, QName prop) throws XmpParsingException {
 		TypeMapping tm = xmp.getTypeMapping();
 		// test if namespace is set in xml
 		if (!nsFinder.containsNamespace(prop.getNamespaceURI())) {
@@ -543,15 +577,20 @@ public class DomXmpParser {
 		}
 		// test if namespace is defined
 		if (!tm.isDefinedSchema(prop.getNamespaceURI())) {
-			if (!tm.isStructuredTypeNamespace(prop.getNamespaceURI())) {
+			if (tm.isStructuredTypeNamespace(prop.getNamespaceURI())) {
+				// structured exists
+			} else if (tm.isDefinedTypeNamespace(prop.getNamespaceURI())) {
+				// defined
+			} else { 
+				// not existing
 				throw new XmpParsingException(ErrorType.NoSchema, "Cannot find a definition for the namespace "+prop.getNamespaceURI());
-			} // else structured exists
+			} 
 		}
-		String type = xmp.getTypeMapping().getSpecifiedPropertyType(prop);
-		if (type==null) {
-			throw new XmpParsingException(ErrorType.InvalidType,"No descriptor found for "+prop);
+		try {
+			return tm.getSpecifiedPropertyType(prop);
+		} catch (BadFieldValueException e) {
+			throw new XmpParsingException(ErrorType.InvalidType,"Failed to retreive property definition",e);
 		}
-		return type;
 	}
 
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/PdfaExtensionHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/PdfaExtensionHelper.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/PdfaExtensionHelper.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/xml/PdfaExtensionHelper.java Fri Oct 26 17:48:41 2012
@@ -11,15 +11,18 @@ import org.apache.padaf.xmpbox.type.Abst
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.AbstractStructuredType;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
+import org.apache.padaf.xmpbox.type.Cardinality;
 import org.apache.padaf.xmpbox.type.DefinedStructuredType;
 import org.apache.padaf.xmpbox.type.PDFAFieldType;
 import org.apache.padaf.xmpbox.type.PDFAPropertyType;
 import org.apache.padaf.xmpbox.type.PDFASchemaType;
 import org.apache.padaf.xmpbox.type.PDFATypeType;
 import org.apache.padaf.xmpbox.type.PropMapping;
+import org.apache.padaf.xmpbox.type.PropertyType;
 import org.apache.padaf.xmpbox.type.StructuredType;
 import org.apache.padaf.xmpbox.type.TypeDescription;
 import org.apache.padaf.xmpbox.type.TypeMapping;
+import org.apache.padaf.xmpbox.type.Types;
 import org.apache.padaf.xmpbox.xml.XmpParsingException.ErrorType;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
@@ -115,28 +118,32 @@ public final class PdfaExtensionHelper {
 												if (fName==null || fDescription==null || fValueType==null) {
 													throw new XmpParsingException(ErrorType.RequiredProperty,"Missing field in field definition");
 												}
-												// create the type
-												TypeDescription<AbstractSimpleProperty> vtd = tm.getSimpleDescription(fValueType);
-												if (vtd!=null) {
-													// a type is found
-													String ftype = vtd.getType();
-													structuredType.addProperty(fName, ftype);
-												} else {
-													// TODO could fValueType be a structured type ?
-													// unknown type
+												TypeDescription<AbstractSimpleProperty> vtd  = null;
+												try {
+													Types fValue = Types.valueOf(fValueType);
+													vtd = tm.getSimpleDescription(fValue);
+													if (vtd!=null) {
+														// a type is found
+														Types ftype = vtd.getType();
+														structuredType.addProperty(fName, TypeMapping.createPropertyType(ftype,Cardinality.Simple));
+													} else {
+														throw new XmpParsingException(ErrorType.NoValueType, "Type not defined : "+fValueType);
+													}
+												} catch (IllegalArgumentException e) {
 													throw new XmpParsingException(ErrorType.NoValueType, "Type not defined : "+fValueType);
+													// TODO could fValueType be a structured type ?
 												}
 											} // else TODO
 										}
 									}
 									// add the structured type to list
-									TypeDescription<AbstractStructuredType> td = new TypeDescription<AbstractStructuredType>(ttype, null, DefinedStructuredType.class);
+									TypeDescription<AbstractStructuredType> td = new TypeDescription<AbstractStructuredType>(Types.DefinedType, null, DefinedStructuredType.class);
 									PropMapping pm = new PropMapping(structuredType.getNamespace());
-									for (Map.Entry<String, String> entry : structuredType.getDefinedProperties().entrySet()) {
+									for (Map.Entry<String, PropertyType> entry : structuredType.getDefinedProperties().entrySet()) {
 										pm.addNewProperty(entry.getKey(), entry.getValue());
 									}
 									td.setProperties(pm);
-									meta.getTypeMapping().addToStructuredMaps(td,tns);
+									tm.addToDefinedStructuredTypes(ttype, td,tns);
 								}
 							}	
 						}
@@ -154,13 +161,15 @@ public final class PdfaExtensionHelper {
 									throw new XmpParsingException(ErrorType.RequiredProperty,"Missing field in property definition");
 								}
 								// check ptype existance
-								String etype = ptype.equals("Lang Alt")?ptype:tm.isArrayType(ptype)?tm.getTypeInArray(ptype):ptype;
-								if (tm.isSimpleType(etype) || tm.isStructuredType(etype) ) {
-									xsf.getPropertyDefinition().addNewProperty(pname, ptype);
+								PropertyType pt = transformValueType(tm,ptype);
+								if (pt.type()==null) {
+									throw new XmpParsingException(ErrorType.NoValueType, "Type not defined : "+ptype);
+								} else if (pt.type().isSimple() || tm.isStructuredType(pt.type()) || pt.type()==Types.DefinedType) {
+									xsf.getPropertyDefinition().addNewProperty(pname, pt);
 								} else {
-									throw new XmpParsingException(ErrorType.NoValueType, "Type not defined : "+ptype+" ("+etype+")");
+									throw new XmpParsingException(ErrorType.NoValueType, "Type not defined : "+ptype);
 								}
-								
+
 							} // TODO unmanaged ?
 						}
 					} // TODO unmanaged ?
@@ -169,5 +178,36 @@ public final class PdfaExtensionHelper {
 		}
 	}
 
+	private static PropertyType transformValueType (TypeMapping tm, String valueType) throws XmpParsingException {
+		if ("Lang Alt".equals(valueType)) {
+			return TypeMapping.createPropertyType(Types.LangAlt, Cardinality.Simple);
+		}
+		// else all other cases
+		int pos = valueType.indexOf(' ');
+		Cardinality card = Cardinality.Simple;
+		if (pos>0) {
+			String scard = valueType.substring(0,pos);
+			if ("seq".equals(scard)) {
+				card = Cardinality.Seq;
+			} else if ("bag".equals(scard)) {
+				card = Cardinality.Bag;
+			} else if ("alt".equals(scard)) {
+				card = Cardinality.Alt;
+			} else {
+//				throw new XmpParsingException(ErrorType.NoValueType, "Invalid type definition : "+valueType);
+				return null;
+			}
+		}
+		String vt = valueType.substring(pos+1);
+		Types type = null; 
+		try {
+			type = pos<0?Types.valueOf(valueType):Types.valueOf(vt);
+		} catch (IllegalArgumentException e) {
+			if (tm.isDefinedType(vt)) {
+				type = tm.getDefinedDescription(vt).getType();
+			}
+		}
+		return TypeMapping.createPropertyType(type, card);
+	}
 
 }

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java Fri Oct 26 17:48:41 2012
@@ -27,26 +27,29 @@ import javax.xml.XMLConstants;
 
 import org.apache.padaf.xmpbox.schema.XMPSchema;
 import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.Cardinality;
 import org.apache.padaf.xmpbox.type.PropertyType;
 import org.apache.padaf.xmpbox.type.StructuredType;
+import org.apache.padaf.xmpbox.type.TypeMapping;
+import org.apache.padaf.xmpbox.type.Types;
 
 
 @StructuredType(preferedPrefix="adn",namespace="http://test.apache.com/xap/adn/")
 public class BirthCertificateSchemaWithXMLDescriptions extends XMPSchema {
 
-	@PropertyType(propertyType = "Text")
+	@PropertyType(type = Types.Text, card = Cardinality.Simple)
 	public static final String FIRST_NAME = "firstname";
 
-	@PropertyType(propertyType = "seq Text")
+	@PropertyType(type = Types.Text, card = Cardinality.Seq)
 	public static final String LAST_NAME = "lastname";
 
-	@PropertyType(propertyType = "Text")
+	@PropertyType(type = Types.Text, card = Cardinality.Simple)
 	public static final String BIRTH_PLACE = "birth-place";
 
-	@PropertyType(propertyType = "Date")
+	@PropertyType(type = Types.Date, card = Cardinality.Simple)
 	public static final String BIRTH_DATE = "birth-date";
 
-	@PropertyType(propertyType = "Text")
+	@PropertyType(type = Types.Text, card = Cardinality.Simple)
 	public static final String BIRTH_COUNTRY = "birth-country";
 
 	public BirthCertificateSchemaWithXMLDescriptions(XMPMetadata metadata) {

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/DeserializationTest.java Fri Oct 26 17:48:41 2012
@@ -27,6 +27,7 @@ import java.util.List;
 
 import org.apache.padaf.xmpbox.DateConverter;
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
 import org.apache.padaf.xmpbox.type.ThumbnailType;
 import org.apache.padaf.xmpbox.xml.DomXmpParser;
 import org.junit.Assert;
@@ -66,6 +67,31 @@ public class DeserializationTest {
 		
 	}
 
+	@Test
+	public void testEmptyLi2 () throws Exception {
+		InputStream fis = DomXmpParser.class
+				.getResourceAsStream("/validxmp/emptyli.xml");
+
+		DomXmpParser xdb = new DomXmpParser();
+
+		XMPMetadata meta = xdb.parse(fis);
+		DublinCoreSchema dc = meta.getDublinCoreSchema();
+		dc.getCreatorsProperty();
+	}
+
+	@Test
+	public void testGetTitle () throws Exception {
+		InputStream fis = DomXmpParser.class
+				.getResourceAsStream("/validxmp/emptyli.xml");
+
+		DomXmpParser xdb = new DomXmpParser();
+
+		XMPMetadata meta = xdb.parse(fis);
+		DublinCoreSchema dc = meta.getDublinCoreSchema();
+		String s = dc.getTitle(null);
+		Assert.assertEquals("title value", s);
+	}
+
 	
 	@Test
 	public void testAltBagSeq() throws Exception {

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/PropMappingTest.java Fri Oct 26 17:48:41 2012
@@ -42,23 +42,5 @@ public class PropMappingTest {
 		Assert.assertEquals(nsURI, propMap.getConcernedNamespace());
 	}
 
-	@Test
-	public void testPropMapAdding() {
-		String name = "propName";
-		String type = "PropType";
 
-		propMap.addNewProperty(name, type);
-		Assert.assertEquals(1, propMap.getPropertiesName().size());
-		Assert.assertEquals(name, propMap.getPropertiesName().get(0));
-		Assert.assertEquals(type, propMap.getPropertyType(name));
-
-	}
-
-	@Test
-	public void testPropMapAttr() {
-		String name = "propName";
-		String type = "PropType";
-
-		propMap.addNewProperty(name, type);
-	}
 }

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java Fri Oct 26 17:48:41 2012
@@ -32,6 +32,7 @@ import org.apache.padaf.xmpbox.type.Arra
 import org.apache.padaf.xmpbox.type.TypeDescription;
 import org.apache.padaf.xmpbox.type.TypeMapping;
 import org.apache.padaf.xmpbox.type.TypeTestingHelper;
+import org.apache.padaf.xmpbox.type.Types;
 import org.apache.padaf.xmpbox.xml.DomXmpParser;
 import org.junit.Test;
 
@@ -42,7 +43,7 @@ public abstract class AbstractSchemaTest
 	
 	protected String fieldName;
 	
-	protected String type;
+	protected Types type;
 	
 	protected Cardinality cardinality;
 
@@ -50,6 +51,7 @@ public abstract class AbstractSchemaTest
 	
 	protected DomXmpParser builder;
 	
+	// TODO supprimer
 	protected enum Cardinality {Simple, Bag, Seq, Alt}
 	
 	public void before () throws Exception {
@@ -64,7 +66,7 @@ public abstract class AbstractSchemaTest
 		return getSchema().getClass();
 	}
 	
-	public AbstractSchemaTester (String fieldName, String type, Cardinality card) {
+	public AbstractSchemaTester (String fieldName, Types type, Cardinality card) {
 		this.fieldName = fieldName;
 		this.type = type;
 		this.cardinality = card;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java Fri Oct 26 17:48:41 2012
@@ -33,11 +33,14 @@ import junit.framework.Assert;
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AgentNameType;
 import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.Cardinality;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;
 import org.apache.padaf.xmpbox.type.PropertyType;
 import org.apache.padaf.xmpbox.type.TextType;
 import org.apache.padaf.xmpbox.type.ThumbnailType;
+import org.apache.padaf.xmpbox.type.TypeMapping;
+import org.apache.padaf.xmpbox.type.Types;
 import org.apache.padaf.xmpbox.type.URIType;
 import org.apache.padaf.xmpbox.type.URLType;
 import org.junit.Test;
@@ -48,7 +51,7 @@ public abstract class AbstractXMPSchemaT
 
 	protected String property;
 
-	protected String type;
+	protected PropertyType type;
 
 	protected XMPSchema schema;
 
@@ -56,61 +59,53 @@ public abstract class AbstractXMPSchemaT
 
 	protected Object value;
 
-	public AbstractXMPSchemaTest(String property, String type, Object value) {
+	public AbstractXMPSchemaTest(String property, PropertyType type, Object value) {
 		this.property = property;
 		this.value = value;
 		this.type = type;
 	}
 
-	public static Object[] wrapProperty(String name, String type, Object value) {
-		if (type.equals("Boolean")) {
-			Assert.assertTrue(value instanceof Boolean);
-		} else if (type.equals("Text")) {
-			Assert.assertTrue(value instanceof String);
-		} else if (type.equals("Integer")) {
-			Assert.assertTrue(value instanceof Integer);
-		} else if (type.equals("Date")) {
-			Assert.assertTrue(value instanceof Calendar);
-		} else if (type.equals("URL")) {
-			Assert.assertTrue(value instanceof String);
-		}
-		return new Object[] { name, type, value };
+	public static Object[] wrapProperty(String name, Types type, Object value) {
+		return wrapProperty(name, type, Cardinality.Simple, value);
+	}
+	
+	public static Object[] wrapProperty(String name, Types type, Cardinality card, Object value) {
+//		if (type==Types.Boolean) {
+//			Assert.assertTrue(value instanceof Boolean);
+//		} else if (type==Types.Text) {
+//			Assert.assertTrue(value instanceof String);
+//		} else if (type==Types.Integer) {
+//			Assert.assertTrue(value instanceof Integer);
+//		} else if (type==Types.Date) {
+//			Assert.assertTrue(value instanceof Calendar);
+//		} else if (type==Types.URL) {
+//			Assert.assertTrue(value instanceof String);
+//		}
+		return new Object[] { name, TypeMapping.createPropertyType(type, card), value };
 	}
 
 	@Test
 	public void testGetSetValue() throws Exception {
-		if (type.equals("Text")) {
+		if (type.type()==Types.Text && type.card()==Cardinality.Simple) {
 			testGetSetTextValue();
-		} else if (type.equals("Boolean")) {
+		} else if (type.type()==Types.Boolean && type.card()==Cardinality.Simple) {
 			testGetSetBooleanValue();
-		} else if (type.equals("Integer")) {
+		} else if (type.type()==Types.Integer && type.card()==Cardinality.Simple) {
 			testGetSetIntegerValue();
-		} else if (type.equals("Date")) {
+		} else if (type.type()==Types.Date && type.card()==Cardinality.Simple) {
 			testGetSetDateValue();
-		} else if (type.equals("seq Text")) {
-			// do nothing
-		} else if (type.equals("bag Text")) {
-			// do nothing
-		} else if (type.equals("bag ProperName")) {
-			// do nothing
-		} else if (type.equals("bag Xpath")) {
-			// do nothing
-		} else if (type.equals("seq Date")) {
-			// do nothing
-		} else if (type.equals("seq Version")) {
-			// do nothing
-		} else if (type.equals("Lang Alt")) {
-			// do nothing
-		} else if (type.equals("Alt Thumbnail")) {
-			// do nothing
-		} else if (type.equals("ResourceRef")) {
-			// do nothing
-		} else if (type.equals("URL")) {
+		} else if (type.type()==Types.URI && type.card()==Cardinality.Simple) {
 			testGetSetTextValue();
-		} else if (type.equals("URI")) {
+		} else if (type.type()==Types.URL && type.card()==Cardinality.Simple) {
 			testGetSetTextValue();
-		} else if (type.equals("AgentName")) {
+		} else if (type.type()==Types.AgentName && type.card()==Cardinality.Simple) {
 			testGetSetTextValue();
+		} else if (type.type()==Types.LangAlt && type.card()==Cardinality.Simple) {
+			// do nothing
+		} else if (type.type()==Types.ResourceRef && type.card()==Cardinality.Simple) {
+			// do nothing
+		} else if (type.card()!=Cardinality.Simple) {
+			// do nothing
 		} else {
 			throw new Exception("Unknown type : " + type);
 		}
@@ -118,35 +113,35 @@ public abstract class AbstractXMPSchemaT
 
 	@Test
 	public void testGetSetProperty() throws Exception {
-		if (type.equals("Text")) {
+		if (type.type()==Types.Text && type.card()==Cardinality.Simple) {
 			testGetSetTextProperty();
-		} else if (type.equals("URI")) {
+		} else if (type.type()==Types.URI && type.card()==Cardinality.Simple) {
 			testGetSetURIProperty();
-		} else if (type.equals("URL")) {
+		} else if (type.type()==Types.URL && type.card()==Cardinality.Simple) {
 			testGetSetURLProperty();
-		} else if (type.equals("AgentName")) {
+		} else if (type.type()==Types.AgentName && type.card()==Cardinality.Simple) {
 			testGetSetAgentNameProperty();
-		} else if (type.equals("Boolean")) {
+		} else if (type.type()==Types.Boolean && type.card()==Cardinality.Simple) {
 			testGetSetBooleanProperty();
-		} else if (type.equals("Integer")) {
+		} else if (type.type()==Types.Integer && type.card()==Cardinality.Simple) {
 			testGetSetIntegerProperty();
-		} else if (type.equals("Date")) {
+		} else if (type.type()==Types.Date && type.card()==Cardinality.Simple) {
 			testGetSetDateProperty();
-		} else if (type.equals("seq Text")) {
+		} else if (type.type()==Types.Text && type.card()==Cardinality.Seq) {
 			testGetSetTextListValue("seq");
-		} else if (type.equals("seq Version")) {
+		} else if (type.type()==Types.Version && type.card()==Cardinality.Seq) {
 			testGetSetTextListValue("seq");
-		} else if (type.equals("bag Text")) {
+		} else if (type.type()==Types.Text && type.card()==Cardinality.Bag) {
 			testGetSetTextListValue("bag");
-		} else if (type.equals("bag ProperName")) {
+		} else if (type.type()==Types.ProperName && type.card()==Cardinality.Bag) {
 			testGetSetTextListValue("bag");
-		} else if (type.equals("bag Xpath")) {
+		} else if (type.type()==Types.XPath && type.card()==Cardinality.Bag) {
 			testGetSetTextListValue("bag");
-		} else if (type.equals("seq Date")) {
+		} else if (type.type()==Types.Date && type.card()==Cardinality.Seq) {
 			testGetSetDateListValue("seq");
-		} else if (type.equals("Lang Alt")) {
+		} else if (type.type()==Types.LangAlt && type.card()==Cardinality.Simple) {
 			testGetSetLangAltValue();
-		} else if (type.equals("Alt Thumbnail")) {
+		} else if (type.type()==Types.Thumbnail && type.card()==Cardinality.Alt) {
 			testGetSetThumbnail();
 		} else {
 			throw new Exception("Unknown type : " + type);
@@ -156,17 +151,17 @@ public abstract class AbstractXMPSchemaT
 			if (field.isAnnotationPresent(PropertyType.class)) {
 				if (!field.get(schema).equals(property)) {
 					PropertyType pt = field.getAnnotation(PropertyType.class);
-					if (pt.propertyType().equals("Lang Alt")) {
+					if (pt.type()==Types.LangAlt) {
 						// do not check method existence
-					} else if (pt.propertyType().equals("Alt Thumbnail")) {
+					} else if (pt.type()==Types.Thumbnail && pt.card()==Cardinality.Alt) {
 						// do not check method existence
-					} else if (pt.propertyType().equals("ResourceRef")) {
+					} else if (pt.type()==Types.ResourceRef) {
 						// do not check method existence
-					} else if (pt.propertyType().equals("seq Version")) {
+					} else if (pt.type()==Types.Version && pt.card()==Cardinality.Seq) {
 						// do not check method existence
 					} else {
 						// type test
-						String spt = retrievePropertyType(field.get(schema).toString());
+						PropertyType spt = retrievePropertyType(field.get(schema).toString());
 						String getNameProperty = "get" + prepareName(
 								field.get(schema).toString(), spt) + "Property";
 						Method getMethod = schemaClass.getMethod(getNameProperty);
@@ -188,13 +183,13 @@ public abstract class AbstractXMPSchemaT
 		}
 	}
 
-	protected String retrievePropertyType (String prop) throws IllegalArgumentException,IllegalAccessException {
+	protected PropertyType retrievePropertyType (String prop) throws IllegalArgumentException,IllegalAccessException {
 		Field [] fields = schemaClass.getFields();
 		for (Field field : fields) {
 			if (field.isAnnotationPresent(PropertyType.class)) {
 				PropertyType pt = field.getAnnotation(PropertyType.class);
 				if (field.get(schema).equals(prop)) {
-					return pt.propertyType();
+					return pt;
 				}
 			}
 		}
@@ -208,7 +203,7 @@ public abstract class AbstractXMPSchemaT
 		return sb.toString();
 	}
 
-	protected String prepareName (String prop, String type) {
+	protected String prepareName (String prop, PropertyType type) {
 		String fu = firstUpper(prop);
 		StringBuilder sb = new StringBuilder(fu.length()+1);
 		sb.append(fu);
@@ -216,10 +211,9 @@ public abstract class AbstractXMPSchemaT
 			// do nothing
 		} else if (fu.endsWith("y")) {
 			// do nothing
+		} else if (type.card()!=Cardinality.Simple) {
+			sb.append("s");
 		}
-		else if (type.startsWith("bag ")) sb.append("s");
-		else if (type.startsWith("seq ")) sb.append("s");
-		else if (type.startsWith("alt ")) sb.append("s");
 		return sb.toString();
 	}
 	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java Fri Oct 26 17:48:41 2012
@@ -21,12 +21,16 @@
 
 package org.apache.padaf.xmpbox.schema;
 
+import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.Cardinality;
+import org.apache.padaf.xmpbox.type.PropertyType;
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -47,14 +51,14 @@ public class AdobePDFTest extends Abstra
 	@Parameters
 	public static Collection<Object[]> initializeParameters() throws Exception {
 		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("Keywords", "Text", "kw1 kw2 kw3"));
-		data.add(wrapProperty("PDFVersion", "Text", "1.4"));
-		data.add(wrapProperty("Producer", "Text", "testcase"));
-
+		data.add(wrapProperty("Keywords", Types.Text, "kw1 kw2 kw3"));
+		data.add(wrapProperty("PDFVersion", Types.Text, "1.4"));
+		data.add(wrapProperty("Producer", Types.Text, "testcase"));
+	
 		return data;
 	}
 
-	public AdobePDFTest(String property, String type, Object value) {
+	public AdobePDFTest(String property, PropertyType type, Object value) {
 		super(property, type, value);
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java Fri Oct 26 17:48:41 2012
@@ -23,6 +23,7 @@ package org.apache.padaf.xmpbox.schema;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -43,7 +44,7 @@ public class DublinCoreTest extends Abst
 		schema = xmp.createAndAddDublinCoreSchema();
 	}
 
-	public DublinCoreTest(String fieldName, String type, Cardinality card) {
+	public DublinCoreTest(String fieldName, Types type, Cardinality card) {
 		super(fieldName, type, card);
 	}
 
@@ -51,18 +52,18 @@ public class DublinCoreTest extends Abst
 	public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {"contributor","ProperName",Cardinality.Bag});
-    	result.add(new Object [] {"coverage","Text",Cardinality.Simple});
-    	result.add(new Object [] {"creator","ProperName",Cardinality.Seq});
-    	result.add(new Object [] {"date","Date",Cardinality.Seq});
-    	result.add(new Object [] {"format","MIMEType",Cardinality.Simple});
-    	result.add(new Object [] {"identifier","Text",Cardinality.Simple});
-    	result.add(new Object [] {"language","Locale",Cardinality.Bag});
-    	result.add(new Object [] {"publisher","ProperName",Cardinality.Bag});
-    	result.add(new Object [] {"relation","Text",Cardinality.Bag});
-    	result.add(new Object [] {"source","Text",Cardinality.Simple});
-    	result.add(new Object [] {"subject","Text",Cardinality.Bag});
-    	result.add(new Object [] {"type","Text",Cardinality.Bag});
+    	result.add(new Object [] {"contributor", Types.ProperName,Cardinality.Bag});
+    	result.add(new Object [] {"coverage",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"creator",Types.ProperName,Cardinality.Seq});
+    	result.add(new Object [] {"date",Types.Date,Cardinality.Seq});
+    	result.add(new Object [] {"format",Types.MIMEType,Cardinality.Simple});
+    	result.add(new Object [] {"identifier",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"language",Types.Locale,Cardinality.Bag});
+    	result.add(new Object [] {"publisher",Types.ProperName,Cardinality.Bag});
+    	result.add(new Object [] {"relation",Types.Text,Cardinality.Bag});
+    	result.add(new Object [] {"source",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"subject",Types.Text,Cardinality.Bag});
+    	result.add(new Object [] {"type",Types.Text,Cardinality.Bag});
    	
     	return result;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java Fri Oct 26 17:48:41 2012
@@ -26,6 +26,8 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.PropertyType;
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -44,13 +46,13 @@ public class PDFAIdentificationTest exte
 	@Parameters
 	public static Collection<Object[]> initializeParameters() throws Exception {
 		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("part", "Integer", 1));
-		data.add(wrapProperty("amd", "Text", "2005"));
-		data.add(wrapProperty("conformance", "Text", "B"));
+		data.add(wrapProperty("part", Types.Integer, 1));
+		data.add(wrapProperty("amd", Types.Text, "2005"));
+		data.add(wrapProperty("conformance", Types.Text, "B"));
 		return data;
 	}
 
-	public PDFAIdentificationTest(String property, String type, Object value) {
+	public PDFAIdentificationTest(String property, PropertyType type, Object value) {
 		super(property, type, value);
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PhotoshopSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PhotoshopSchemaTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PhotoshopSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PhotoshopSchemaTest.java Fri Oct 26 17:48:41 2012
@@ -23,6 +23,7 @@ package org.apache.padaf.xmpbox.schema;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -43,7 +44,7 @@ public class PhotoshopSchemaTest extends
 		schema = xmp.createAndAddPhotoshopSchema();
 	}
 
-	public PhotoshopSchemaTest(String fieldName, String type, Cardinality card) {
+	public PhotoshopSchemaTest(String fieldName, Types type, Cardinality card) {
 		super(fieldName, type, card);
 	}
 
@@ -51,31 +52,25 @@ public class PhotoshopSchemaTest extends
 	public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {"AncestorID","URI",Cardinality.Simple});
-//    	result.add(new Object [] {"LayerName","Text",Cardinality.Simple}); TODO TEST missing in schema
-//    	result.add(new Object [] {"LayerText","Text",Cardinality.Simple}); TODO TEST missing in schema
-    	result.add(new Object [] {"AuthorsPosition","Text",Cardinality.Simple});
-    	result.add(new Object [] {"CaptionWriter","ProperName",Cardinality.Simple});
-    	result.add(new Object [] {"Category","Text",Cardinality.Simple});
-    	result.add(new Object [] {"City","Text",Cardinality.Simple});
-    	result.add(new Object [] {"ColorMode","Integer",Cardinality.Simple});
-    	result.add(new Object [] {"Country","Text",Cardinality.Simple});
-    	result.add(new Object [] {"Credit","Text",Cardinality.Simple});
-    	result.add(new Object [] {"DateCreated","Date",Cardinality.Simple});
-    	// DocumentAncestors TODO TEST bag Ancestor
-    	result.add(new Object [] {"Headline","Text",Cardinality.Simple});
-    	result.add(new Object [] {"History","Text",Cardinality.Simple});
-    	result.add(new Object [] {"ICCProfile","Text",Cardinality.Simple});
-    	result.add(new Object [] {"Instructions","Text",Cardinality.Simple});
-    	result.add(new Object [] {"Source","Text",Cardinality.Simple});
-    	result.add(new Object [] {"State","Text",Cardinality.Simple});
-    	result.add(new Object [] {"SupplementalCategories","Text",Cardinality.Bag});
-    	// Layer TODO TEST structured type
-    	result.add(new Object [] {"TransmissionReference","Text",Cardinality.Simple});
-    	result.add(new Object [] {"Urgency","Integer",Cardinality.Simple});
+    	result.add(new Object [] {"AncestorID",Types.URI,Cardinality.Simple});
+    	result.add(new Object [] {"AuthorsPosition",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"CaptionWriter",Types.ProperName,Cardinality.Simple});
+    	result.add(new Object [] {"Category",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"City",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"ColorMode",Types.Integer,Cardinality.Simple});
+    	result.add(new Object [] {"Country",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"Credit",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"DateCreated",Types.Date,Cardinality.Simple});
+    	result.add(new Object [] {"Headline",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"History",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"ICCProfile",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"Instructions",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"Source",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"State",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"SupplementalCategories",Types.Text,Cardinality.Bag});
+    	result.add(new Object [] {"TransmissionReference",Types.Text,Cardinality.Simple});
+    	result.add(new Object [] {"Urgency",Types.Integer,Cardinality.Simple});
 
-    	// TODO TEST camera raw
-    	
     	return result;
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java Fri Oct 26 17:48:41 2012
@@ -27,6 +27,9 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.Cardinality;
+import org.apache.padaf.xmpbox.type.PropertyType;
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -35,7 +38,7 @@ import org.junit.runners.Parameterized.P
 @RunWith(Parameterized.class)
 public class XMPBasicTest extends AbstractXMPSchemaTest {
 
-	public XMPBasicTest(String prop, String type, Object val) {
+	public XMPBasicTest(String prop, PropertyType type, Object val) {
 		super(prop, type, val);
 	}
 
@@ -50,20 +53,20 @@ public class XMPBasicTest extends Abstra
 	public static Collection<Object[]> initializeParameters() throws Exception {
 		List<Object[]> data = new ArrayList<Object[]>();
 
-		data.add(wrapProperty("Advisory", "bag Xpath", new String[] { "xpath1",
+		data.add(wrapProperty("Advisory", Types.XPath, Cardinality.Bag, new String[] { "xpath1",
 				"xpath2" }));
-		data.add(wrapProperty("BaseURL", "URL", "URL"));
-		data.add(wrapProperty("CreateDate", "Date", Calendar.getInstance()));
-		data.add(wrapProperty("CreatorTool", "AgentName", "CreatorTool"));
-		data.add(wrapProperty("Identifier", "bag Text", new String[] { "id1",
+		data.add(wrapProperty("BaseURL", Types.URL, "URL"));
+		data.add(wrapProperty("CreateDate", Types.Date, Calendar.getInstance()));
+		data.add(wrapProperty("CreatorTool", Types.AgentName, "CreatorTool"));
+		data.add(wrapProperty("Identifier", Types.Text, Cardinality.Bag, new String[] { "id1",
 				"id2" }));
-		data.add(wrapProperty("Label", "Text", "label"));
-		data.add(wrapProperty("MetadataDate", "Date", Calendar.getInstance()));
-		data.add(wrapProperty("ModifyDate", "Date", Calendar.getInstance()));
-		data.add(wrapProperty("Nickname", "Text", "nick name"));
-		data.add(wrapProperty("Rating", "Integer", 7));
+		data.add(wrapProperty("Label", Types.Text, "label"));
+		data.add(wrapProperty("MetadataDate", Types.Date, Calendar.getInstance()));
+		data.add(wrapProperty("ModifyDate", Types.Date, Calendar.getInstance()));
+		data.add(wrapProperty("Nickname", Types.Text, "nick name"));
+		data.add(wrapProperty("Rating", Types.Integer, 7));
 
-		data.add(wrapProperty("Thumbnails", "Alt Thumbnail", null));
+		data.add(wrapProperty("Thumbnails", Types.Thumbnail, Cardinality.Alt, null));
 
 		return data;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java Fri Oct 26 17:48:41 2012
@@ -26,6 +26,9 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.Cardinality;
+import org.apache.padaf.xmpbox.type.PropertyType;
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -44,27 +47,27 @@ public class XMPMediaManagementTest exte
 	@Parameters
 	public static Collection<Object[]> initializeParameters() throws Exception {
 		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("DocumentID", "URI",
+		data.add(wrapProperty("DocumentID", Types.URI,
 				"uuid:FB031973-5E75-11B2-8F06-E7F5C101C07A"));
-		data.add(wrapProperty("Manager", "AgentName", "Raoul"));
-		data.add(wrapProperty("ManageTo", "URI", "uuid:36"));
-		data.add(wrapProperty("ManageUI", "URI", "uuid:3635"));
+		data.add(wrapProperty("Manager", Types.AgentName, "Raoul"));
+		data.add(wrapProperty("ManageTo", Types.URI, "uuid:36"));
+		data.add(wrapProperty("ManageUI", Types.URI, "uuid:3635"));
 //		data.add(wrapProperty("ManageFrom", "ResourceRef", "uuid:36"));
-		data.add(wrapProperty("InstanceID", "URI", "uuid:42"));
-		data.add(wrapProperty("OriginalDocumentID", "Text", "uuid:142"));
+		data.add(wrapProperty("InstanceID", Types.URI, "uuid:42"));
+		data.add(wrapProperty("OriginalDocumentID", Types.Text, "uuid:142"));
 //		data.add(wrapProperty("RenditionClass", "Text", "myclass"));
-		data.add(wrapProperty("RenditionParams", "Text", "my params"));
-		data.add(wrapProperty("VersionID", "Text", "14"));
-		data.add(wrapProperty("Versions", "seq Version", new String[] { "1", "2",
+		data.add(wrapProperty("RenditionParams", Types.Text, "my params"));
+		data.add(wrapProperty("VersionID", Types.Text, "14"));
+		data.add(wrapProperty("Versions", Types.Version, Cardinality.Seq, new String[] { "1", "2",
 				"3" }));
-		data.add(wrapProperty("History", "seq Text", new String[] { "action 1",
+		data.add(wrapProperty("History", Types.Text, Cardinality.Seq,new String[] { "action 1",
 				"action 2", "action 3" }));
-		data.add(wrapProperty("Ingredients", "bag Text", new String[] {
+		data.add(wrapProperty("Ingredients", Types.Text,Cardinality.Bag, new String[] {
 				"resource1", "resource2" }));
 		return data;
 	}
 
-	public XMPMediaManagementTest(String property, String type, Object value) {
+	public XMPMediaManagementTest(String property, PropertyType type, Object value) {
 		super(property, type, value);
 	}
 

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java Fri Oct 26 17:48:41 2012
@@ -35,6 +35,7 @@ import org.apache.padaf.xmpbox.type.Arra
 import org.apache.padaf.xmpbox.type.Attribute;
 import org.apache.padaf.xmpbox.type.BadFieldValueException;
 import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.Cardinality;
 import org.apache.padaf.xmpbox.type.DateType;
 import org.apache.padaf.xmpbox.type.IntegerType;
 import org.apache.padaf.xmpbox.type.TextType;
@@ -83,7 +84,7 @@ public class XMPSchemaTest {
 	public void testArrayList() throws Exception {
 		XMPMetadata meta = XMPMetadata.createXMPMetadata();
 		ArrayProperty newSeq = meta.getTypeMapping().createArrayProperty(null, "nsSchem",
-				"seqType", ArrayProperty.ORDERED_ARRAY);
+				"seqType", Cardinality.Seq);
 		TypeMapping tm = meta.getTypeMapping();
 		TextType li1 = tm.createText(null, "rdf", "li", "valeur1");
 		TextType li2 =tm.createText(null, "rdf", "li", "valeur2");

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java Fri Oct 26 17:48:41 2012
@@ -28,6 +28,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.type.Cardinality;
+import org.apache.padaf.xmpbox.type.PropertyType;
+import org.apache.padaf.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -36,7 +39,7 @@ import org.junit.runners.Parameterized.P
 @RunWith(Parameterized.class)
 public class XmpRightsSchemaTest extends AbstractXMPSchemaTest {
 
-	public XmpRightsSchemaTest(String property, String type, Object value) {
+	public XmpRightsSchemaTest(String property, PropertyType type, Object value) {
 		super(property, type, value);
 	}
 
@@ -50,17 +53,17 @@ public class XmpRightsSchemaTest extends
 	@Parameters
 	public static Collection<Object[]> initializeParameters() throws Exception {
 		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("Certificate", "URL",
+		data.add(wrapProperty("Certificate", Types.URL,
 				"http://une.url.vers.un.certificat/moncert.cer"));
-		data.add(wrapProperty("Marked", "Boolean", true));
-		data.add(wrapProperty("Owner", "bag ProperName",
+		data.add(wrapProperty("Marked", Types.Boolean, true));
+		data.add(wrapProperty("Owner", Types.ProperName, Cardinality.Bag,
 				new String[] { "OwnerName" }));
 
 		Map<String, String> desc = new HashMap<String, String>(2);
 		desc.put("fr", "Termes d'utilisation");
 		desc.put("en", "Usage Terms");
-		data.add(wrapProperty("UsageTerms", "Lang Alt", desc));
-		data.add(wrapProperty("WebStatement", "URL",
+		data.add(wrapProperty("UsageTerms", Types.LangAlt, desc));
+		data.add(wrapProperty("WebStatement", Types.URL,
 				"http://une.url.vers.une.page.fr/"));
 		return data;
 	}

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AbstractStructuredTypeTester.java Fri Oct 26 17:48:41 2012
@@ -37,7 +37,7 @@ public abstract class AbstractStructured
 	
 	protected String fieldName;
 	
-	protected String type;
+	protected Types type;
 	
 	protected Class<? extends AbstractStructuredType> clz;
 	
@@ -51,7 +51,7 @@ public abstract class AbstractStructured
 		typeMapping = xmp.getTypeMapping();
 	}
 	
-	public AbstractStructuredTypeTester (Class<? extends AbstractStructuredType> clz, String fieldName, String type) {
+	public AbstractStructuredTypeTester (Class<? extends AbstractStructuredType> clz, String fieldName, Types type) {
 		this.clz = clz;
 		this.fieldName = fieldName;
 		this.type = type;

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestAbstractStructuredType.java Fri Oct 26 17:48:41 2012
@@ -33,10 +33,10 @@ public class TestAbstractStructuredType 
 
 	private static class MyStructuredType extends AbstractStructuredType {
 		
-		@PropertyType(propertyType="Text")
+		@PropertyType(type = Types.Text, card = Cardinality.Simple)
 		public static final String MYTEXT ="my-text";
 
-		@PropertyType(propertyType="Date")
+		@PropertyType(type = Types.Date, card = Cardinality.Simple)
 		public static final String MYDATE ="my-date";
 
 		public MyStructuredType(XMPMetadata metadata, String namespaceURI,

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestJobType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestJobType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestJobType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestJobType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestJobType extends Abstrac
 		structured = new JobType(xmp,"job");
 	}
 	
-	public TestJobType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestJobType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -54,9 +54,9 @@ public class TestJobType extends Abstrac
     public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {JobType.class,"id","Text"});
-    	result.add(new Object [] {JobType.class,"name","Text"});
-    	result.add(new Object [] {JobType.class,"url","URL"});
+    	result.add(new Object [] {JobType.class,"id",Types.Text});
+    	result.add(new Object [] {JobType.class,"name",Types.Text});
+    	result.add(new Object [] {JobType.class,"url",Types.URL});
     	
     	return result;
     	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestLayerType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestLayerType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestLayerType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestLayerType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestLayerType extends Abstr
 		structured = new LayerType(xmp);
 	}
 	
-	public TestLayerType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestLayerType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -54,8 +54,8 @@ public class TestLayerType extends Abstr
     public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {LayerType.class,"LayerName","Text"});
-    	result.add(new Object [] {LayerType.class,"LayerText","Text"});
+    	result.add(new Object [] {LayerType.class,"LayerName",Types.Text});
+    	result.add(new Object [] {LayerType.class,"LayerText",Types.Text});
     	
     	return result;
     	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceEventType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceEventType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceEventType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceEventType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestResourceEventType exten
 		structured = new ResourceEventType(xmp);
 	}
 	
-	public TestResourceEventType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestResourceEventType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -54,12 +54,12 @@ public class TestResourceEventType exten
     public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {ResourceEventType.class,"action","Choice"});
-    	result.add(new Object [] {ResourceEventType.class,"changed","Text"});
-    	result.add(new Object [] {ResourceEventType.class,"instanceID","GUID"});
-    	result.add(new Object [] {ResourceEventType.class,"parameters","Text"});
-    	result.add(new Object [] {ResourceEventType.class,"softwareAgent","AgentName"});
-    	result.add(new Object [] {ResourceEventType.class,"when","Date"});
+    	result.add(new Object [] {ResourceEventType.class,"action",Types.Choice});
+    	result.add(new Object [] {ResourceEventType.class,"changed",Types.Text});
+    	result.add(new Object [] {ResourceEventType.class,"instanceID",Types.GUID});
+    	result.add(new Object [] {ResourceEventType.class,"parameters",Types.Text});
+    	result.add(new Object [] {ResourceEventType.class,"softwareAgent",Types.AgentName});
+    	result.add(new Object [] {ResourceEventType.class,"when",Types.Date});
     	
     	return result;
     	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceRefType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceRefType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceRefType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestResourceRefType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestResourceRefType extends
 		structured = new ResourceRefType(xmp);
 	}
 	
-	public TestResourceRefType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestResourceRefType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -55,21 +55,21 @@ public class TestResourceRefType extends
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
 //     	result.add(new Object [] {ResourceRefType.class,"alternatePaths","seq URI"});
-    	result.add(new Object [] {ResourceRefType.class,"documentID","URI"});
-    	result.add(new Object [] {ResourceRefType.class,"filePath","URI"});
-    	result.add(new Object [] {ResourceRefType.class,"fromPart","Part"});
-    	result.add(new Object [] {ResourceRefType.class,"instanceID","URI"});
-    	result.add(new Object [] {ResourceRefType.class,"lastModifyDate","Date"});
-    	result.add(new Object [] {ResourceRefType.class,"manager","AgentName"});
-    	result.add(new Object [] {ResourceRefType.class,"managerVariant","Text"});
-    	result.add(new Object [] {ResourceRefType.class,"manageTo","URI"});
-    	result.add(new Object [] {ResourceRefType.class,"manageUI","URI"});
-    	result.add(new Object [] {ResourceRefType.class,"maskMarkers","Choice"});
-    	result.add(new Object [] {ResourceRefType.class,"partMapping","Text"});
-    	result.add(new Object [] {ResourceRefType.class,"renditionClass","RenditionClass"});
-    	result.add(new Object [] {ResourceRefType.class,"renditionParams","Text"});
-    	result.add(new Object [] {ResourceRefType.class,"toPart","Part"});
-    	result.add(new Object [] {ResourceRefType.class,"versionID","Text"});
+    	result.add(new Object [] {ResourceRefType.class,"documentID",Types.URI});
+    	result.add(new Object [] {ResourceRefType.class,"filePath",Types.URI});
+    	result.add(new Object [] {ResourceRefType.class,"fromPart",Types.Part});
+    	result.add(new Object [] {ResourceRefType.class,"instanceID",Types.URI});
+    	result.add(new Object [] {ResourceRefType.class,"lastModifyDate",Types.Date});
+    	result.add(new Object [] {ResourceRefType.class,"manager",Types.AgentName});
+    	result.add(new Object [] {ResourceRefType.class,"managerVariant",Types.Text});
+    	result.add(new Object [] {ResourceRefType.class,"manageTo",Types.URI});
+    	result.add(new Object [] {ResourceRefType.class,"manageUI",Types.URI});
+    	result.add(new Object [] {ResourceRefType.class,"maskMarkers",Types.Choice});
+    	result.add(new Object [] {ResourceRefType.class,"partMapping",Types.Text});
+    	result.add(new Object [] {ResourceRefType.class,"renditionClass",Types.RenditionClass});
+    	result.add(new Object [] {ResourceRefType.class,"renditionParams",Types.Text});
+    	result.add(new Object [] {ResourceRefType.class,"toPart",Types.Part});
+    	result.add(new Object [] {ResourceRefType.class,"versionID",Types.Text});
     	
     	return result;
     	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestThumbnailType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestThumbnailType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestThumbnailType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestThumbnailType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestThumbnailType extends A
 		structured = new ThumbnailType(xmp);
 	}
 	
-	public TestThumbnailType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestThumbnailType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -54,10 +54,10 @@ public class TestThumbnailType extends A
     public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {ThumbnailType.class,"format","Choice"});
-    	result.add(new Object [] {ThumbnailType.class,"height","Integer"});
-    	result.add(new Object [] {ThumbnailType.class,"width","Integer"});
-    	result.add(new Object [] {ThumbnailType.class,"image","Text"});
+    	result.add(new Object [] {ThumbnailType.class,"format",Types.Choice});
+    	result.add(new Object [] {ThumbnailType.class,"height",Types.Integer});
+    	result.add(new Object [] {ThumbnailType.class,"width",Types.Integer});
+    	result.add(new Object [] {ThumbnailType.class,"image",Types.Text});
     	
     	return result;
     	

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestVersionType.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestVersionType.java?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestVersionType.java (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestVersionType.java Fri Oct 26 17:48:41 2012
@@ -40,7 +40,7 @@ public class TestVersionType extends Abs
 		structured = new VersionType(xmp);
 	}
 	
-	public TestVersionType (Class<? extends AbstractStructuredType> clz, String field,String type) {
+	public TestVersionType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
 		super(clz, field, type);
 	}
 
@@ -54,10 +54,10 @@ public class TestVersionType extends Abs
     public static Collection<Object[]> initializeParameters() throws Exception {
     	Collection<Object[]> result = new ArrayList<Object[]>();
 
-    	result.add(new Object [] {VersionType.class,"version","Text"});
-    	result.add(new Object [] {VersionType.class,"comments","Text"});
-    	result.add(new Object [] {VersionType.class,"modifyDate","Date"});
-    	result.add(new Object [] {VersionType.class,"modifier","ProperName"});
+//    	result.add(new Object [] {VersionType.class,"version",Types.Text});
+//    	result.add(new Object [] {VersionType.class,"comments",Types.Text});
+//    	result.add(new Object [] {VersionType.class,"modifyDate",Types.Date});
+    	result.add(new Object [] {VersionType.class,"modifier",Types.ProperName});
     	
     	return result;
     	

Added: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml?rev=1402595&view=auto
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml (added)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/emptyli.xml Fri Oct 26 17:48:41 2012
@@ -0,0 +1,150 @@
+<!-- ! Licensed to the Apache Software Foundation (ASF) under one or more 
+	! contributor license agreements. See the NOTICE file distributed with ! 
+	this work for additional information regarding copyright ownership. ! The 
+	ASF licenses this file to You under the Apache License, Version 2.0 ! (the 
+	"License"); you may not use this file except in compliance with ! the License. 
+	You may obtain a copy of the License at ! ! http://www.apache.org/licenses/LICENSE-2.0 
+	! ! Unless required by applicable law or agreed to in writing, software ! 
+	distributed under the License is distributed on an "AS IS" BASIS, ! WITHOUT 
+	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! See the 
+	License for the specific language governing permissions and ! limitations 
+	under the License. ! -->
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
+<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26        ">
+   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+      <rdf:Description rdf:about=""
+            xmlns:dc="http://purl.org/dc/elements/1.1/">
+         <dc:format>application/pdf</dc:format>
+ <!--
+         <dc:description>
+            <rdf:Alt>
+               <rdf:li xml:lang="x-default"/>
+            </rdf:Alt>
+         </dc:description>
+-->
+         <dc:title>
+            <rdf:Alt>
+               <rdf:li xml:lang="x-default">title value</rdf:li>
+            </rdf:Alt>
+         </dc:title>
+         <dc:creator>
+            <rdf:Seq>
+               <rdf:li/>
+            </rdf:Seq>
+         </dc:creator>
+      </rdf:Description>
+      <!--
+      <rdf:Description rdf:about=""
+            xmlns:xmp="http://ns.adobe.com/xap/1.0/">
+         <xmp:CreateDate>2009-04-26T16:56:29-06:00</xmp:CreateDate>
+         <xmp:CreatorTool>LaTeX with hyperref package</xmp:CreatorTool>
+         <xmp:ModifyDate>2012-07-26T07:23:35-04:00</xmp:ModifyDate>
+         <xmp:MetadataDate>2012-07-26T07:23:35-04:00</xmp:MetadataDate>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
+         <pdf:Keywords/>
+         <pdf:Producer>pdfTeX-1.40.3</pdf:Producer>
+         <pdf:Trapped>False</pdf:Trapped>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
+            xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#">
+         <xmpMM:DocumentID>uuid:bbc5e922-8a33-4f23-803a-96bc4f7d99fb</xmpMM:DocumentID>
+         <xmpMM:InstanceID>uuid:cd6bd7b5-aaa8-4bb7-a216-6a8900317f2c</xmpMM:InstanceID>
+         <xmpMM:RenditionClass>default</xmpMM:RenditionClass>
+         <xmpMM:VersionID>1</xmpMM:VersionID>
+         <xmpMM:History>
+            <rdf:Seq>
+               <rdf:li rdf:parseType="Resource">
+                  <stEvt:action>converted</stEvt:action>
+                  <stEvt:instanceID>uuid:a607d073-c0de-4d36-8377-d209b5a98592</stEvt:instanceID>
+                  <stEvt:parameters>converted to PDF/A-1b</stEvt:parameters>
+                  <stEvt:softwareAgent>Preflight</stEvt:softwareAgent>
+                  <stEvt:when>2012-07-26T07:23:35-04:00</stEvt:when>
+               </rdf:li>
+            </rdf:Seq>
+         </xmpMM:History>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
+         <pdfaid:part>1</pdfaid:part>
+         <pdfaid:conformance>B</pdfaid:conformance>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
+            xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
+            xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">
+         <pdfaExtension:schemas>
+            <rdf:Bag>
+               <rdf:li rdf:parseType="Resource">
+                  <pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>
+                  <pdfaSchema:prefix>pdf</pdfaSchema:prefix>
+                  <pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>
+                  <pdfaSchema:property>
+                     <rdf:Seq>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>A name object indicating whether the document has been modified to include trapping information</pdfaProperty:description>
+                           <pdfaProperty:name>Trapped</pdfaProperty:name>
+                           <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+                        </rdf:li>
+                     </rdf:Seq>
+                  </pdfaSchema:property>
+               </rdf:li>
+               <rdf:li rdf:parseType="Resource">
+                  <pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>
+                  <pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>
+                  <pdfaSchema:schema>XMP Media Management Schema</pdfaSchema:schema>
+                  <pdfaSchema:property>
+                     <rdf:Seq>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>UUID based identifier for specific incarnation of a document</pdfaProperty:description>
+                           <pdfaProperty:name>InstanceID</pdfaProperty:name>
+                           <pdfaProperty:valueType>URI</pdfaProperty:valueType>
+                        </rdf:li>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>The common identifier for all versions and renditions of a document.</pdfaProperty:description>
+                           <pdfaProperty:name>OriginalDocumentID</pdfaProperty:name>
+                           <pdfaProperty:valueType>URI</pdfaProperty:valueType>
+                        </rdf:li>
+                     </rdf:Seq>
+                  </pdfaSchema:property>
+               </rdf:li>
+               <rdf:li rdf:parseType="Resource">
+                  <pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>
+                  <pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>
+                  <pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>
+                  <pdfaSchema:property>
+                     <rdf:Seq>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>Part of PDF/A standard</pdfaProperty:description>
+                           <pdfaProperty:name>part</pdfaProperty:name>
+                           <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
+                        </rdf:li>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>Amendment of PDF/A standard</pdfaProperty:description>
+                           <pdfaProperty:name>amd</pdfaProperty:name>
+                           <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+                        </rdf:li>
+                        <rdf:li rdf:parseType="Resource">
+                           <pdfaProperty:category>internal</pdfaProperty:category>
+                           <pdfaProperty:description>Conformance level of PDF/A standard</pdfaProperty:description>
+                           <pdfaProperty:name>conformance</pdfaProperty:name>
+                           <pdfaProperty:valueType>Text</pdfaProperty:valueType>
+                        </rdf:li>
+                     </rdf:Seq>
+                  </pdfaSchema:property>
+               </rdf:li>
+            </rdf:Bag>
+         </pdfaExtension:schemas>
+      </rdf:Description>
+      -->
+   </rdf:RDF>
+</x:xmpmeta>
+<?xpacket end='r'?>
+

Modified: pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/ghost2.xmp
URL: http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/ghost2.xmp?rev=1402595&r1=1402594&r2=1402595&view=diff
==============================================================================
--- pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/ghost2.xmp (original)
+++ pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/resources/validxmp/ghost2.xmp Fri Oct 26 17:48:41 2012
@@ -14,13 +14,11 @@
                <rdf:li xml:lang="x-default"/>
             </rdf:Alt>
          </dc:title>
-         <!--
          <dc:creator>
             <rdf:Seq>
                <rdf:li/>
             </rdf:Seq>
          </dc:creator>
-         -->
       </rdf:Description>
       <rdf:Description rdf:about=""
             xmlns:xmp="http://ns.adobe.com/xap/1.0/">