Author: gbailleul
Date: Wed Aug 29 05:54:29 2012
New Revision: 1378447

URL: http://svn.apache.org/viewvc?rev=1378447&view=rev
Log:
PDFBOX-1343: Removed useless field in Attribute class, do not instanciate 
Attribute without namespace

Removed:
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManager.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/parser/XMLPropertiesDescriptionManagerTest.java
Modified:
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/JobType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAFieldType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAPropertyType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFASchemaType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFATypeType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceEventType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/VersionType.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/BirthCertificateSchemaWithXMLDescriptions.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractSchemaTester.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
    
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/XMPMetadata.java
 Wed Aug 29 05:54:29 2012
@@ -108,7 +108,7 @@ public class XMPMetadata {
             String xpacketBytes, String xpacketEncoding) {
 //     this(tm);
         this.schemas = new SchemasContainer();
-        this.typeMapping = new TypeMapping();
+        this.typeMapping = new TypeMapping(this);
         this.nsMapping = new NSMapping(this);
         this.schemaMapping = new SchemaMapping();
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/StructuredPropertyParser.java
 Wed Aug 29 05:54:29 2012
@@ -63,7 +63,7 @@ public class StructuredPropertyParser {
 
        private AbstractStructuredType instanciateProperty (XMPMetadata 
metadata) throws XmpParsingException {
                try {
-                       return 
metadata.getTypeMapping().instanciateStructuredType(metadata, description);
+                       return 
metadata.getTypeMapping().instanciateStructuredType( description);
                } catch (BadFieldValueException e) {
                        throw new XmpParsingException ("Failed to instanciate 
property",e);
                }
@@ -190,14 +190,14 @@ public class StructuredPropertyParser {
 
                                        String ptype = 
td.getProperties().getPropertyType(eltName.getLocalPart());
                                        if 
(metadata.getTypeMapping().isStructuredType(ptype)) {
-                                               
TypeDescription<AbstractStructuredType> tclass = 
(TypeDescription<AbstractStructuredType>)metadata.getTypeMapping().getTypeDescription(ptype);
+                                               
TypeDescription<AbstractStructuredType> tclass = 
metadata.getTypeMapping().getStructuredDescription(ptype);
                                                StructuredPropertyParser sp = 
new StructuredPropertyParser(builder, tclass);
                                                sp.parseSimple(metadata, 
reader.getName(), property.getContainer(),isSubSkipDescription,subExpected);// 
TODO
                                        } else if 
(metadata.getTypeMapping().getArrayType(ptype)!=null) {
                                                int pos = ptype.indexOf(' ');
                                                String arrayType = 
metadata.getTypeMapping().getArrayType(ptype);
                                                String typeInArray = 
ptype.substring(pos+1);
-                                               
TypeDescription<AbstractStructuredType> tclass = 
(TypeDescription<AbstractStructuredType>)metadata.getTypeMapping().getTypeDescription(typeInArray);
+                                               
TypeDescription<AbstractStructuredType> tclass = 
metadata.getTypeMapping().getStructuredDescription(typeInArray);
                                                ArrayProperty cp = new 
ArrayProperty(metadata,null,
                                                                
eltName.getPrefix(), eltName.getLocalPart(),
                                                                arrayType);
@@ -247,7 +247,7 @@ public class StructuredPropertyParser {
                        String propertyName,
                        String valueAsString) 
                                        throws XmpParsingException {
-               TypeDescription<AbstractSimpleProperty> description = 
(TypeDescription<AbstractSimpleProperty>)metadata.getTypeMapping().getTypeDescription(type);
+               TypeDescription<AbstractSimpleProperty> description = 
metadata.getTypeMapping().getSimpleDescription(type);
                Object value = null;
                switch (description.getBasic()) {
                case Boolean : 
@@ -278,7 +278,7 @@ public class StructuredPropertyParser {
                        value = valueAsString;
                }
 
-               return 
metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, 
propertyName, value, type);
+               return 
metadata.getTypeMapping().instanciateSimpleProperty(null, prefix, propertyName, 
value, type);
        }
 
 }

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XMPDocumentBuilder.java
 Wed Aug 29 05:54:29 2012
@@ -32,6 +32,7 @@ import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
 
+import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -256,7 +257,7 @@ public class XMPDocumentBuilder {
                                                                                
                }
                                                                                
                // create the type
 //                                                                             
                TypeDescription vtd = 
meta.getTypeMapping().getTypeDescription(fValueType);
-                                                                               
                TypeDescription vtd = 
meta.getTypeMapping().getTypeDescription(fValueType);
+                                                                               
                TypeDescription<?> vtd = 
meta.getTypeMapping().getTypeDescription(fValueType);
                                                                                
                if (vtd!=null) {
                                                                                
                        // a type is found
                                                                                
                        String ftype = vtd.getType();
@@ -269,7 +270,7 @@ public class XMPDocumentBuilder {
                                                                                
}
                                                                        }
                                                                        // add 
the structured type to list
-                                                                       
TypeDescription td = new TypeDescription(ttype, null, 
DefinedStructuredType.class);
+                                                                       
TypeDescription<AbstractStructuredType> td = new 
TypeDescription<AbstractStructuredType>(ttype, null, 
DefinedStructuredType.class);
                                                                        
meta.getTypeMapping().addToStructuredMaps(td,tns);
                                                                }
                                                        }       
@@ -289,7 +290,7 @@ public class XMPDocumentBuilder {
                                                                }
                                                                // check ptype 
existance
 //                                                             TypeDescription 
td = meta.getTypeMapping().getTypeDescription(ptype);
-                                                               TypeDescription 
td = meta.getTypeMapping().getTypeDescription(ptype);
+                                                               
TypeDescription<?> td = meta.getTypeMapping().getTypeDescription(ptype);
                                                                if (td==null) {
                                                                        // type 
not defined
                                                                        throw 
new XmpUnknownValueTypeException("Type not defined : "+ptype);
@@ -566,7 +567,6 @@ public class XMPDocumentBuilder {
                        }
 
                        Attribute attr = new Attribute(null, reader.get()
-                                       .getAttributePrefix(i), reader.get()
                                        .getAttributeLocalName(i), reader.get()
                                        .getAttributeValue(i));
 
@@ -579,7 +579,7 @@ public class XMPDocumentBuilder {
                }
                if (!rdfAboutFound) {
                        // create rdf:about if not found
-                       Attribute attr = new Attribute(null,"rdf","about","");
+                       Attribute attr = new 
Attribute(XmpConstants.RDF_NAMESPACE,"about","");
                        schema.setAttribute(attr);
                }
        }
@@ -595,11 +595,11 @@ public class XMPDocumentBuilder {
        private boolean addAttributeAsProperty(XMPMetadata metadata, XMPSchema 
schema, Attribute attr) {
                boolean added = false;
                String schemaNamespace = schema.getNamespace();
-               String prefix = attr.getPrefix() != null ? attr.getPrefix() : 
schema.getPrefix();
-               String type = 
metadata.getNsMapping().getSpecifiedPropertyType(schemaNamespace, new 
QName(schemaNamespace, attr.getLocalName(), prefix));
+               String prefix = /*attr.getPrefix() != null ? attr.getPrefix() 
:*/ schema.getPrefix();
+               String type = 
metadata.getNsMapping().getSpecifiedPropertyType(schemaNamespace, new 
QName(schemaNamespace, attr.getLocalName()));
 
                if (type != null) {
-                       AbstractSimpleProperty prop = 
metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, prefix, 
attr.getLocalName(), attr.getValue(), type);
+                       AbstractSimpleProperty prop = 
metadata.getTypeMapping().instanciateSimpleProperty(null, prefix, 
attr.getLocalName(), attr.getValue(), type);
                        schema.addProperty(prop);
                        added = true;
                }
@@ -665,8 +665,8 @@ public class XMPDocumentBuilder {
                }
 
                for (int i = 1; i < cptNS; i++) {
-                       schema.setAttribute(new 
Attribute(XMPSchema.NS_NAMESPACE,
-                                       "xmlns", 
reader.get().getNamespacePrefix(i), reader.get().getNamespaceURI(i)));
+                       schema.setAttribute(new 
Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+                                       reader.get().getNamespacePrefix(i), 
reader.get().getNamespaceURI(i)));
                }
                treatDescriptionAttributes(metadata, schema);
                while (reader.get().nextTag() == XMLStreamReader.START_ELEMENT) 
{
@@ -735,8 +735,8 @@ public class XMPDocumentBuilder {
                ArrayList<Attribute> list = new ArrayList<Attribute>();
                while (it.hasNext()) {
                        tmp = it.next();
-                       if (tmp.getPrefix() != null) {
-                               if (tmp.getPrefix().equals("xmlns")) {
+                       if (tmp.getNamespace() != null) {
+                               if 
(tmp.getNamespace().equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
                                        list.add(tmp);
                                }
                        }
@@ -768,7 +768,7 @@ public class XMPDocumentBuilder {
        }
 
        private void parseSimpleProperty(XMPMetadata metadata,  QName 
propertyName, 
-                       TypeDescription description, ComplexPropertyContainer 
container)        
+                       TypeDescription<AbstractSimpleProperty> description, 
ComplexPropertyContainer container)        
                                        throws XmpUnknownPropertyTypeException, 
XmpPropertyFormatException,     XMLStreamException {
                try {
                        AbstractSimpleProperty prop = null;
@@ -776,11 +776,10 @@ public class XMPDocumentBuilder {
                        int cpt = reader.get().getAttributeCount();
                        for (int i = 0; i < cpt; i++) {
                                attributes.add(new Attribute(null, reader.get()
-                                               .getAttributePrefix(i), 
reader.get()
                                                .getAttributeLocalName(i), 
reader.get()
                                                .getAttributeValue(i)));
                        }
-                       prop = 
metadata.getTypeMapping().instanciateSimpleProperty(metadata, null, 
propertyName.getPrefix(), 
+                       prop = 
metadata.getTypeMapping().instanciateSimpleProperty( null, 
propertyName.getPrefix(), 
                                        propertyName.getLocalPart(), 
reader.get().getElementText(),description.getType());
                        if (prop != null) {
                                container.addProperty(prop);
@@ -831,7 +830,7 @@ public class XMPDocumentBuilder {
 
 
        private void parseSimplePropertyArray(XMPMetadata metadata, QName name, 
String ctype,
-                       TypeDescription td, ComplexPropertyContainer container)
+                       TypeDescription<AbstractSimpleProperty> td, 
ComplexPropertyContainer container)
                                        throws XmpUnexpectedTypeException, 
XmpParsingException,
                                        XMLStreamException, 
XmpUnknownPropertyTypeException,
                                        XmpPropertyFormatException {
@@ -904,12 +903,12 @@ public class XMPDocumentBuilder {
                String type = getPropertyDeclarationInNamespaces(schema, 
propertyName);
                // found type, manage it
                if (type.equals("Lang Alt")) {
-                       parseSimplePropertyArray(metadata, propertyName, 
ArrayProperty.ALTERNATIVE_ARRAY, typeMapping.getTypeDescription("Text"), 
schema.getContainer());
+                       parseSimplePropertyArray(metadata, propertyName, 
ArrayProperty.ALTERNATIVE_ARRAY, typeMapping.getSimpleDescription("Text"), 
schema.getContainer());
                } else if (typeMapping.isSimpleType(type)) {
-                       TypeDescription<?> tclass = 
typeMapping.getTypeDescription(type);
+                       TypeDescription<AbstractSimpleProperty> tclass = 
typeMapping.getSimpleDescription(type);
                        parseSimpleProperty(metadata, propertyName, tclass, 
schema.getContainer());
                } else if (typeMapping.isStructuredType(type)) {
-                       TypeDescription<AbstractStructuredType> tclass = 
(TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(type);
+                       TypeDescription<AbstractStructuredType> tclass = 
typeMapping.getStructuredDescription(type);
                        StructuredPropertyParser parser = new 
StructuredPropertyParser(
                                        this, tclass);
                        parseStructuredProperty(metadata, parser, 
schema.getContainer());
@@ -928,12 +927,12 @@ public class XMPDocumentBuilder {
                                                metadata, 
                                                propertyName, 
                                                arrayType, 
-                                               
typeMapping.getTypeDescription(typeInArray),
+                                               
typeMapping.getSimpleDescription(typeInArray),
                                                schema.getContainer());
                        } else if (typeMapping.isStructuredType(typeInArray)) {
                                // array of structured
                                StructuredPropertyParser parser = new 
StructuredPropertyParser(
-                                               this, 
(TypeDescription<AbstractStructuredType>)typeMapping.getTypeDescription(typeInArray));
+                                               this, 
typeMapping.getStructuredDescription(typeInArray));
                                parseStructuredPropertyArray(metadata, 
propertyName, arrayType, parser, schema.getContainer());
                        } else {
                                // invalid case

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/parser/XmpSerializer.java
 Wed Aug 29 05:54:29 2012
@@ -23,6 +23,7 @@ package org.apache.padaf.xmpbox.parser;
 import java.io.OutputStream;
 import java.util.List;
 
+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -85,16 +86,10 @@ public class XmpSerializer {
 
        protected Element createSchemaElement (Document doc, XMPSchema schema) {
                // prepare schema
-               Element selem = doc.createElement("rdf:Description");
-               selem.setAttribute("rdf:about", schema.getAboutValue()); 
-               selem.setAttributeNS(XMPSchema.NS_NAMESPACE, 
"xmlns:"+schema.getPrefix(), schema.getNamespace());
+               Element selem = 
doc.createElementNS(XmpConstants.RDF_NAMESPACE,"rdf:Description");
+               selem.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
"xmlns:"+schema.getPrefix(), schema.getNamespace());
                // the other attributes
-//             List<Attribute> attributes = schema.getAllAttributes();
                fillElementWithAttributes(selem, schema.getAllAttributes());
-//             for (Attribute attribute : attributes) {
-//                     selem.setAttribute(attribute.getQualifiedName(), 
attribute.getValue());
-//             }
-//             selem.setAttribute("rdf:about", schema.getClass().getName()); 
// TODO remove already done 6 lines before
                // the content
                List<AbstractField> fields = schema.getAllProperties();
                xxxxxxx(doc, selem, fields);
@@ -142,7 +137,17 @@ public class XmpSerializer {
        
        protected void fillElementWithAttributes (Element target, 
List<Attribute> attributes) {
                for (Attribute attribute : attributes) {
-                       target.setAttribute(attribute.getQualifiedName(), 
attribute.getValue());
+                       if 
(target.getNamespaceURI().equals(attribute.getNamespace())) {
+                               target.setAttribute(attribute.getLocalName(), 
attribute.getValue());
+                       } else if 
(XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attribute.getNamespace())) {
+                               
target.setAttribute(XMLConstants.XMLNS_ATTRIBUTE+":"+attribute.getLocalName(), 
attribute.getValue());
+                       } else if 
(XmpConstants.RDF_NAMESPACE.equals(attribute.getNamespace())) {
+                               
target.setAttribute("rdf"+":"+attribute.getLocalName(), attribute.getValue());
+//                     } else if (attribute.getLocalName().equals("about")) {
+//                             target.setAttribute("rdf:about", 
attribute.getValue());
+                       } else {
+                               
target.setAttribute(attribute.getQualifiedName(), attribute.getValue());
+                       }
                }
        }
        
@@ -157,7 +162,7 @@ public class XmpSerializer {
                }
                // meta element
                Element xmpmeta = doc.createElementNS("adobe:ns:meta/", 
"x:xmpmeta");
-               xmpmeta.setAttributeNS(XMPSchema.NS_NAMESPACE, 
"xmlns:x","adobe:ns:meta/");
+               xmpmeta.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
"xmlns:x","adobe:ns:meta/");
                doc.appendChild(xmpmeta);
                // ending xpacket
                if (withXpacket) {

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPBasicJobTicketSchema.java
 Wed Aug 29 05:54:29 2012
@@ -24,6 +24,8 @@ package org.apache.padaf.xmpbox.schema;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
@@ -50,7 +52,7 @@ public class XMPBasicJobTicketSchema ext
 
     public XMPBasicJobTicketSchema(XMPMetadata metadata, String ownPrefix) {
         super(metadata, ownPrefix, JOB_TICKET_URI);
-        getContainer().setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
+        getContainer().setAttribute(new 
Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
                 JobType.PREFERED_PREFIX, JobType.ELEMENT_NS));
 
     }

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/schema/XMPSchema.java
 Wed Aug 29 05:54:29 2012
@@ -27,7 +27,10 @@ import java.util.Calendar;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.XmpConstants;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.AbstractSimpleProperty;
 import org.apache.padaf.xmpbox.type.AbstractStructuredType;
@@ -50,12 +53,8 @@ import org.apache.padaf.xmpbox.type.Type
  * 
  */
 public class XMPSchema extends AbstractStructuredType {
-       /**
-        * The standard xmlns namespace.
-        */
-       public static final String NS_NAMESPACE = 
"http://www.w3.org/2000/xmlns/";;
 
-       public static final String RDFABOUT = "rdf:about";
+       public static final String RDFABOUT = "about";
 
        /**
         * Create a new blank schema that can be populated.
@@ -70,8 +69,7 @@ public class XMPSchema extends AbstractS
         */
        public XMPSchema(XMPMetadata metadata, String namespaceName, String 
namespaceURI) {
                super(metadata, namespaceURI, namespaceName);
-               getContainer().setAttribute(new Attribute(NS_NAMESPACE, "xmlns",
-                               namespaceName, namespaceURI));
+               getContainer().setAttribute(new 
Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, namespaceName, namespaceURI));
 
        }
 
@@ -126,13 +124,15 @@ public class XMPSchema extends AbstractS
         *             Bad Attribute name (not corresponding to about attribute)
         */
        public void setAbout(Attribute about) throws BadFieldValueException {
-               if (about.getQualifiedName().equals(RDFABOUT)
-                               || about.getQualifiedName().equals("about")) {
-                       getContainer().setAttribute(about);
-               } else {
-                       throw new BadFieldValueException(
-                                       "Attribute 'about' must be named 
'rdf:about' or 'about'");
+               if (XmpConstants.RDF_NAMESPACE.equals(about.getNamespace())) {
+                       if (RDFABOUT.equals(about.getLocalName())) {
+                               getContainer().setAttribute(about);
+                               return;
+                       }
                }
+               // else 
+               throw new BadFieldValueException(
+                               "Attribute 'about' must be named 'rdf:about' or 
'about'");
        }
 
        /**
@@ -145,7 +145,7 @@ public class XMPSchema extends AbstractS
                if (about == null) {
                        getContainer().removeAttribute(RDFABOUT);
                } else {
-                       getContainer().setAttribute(new Attribute(null, "rdf", 
"about", about));
+                       getContainer().setAttribute(new 
Attribute(XmpConstants.RDF_NAMESPACE, "about", about));
 
                }
        }
@@ -163,8 +163,6 @@ public class XMPSchema extends AbstractS
        private void setSpecifiedSimpleTypeProperty(
                        Class<? extends AbstractSimpleProperty> type, String 
qualifiedName,
                        Object propertyValue) {
-               String[] splittedQualifiedName = qualifiedName.split(":");
-
                if (propertyValue == null) {
                        // Search in properties to erase
                        Iterator<AbstractField> it = 
getContainer().getAllProperties().iterator();
@@ -181,9 +179,7 @@ public class XMPSchema extends AbstractS
                        try {
                                TypeMapping tm = getMetadata().getTypeMapping();
                                specifiedTypeProperty = 
tm.instanciateSimpleProperty(
-                                               getMetadata(), null, 
-                                               getPrefix(), qualifiedName,
-//                                             splittedQualifiedName[0], 
splittedQualifiedName[1],
+                                               null, getPrefix(), 
qualifiedName,
                                                propertyValue, 
tm.getType(type));
                        } catch (Exception e) {
                                throw new IllegalArgumentException(
@@ -647,7 +643,7 @@ public class XMPSchema extends AbstractS
                        addProperty(newBag);
                }
        }
-       
+
        /**
         * Add an entry to a bag property.
         * 
@@ -782,7 +778,7 @@ public class XMPSchema extends AbstractS
                }
        }
 
-       
+
        /**
         * Add a new value to a bag property.
         * 
@@ -827,7 +823,7 @@ public class XMPSchema extends AbstractS
                        addProperty(newSeq);
                }
        }
-       
+
        /**
         * Get all the values in a sequence property.
         * 
@@ -944,7 +940,7 @@ public class XMPSchema extends AbstractS
                boolean xdefaultFound = false;
                // If alternatives contains x-default in first value
                if (it.hasNext()) {
-                       if 
(it.next().getAttribute("xml:lang").getValue().equals(
+                       if (it.next().getAttribute("lang").getValue().equals(
                                        "x-default")) {
                                return;
                        }
@@ -952,7 +948,7 @@ public class XMPSchema extends AbstractS
                // Find the xdefault definition
                while (it.hasNext() && !xdefaultFound) {
                        xdefault = it.next();
-                       if (xdefault.getAttribute("xml:lang").getValue()
+                       if (xdefault.getAttribute("lang").getValue()
                                        .equals("x-default")) {
                                alt.removeProperty(xdefault);
                                xdefaultFound = true;
@@ -1010,7 +1006,7 @@ public class XMPSchema extends AbstractS
                                while (itCplx.hasNext()) {
                                        tmp = itCplx.next();
                                        // 
System.err.println(tmp.getAttribute("xml:lang").getStringValue());
-                                       if 
(tmp.getAttribute("xml:lang").getValue()
+                                       if (tmp.getAttribute("lang").getValue()
                                                        .equals(language)) {
                                                // the same language has been 
found
                                                if (value == null) {
@@ -1022,7 +1018,7 @@ public class XMPSchema extends AbstractS
                                                        langValue = new 
TextType(getMetadata(), null,"rdf", "li",
                                                                        value);
 
-                                                       
langValue.setAttribute(new Attribute(null, "xml",
+                                                       
langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI,
                                                                        "lang", 
language));
                                                        
prop.getContainer().addProperty(langValue);
                                                }
@@ -1033,7 +1029,7 @@ public class XMPSchema extends AbstractS
                                // if no definition found, we add a new one
                                TextType langValue;
                                langValue = new TextType(getMetadata(),null, 
"rdf", "li", value);
-                               langValue.setAttribute(new Attribute(null, 
"xml", "lang",
+                               langValue.setAttribute(new 
Attribute(XMLConstants.XML_NS_URI, "lang",
                                                language));
                                prop.getContainer().addProperty(langValue);
                                reorganizeAltOrder(prop.getContainer());
@@ -1045,7 +1041,7 @@ public class XMPSchema extends AbstractS
                        TextType langValue;
                        langValue = new TextType(getMetadata(),null, "rdf", 
"li", value);
                        langValue
-                       .setAttribute(new Attribute(null, "xml", "lang", 
language));
+                       .setAttribute(new Attribute(XMLConstants.XML_NS_URI, 
"lang", language));
                        prop.getContainer().addProperty(langValue);
                        addProperty(prop);
                }
@@ -1074,7 +1070,7 @@ public class XMPSchema extends AbstractS
                                Attribute text;
                                while (langsDef.hasNext()) {
                                        tmp = langsDef.next();
-                                       text = tmp.getAttribute("xml:lang");
+                                       text = tmp.getAttribute("lang");
                                        if (text != null) {
                                                if 
(text.getValue().equals(language)) {
                                                        return ((TextType) 
tmp).getStringValue();
@@ -1115,7 +1111,7 @@ public class XMPSchema extends AbstractS
                                Attribute text;
                                while (langsDef.hasNext()) {
                                        tmp = langsDef.next();
-                                       text = tmp.getAttribute("xml:lang");
+                                       text = tmp.getAttribute("lang");
                                        if (text != null) {
                                                retval.add(text.getValue());
                                        } else {
@@ -1151,7 +1147,7 @@ public class XMPSchema extends AbstractS
                Attribute att;
                while (itAtt.hasNext()) {
                        att = itAtt.next();
-                       if (att.getPrefix().equals(getPrefix())) {
+                       if (att.getNamespace().equals(getNamespace())) {
                                getContainer().setAttribute(att);
                        }
                }
@@ -1277,12 +1273,11 @@ public class XMPSchema extends AbstractS
        public void setAttribute(Attribute attr) {
                getContainer().setAttribute(attr);
        }
-       
+
        protected AbstractSimpleProperty instanciateSimple (String param, 
Object value) {
                TypeMapping tm = getMetadata().getTypeMapping();
                return tm.instanciateSimpleField(
                                getClass(), 
-                               getMetadata(), 
                                null, 
                                getPrefix(), 
                                param, 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/AbstractStructuredType.java
 Wed Aug 29 05:54:29 2012
@@ -39,7 +39,7 @@ public abstract class AbstractStructured
        
        protected void addSimpleProperty (String propertyName, Object value) {
                TypeMapping tm = getMetadata().getTypeMapping();
-               AbstractSimpleProperty asp = 
tm.instanciateSimpleField(getClass(), 
getMetadata(),null,getPrefix(),propertyName, value);
+               AbstractSimpleProperty asp = 
tm.instanciateSimpleField(getClass(), null,getPrefix(),propertyName, value);
                addProperty(asp);
        }
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/Attribute.java
 Wed Aug 29 05:54:29 2012
@@ -29,7 +29,7 @@ package org.apache.padaf.xmpbox.type;
  */
 public class Attribute {
 
-       private String nsURI, prefix, localName, value;
+       private String nsURI, localName, value;
 
        /**
         * Constructor of a new Attribute
@@ -43,39 +43,13 @@ public class Attribute {
         * @param value
         *            value given to this attribute
         */
-       public Attribute(String nsURI, String prefix, String localName, String 
value) {
+       public Attribute(String nsURI, String localName, String value) {
                this.nsURI = nsURI;
-               this.prefix = prefix;
                this.localName = localName;
                this.value = value;
        }
 
        /**
-        * Get prefix defined for this attribute
-        * 
-        * @return prefix defined (could be null)
-        */
-       public String getPrefix() {
-               if (prefix != null) {
-                       if (prefix.equals("")) {
-                               return null;
-                       }
-                       return prefix;
-               }
-               return null;
-       }
-
-       /**
-        * Set prefix for this attribute
-        * 
-        * @param prefix
-        *            the prefix defined for this attribute
-        */
-       public void setPrefix(String prefix) {
-               this.prefix = prefix;
-       }
-
-       /**
         * Get the localName of this attribute
         * 
         * @return local name of this attribute
@@ -119,13 +93,8 @@ public class Attribute {
         * @return the full qualified name of this attribute
         */
        public String getQualifiedName() {
-               if (prefix == null) {
-                       return localName;
-               }
-               if (prefix.equals("")) {
-                       return localName;
-               }
-               return prefix + ":" + localName;
+               // TODO remove that method
+               return localName;
        }
 
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/JobType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/JobType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/JobType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/JobType.java
 Wed Aug 29 05:54:29 2012
@@ -21,9 +21,9 @@
 
 package org.apache.padaf.xmpbox.type;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 
 public class JobType extends AbstractStructuredType {
 
@@ -47,7 +47,7 @@ public class JobType extends AbstractStr
 
     public JobType(XMPMetadata metadata, String fieldPrefix) {
         super(metadata, ELEMENT_NS, fieldPrefix);
-               setAttribute(new Attribute(XMPSchema.NS_NAMESPACE, "xmlns", 
fieldPrefix, ELEMENT_NS));
+               setAttribute(new Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
fieldPrefix, ELEMENT_NS));
     }
 
     public void setId(String id) {

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/LayerType.java
 Wed Aug 29 05:54:29 2012
@@ -39,7 +39,7 @@ public class LayerType extends AbstractS
        
        public LayerType(XMPMetadata metadata) {
                super(metadata, ELEMENT_NS, PREFERED_PREFIX);
-               setAttribute(new Attribute(null, "rdf", "parseType", 
"Resource"));
+               setAttribute(new Attribute(XmpConstants.RDF_NAMESPACE, 
"parseType", "Resource"));
        }
        
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAFieldType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAFieldType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAFieldType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAFieldType.java
 Wed Aug 29 05:54:29 2012
@@ -22,7 +22,6 @@
 package org.apache.padaf.xmpbox.type;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
 
 public class PDFAFieldType extends AbstractStructuredType {
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAPropertyType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAPropertyType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAPropertyType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFAPropertyType.java
 Wed Aug 29 05:54:29 2012
@@ -22,7 +22,6 @@
 package org.apache.padaf.xmpbox.type;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
 
 public class PDFAPropertyType extends AbstractStructuredType {
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFASchemaType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFASchemaType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFASchemaType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFASchemaType.java
 Wed Aug 29 05:54:29 2012
@@ -22,7 +22,6 @@
 package org.apache.padaf.xmpbox.type;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
 
 public class PDFASchemaType extends AbstractStructuredType {
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFATypeType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFATypeType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFATypeType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/PDFATypeType.java
 Wed Aug 29 05:54:29 2012
@@ -22,7 +22,6 @@
 package org.apache.padaf.xmpbox.type;
 
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
 
 public class PDFATypeType extends AbstractStructuredType {
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceEventType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceEventType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceEventType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceEventType.java
 Wed Aug 29 05:54:29 2012
@@ -23,9 +23,9 @@ package org.apache.padaf.xmpbox.type;
 
 import java.util.Calendar;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 
 public class ResourceEventType extends AbstractStructuredType {
 
@@ -65,7 +65,7 @@ public class ResourceEventType extends A
         */
        public ResourceEventType(XMPMetadata metadata) {
                super(metadata, ELEMENT_NS, PREFERRED_PREFIX);
-               setAttribute(new Attribute(XMPSchema.NS_NAMESPACE, "xmlns", 
PREFERRED_PREFIX, ELEMENT_NS));
+               setAttribute(new Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
PREFERRED_PREFIX, ELEMENT_NS));
        }
        
        

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ResourceRefType.java
 Wed Aug 29 05:54:29 2012
@@ -24,9 +24,9 @@ package org.apache.padaf.xmpbox.type;
 import java.util.Calendar;
 import java.util.List;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 
 public class ResourceRefType extends AbstractStructuredType {
 
@@ -94,7 +94,7 @@ public class ResourceRefType extends Abs
         */
        public ResourceRefType(XMPMetadata metadata) {
                super(metadata, ELEMENT_NS, PREFERRED_PREFIX);
-               setAttribute(new Attribute(XMPSchema.NS_NAMESPACE, "xmlns", 
PREFERRED_PREFIX, ELEMENT_NS));
+               setAttribute(new Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
PREFERRED_PREFIX, ELEMENT_NS));
        }
        
        public String getDocumentID () {
@@ -301,7 +301,7 @@ public class ResourceRefType extends Abs
                addProperty(seq);
         }
                TypeMapping tm = getMetadata().getTypeMapping();
-        TextType tt = (TextType)tm.instanciateSimpleProperty(getMetadata(), 
null, "rdf", "li", value, "Text");
+        TextType tt = (TextType)tm.instanciateSimpleProperty(null, "rdf", 
"li", value, "Text");
         seq.addProperty(tt);
        }
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/ThumbnailType.java
 Wed Aug 29 05:54:29 2012
@@ -61,7 +61,7 @@ public class ThumbnailType extends Abstr
         */
        public ThumbnailType(XMPMetadata metadata) {
                super(metadata, ELEMENT_NS, PREFERRED_PREFIX);
-               setAttribute(new Attribute(null, "rdf", "parseType", 
"Resource"));
+               setAttribute(new Attribute(XmpConstants.RDF_NAMESPACE, 
"parseType", "Resource"));
        }
 
        /**

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/TypeMapping.java
 Wed Aug 29 05:54:29 2012
@@ -47,8 +47,11 @@ public final class TypeMapping {
        private Map<Class<? extends 
AbstractField>,TypeDescription<AbstractStructuredType>> STRUCTURED_CLASSES;
 
        private Map<String,TypeDescription<AbstractStructuredType>> 
STRUCTURED_NAMESPACES;
+       
+       private XMPMetadata metadata;
 
-       public TypeMapping() {
+       public TypeMapping(XMPMetadata metadata) {
+               this.metadata = metadata;
                initialize();
        }
 
@@ -189,23 +192,22 @@ public final class TypeMapping {
        }
 
        // TODO ces deux methodes doivent remplacer la précédente
-//     public TypeDescription<AbstractSimpleProperty> getSimpleDescription 
(String type) {
-//             if (BASIC_TYPES.containsKey(type)) {
-//                     return BASIC_TYPES.get(type);
-//             } else if (DERIVED_TYPES.containsKey(type)) {
-//                     return DERIVED_TYPES.get(type);
-//             } else {
-//                     return null;
-//             }
-//     }
-//
-//     
-//     public TypeDescription<AbstractStructuredType> getStructuredDescription 
(String type) {
-//             return STRUCTURED_TYPES.get(type);
-//     }
+       public TypeDescription<AbstractSimpleProperty> getSimpleDescription 
(String type) {
+               if (BASIC_TYPES.containsKey(type)) {
+                       return BASIC_TYPES.get(type);
+               } else if (DERIVED_TYPES.containsKey(type)) {
+                       return DERIVED_TYPES.get(type);
+               } else {
+                       return null;
+               }
+       }
+
+       public TypeDescription<AbstractStructuredType> getStructuredDescription 
(String type) {
+               return STRUCTURED_TYPES.get(type);
+       }
 
        
-       public AbstractStructuredType instanciateStructuredType (XMPMetadata 
metadata, TypeDescription<AbstractStructuredType> td) throws 
BadFieldValueException {
+       public AbstractStructuredType instanciateStructuredType 
(TypeDescription<AbstractStructuredType> td) throws BadFieldValueException {
                try {
                        Class<? extends AbstractStructuredType> 
propertyTypeClass = td.getTypeClass();
                        Constructor<? extends AbstractStructuredType> construct 
= propertyTypeClass.getConstructor(new Class<?> [] {XMPMetadata.class});
@@ -225,10 +227,10 @@ public final class TypeMapping {
                } 
        }
 
-       public AbstractSimpleProperty instanciateSimpleProperty (XMPMetadata 
xmp,String nsuri, String prefix, String name, Object value, String type) {
+       public AbstractSimpleProperty instanciateSimpleProperty (String nsuri, 
String prefix, String name, Object value, String type) {
                // constructor parameters
                Object [] params = new Object [] {
-                               xmp,    
+                               metadata,       
                                nsuri,
                                prefix,
                                name,
@@ -236,7 +238,7 @@ public final class TypeMapping {
                };
                // type 
                try {
-                       TypeDescription<AbstractSimpleProperty> description = 
(TypeDescription<AbstractSimpleProperty>)getTypeDescription(type);
+                       TypeDescription<AbstractSimpleProperty> description = 
getSimpleDescription(type);
                        Class<? extends AbstractSimpleProperty> clz = (Class<? 
extends AbstractSimpleProperty>)description.getTypeClass();
                        Constructor<? extends AbstractSimpleProperty> cons = 
clz.getConstructor(simplePropertyConstParams);
                        return cons.newInstance(params);
@@ -257,10 +259,15 @@ public final class TypeMapping {
                }
        }
 
-       public  AbstractSimpleProperty instanciateSimpleField (Class<?> clz, 
XMPMetadata xmp, String nsuri, String prefix,String propertyName, Object value) 
{
+       public  AbstractSimpleProperty instanciateSimpleField (Class<?> clz, 
String nsuri, String prefix,String propertyName, Object value) {
                PropMapping pm = ReflectHelper.initializePropMapping(null, clz);
                String simpleType = pm.getPropertyType(propertyName);
-               return instanciateSimpleProperty(xmp, nsuri, prefix, 
propertyName, value, simpleType);
+               if (isArrayOfSimpleType(simpleType)) {
+                       simpleType = simpleType.substring(simpleType.indexOf(" 
")+1);
+                       return instanciateSimpleProperty(nsuri, prefix, 
propertyName, value, simpleType);
+               } else {
+                       return instanciateSimpleProperty(nsuri, prefix, 
propertyName, value, simpleType);
+               }
        }
 
        public TypeDescription<AbstractStructuredType> getStructuredTypeName 
(String namespace) {

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/VersionType.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/VersionType.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/VersionType.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/main/java/org/apache/padaf/xmpbox/type/VersionType.java
 Wed Aug 29 05:54:29 2012
@@ -23,9 +23,9 @@ package org.apache.padaf.xmpbox.type;
 
 import java.util.Calendar;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.XMPMetadata;
-import org.apache.padaf.xmpbox.XmpConstants;
-import org.apache.padaf.xmpbox.schema.XMPSchema;
 
 public class VersionType extends AbstractStructuredType {
 
@@ -62,7 +62,7 @@ public class VersionType extends Abstrac
         */
        public VersionType(XMPMetadata metadata) {
                super(metadata, ELEMENT_NS, PREFERRED_PREFIX);
-               setAttribute(new Attribute(XMPSchema.NS_NAMESPACE, "xmlns", 
PREFERRED_PREFIX, ELEMENT_NS));
+               setAttribute(new Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, 
PREFERRED_PREFIX, ELEMENT_NS));
        }
        
        

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=1378447&r1=1378446&r2=1378447&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
 Wed Aug 29 05:54:29 2012
@@ -23,6 +23,8 @@ package org.apache.padaf.xmpbox;
 
 import java.util.Calendar;
 
+import javax.xml.XMLConstants;
+
 import org.apache.padaf.xmpbox.schema.PropertyExtensionDefinition;
 import org.apache.padaf.xmpbox.schema.SchemaExtensionDefinition;
 import org.apache.padaf.xmpbox.schema.XMPSchema;
@@ -63,7 +65,7 @@ public class BirthCertificateSchemaWithX
 
        public BirthCertificateSchemaWithXMLDescriptions(XMPMetadata metadata) {
                super(metadata, PREFERED_PREFIX, NAMESPACE);
-               this.setAttribute(new Attribute(null, "xmlns", "madn",
+               this.setAttribute(new 
Attribute(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "madn",
                                "http://test.withfield.com/vt/";));
                this.setAboutAsSimple("");
        }

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=1378447&r1=1378446&r2=1378447&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
 Wed Aug 29 05:54:29 2012
@@ -146,10 +146,10 @@ public abstract class AbstractSchemaTest
     public void testPropertySetterSimple () throws Exception {
                if (cardinality!=Cardinality.Simple) return;
        String setter = 
TypeTestingHelper.calculateSimpleSetter(fieldName)+"Property";
-       TypeDescription td = typeMapping.getTypeDescription(type);
+       TypeDescription<?> td = typeMapping.getTypeDescription(type);
        Object value = TypeTestingHelper.getJavaValue(td);
        AbstractSimpleProperty asp = typeMapping.instanciateSimpleProperty(
-                       xmp, getSchema().getNamespace(), 
+                       getSchema().getNamespace(), 
                        getSchema().getPrefix(), fieldName, value, type);
        Method set = getSchemaClass().getMethod(setter, new Class<?>[] 
{td.getTypeClass()} );
        set.invoke(getSchema(), new Object [] {asp});

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=1378447&r1=1378446&r2=1378447&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
 Wed Aug 29 05:54:29 2012
@@ -29,6 +29,7 @@ import junit.framework.Assert;
 
 import org.apache.padaf.xmpbox.DateConverter;
 import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.XmpConstants;
 import org.apache.padaf.xmpbox.type.AbstractField;
 import org.apache.padaf.xmpbox.type.ArrayProperty;
 import org.apache.padaf.xmpbox.type.Attribute;
@@ -157,7 +158,7 @@ public class XMPSchemaTest {
 
        @Test(expected = BadFieldValueException.class)
        public void testBadRdfAbout() throws Exception {
-               schem.setAbout(new Attribute(null, "bill", "about", ""));
+               schem.setAbout(new Attribute(null, "about", ""));
        }
 
        @Test
@@ -263,13 +264,13 @@ public class XMPSchemaTest {
 
                // In real cases, rdf ns will be declared before !
                schem.setAttribute(new 
Attribute("http://www.w3.org/2000/xmlns/";,
-                               "xmlns", "rdf", 
"http://www.w3.org/1999/02/22-rdf-syntax-ns#";));
+                               "rdf", 
"http://www.w3.org/1999/02/22-rdf-syntax-ns#";));
 
                String aboutVal = "aboutTest";
                schem.setAboutAsSimple(aboutVal);
                Assert.assertEquals(aboutVal, schem.getAboutValue());
 
-               Attribute about = new Attribute(null, "rdf", "about", "YEP");
+               Attribute about = new Attribute(XmpConstants.RDF_NAMESPACE, 
"about", "YEP");
                schem.setAbout(about);
                Assert.assertEquals(about, schem.getAboutAttribute());
 
@@ -358,7 +359,6 @@ public class XMPSchemaTest {
        @Test
        public void testAltProperties() throws Exception {
                String altProp = "AltProp";
-               String qaltProp = "nsSchem:"+altProp;
 
                String defaultLang = "x-default";
                String defaultVal = "Default Language";
@@ -475,7 +475,7 @@ public class XMPSchemaTest {
                boolean boolVal = true;
                BooleanType bool = new BooleanType(parent, null, 
schem.getPrefix(),
                                boolname, boolVal);
-               Attribute att = new Attribute(null, "rdf", "test", "vgh");
+               Attribute att = new Attribute(XmpConstants.RDF_NAMESPACE, 
"test", "vgh");
                schem.setAttribute(att);
                schem.setBooleanProperty(bool);
 

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
 Wed Aug 29 05:54:29 2012
@@ -34,12 +34,11 @@ public class AttributeTest {
                String localName = "localName";
                String value = "value";
 
-               Attribute att = new Attribute(nsUri, prefix, localName, value);
+               Attribute att = new Attribute(nsUri, localName, value);
 
                Assert.assertEquals(nsUri, att.getNamespace());
-               Assert.assertEquals(prefix, att.getPrefix());
                Assert.assertEquals(localName, att.getLocalName());
-               Assert.assertEquals(prefix + ":" + localName, 
att.getQualifiedName());
+               Assert.assertEquals(localName, att.getQualifiedName());
                Assert.assertEquals(value, att.getValue());
 
                String nsUri2 = "nsUri2";
@@ -48,14 +47,12 @@ public class AttributeTest {
                String value2 = "value2";
 
                att.setNsURI(nsUri2);
-               att.setPrefix(prefix2);
                att.setLocalName(localName2);
                att.setValue(value2);
 
                Assert.assertEquals(nsUri2, att.getNamespace());
-               Assert.assertEquals(prefix2, att.getPrefix());
                Assert.assertEquals(localName2, att.getLocalName());
-               Assert.assertEquals(prefix2 + ":" + localName2, 
att.getQualifiedName());
+               Assert.assertEquals(localName2, att.getQualifiedName());
                Assert.assertEquals(value2, att.getValue());
 
        }
@@ -66,16 +63,14 @@ public class AttributeTest {
                String localName = "localName";
                String value = "value";
 
-               Attribute att = new Attribute(nsUri, null, localName, value);
+               Attribute att = new Attribute(nsUri, localName, value);
 
                Assert.assertEquals(nsUri, att.getNamespace());
-               Assert.assertNull(att.getPrefix());
                Assert.assertEquals(localName, att.getLocalName());
                Assert.assertEquals(localName, att.getQualifiedName());
 
-               att = new Attribute(nsUri, "", localName, value);
+               att = new Attribute(nsUri, localName, value);
                Assert.assertEquals(nsUri, att.getNamespace());
-               Assert.assertNull(att.getPrefix());
                Assert.assertEquals(localName, att.getLocalName());
                Assert.assertEquals(localName, att.getQualifiedName());
        }

Modified: 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java?rev=1378447&r1=1378446&r2=1378447&view=diff
==============================================================================
--- 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java
 (original)
+++ 
pdfbox/branches/xmpbox-refactoring/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/TestSimpleMetadataProperties.java
 Wed Aug 29 05:54:29 2012
@@ -232,9 +232,8 @@ public class TestSimpleMetadataPropertie
        public void testAttribute() throws Exception {
 
                IntegerType integer = new IntegerType(parent,null, "test", 
"integer", 1);
-               Attribute value = new Attribute("http://www.test.org/test/";, 
"test",
-                               "value1", "StringValue1");
-               Attribute value2 = new Attribute(null, "test", "value2", 
"StringValue2");
+               Attribute value = new Attribute("http://www.test.org/test/";, 
"value1", "StringValue1");
+               Attribute value2 = new Attribute("http://www.test.org/test/";, 
"value2", "StringValue2");
 
                integer.setAttribute(value);
 
@@ -257,10 +256,10 @@ public class TestSimpleMetadataPropertie
 
                // Attribute with namespace Creation checking
                Attribute valueNS = new Attribute("http://www.tefst2.org/test/";,
-                               "test2", "value2", "StringValue.2");
+                                "value2", "StringValue.2");
                integer.setAttribute(valueNS);
                Attribute valueNS2 = new Attribute("http://www.test2.org/test/";,
-                               "test2", "value2", "StringValueTwo");
+                                "value2", "StringValueTwo");
                integer.setAttribute(valueNS2);
 
                List<Attribute> atts = integer.getAllAttributes();


Reply via email to