chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1454322 [2/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-binding...
Date Fri, 08 Mar 2013 11:13:28 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1454322&r1=1454321&r2=1454322&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Fri Mar  8 11:13:27 2013
@@ -25,6 +25,7 @@ import java.math.BigInteger;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -159,29 +160,34 @@ public class XMLConverter {
 
         writer.writeStartElement(namespace, TAG_REPOSITORY_INFO);
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_ID, source.getId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_NAME, source.getName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_DESCRIPTION, source.getDescription());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_VENDOR, source.getVendorName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT, source.getProductName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT_VERSION, source.getProductVersion());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_ROOT_FOLDER_ID, source.getRootFolderId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_CHANGE_LOG_TOKEN, source.getLatestChangeLogToken());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_ID, source.getId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_NAME, source.getName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_DESCRIPTION, source.getDescription());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_VENDOR, source.getVendorName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT, source.getProductName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRODUCT_VERSION, source.getProductVersion());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_ROOT_FOLDER_ID, source.getRootFolderId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGE_LOG_TOKEN,
+                source.getLatestChangeLogToken());
         writeRepositoryCapabilities(writer, cmisVersion, source.getCapabilities());
         writeAclCapabilities(writer, cmisVersion, source.getAclCapabilities());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_CMIS_VERSION_SUPPORTED, source.getCmisVersionSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_THIN_CLIENT_URI, source.getThinClientUri());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_INCOMPLETE, source.getChangesIncomplete());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CMIS_VERSION_SUPPORTED,
+                source.getCmisVersionSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_THIN_CLIENT_URI, source.getThinClientUri());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_INCOMPLETE,
+                source.getChangesIncomplete());
         if (source.getChangesOnType() != null) {
             for (BaseTypeId baseType : source.getChangesOnType()) {
                 if (cmisVersion == CmisVersion.CMIS_1_0 && baseType == BaseTypeId.CMIS_ITEM) {
                     continue;
                 }
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_ON_TYPE, baseType);
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_CHANGES_ON_TYPE, baseType);
             }
         }
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANONYMOUS, source.getPrincipalIdAnonymous());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANYONE, source.getPrincipalIdAnyone());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANONYMOUS,
+                source.getPrincipalIdAnonymous());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_REPINFO_PRINCIPAL_ID_ANYONE,
+                source.getPrincipalIdAnyone());
         if (cmisVersion != CmisVersion.CMIS_1_0 && source.getExtensionFeatures() != null) {
             for (ExtensionFeature feature : source.getExtensionFeatures()) {
                 writeExtendedFeatures(writer, cmisVersion, feature);
@@ -198,37 +204,38 @@ public class XMLConverter {
             return;
         }
 
-        writer.writeStartElement(NAMESPACE_CMIS, TAG_REPINFO_CAPABILITIES);
+        writer.writeStartElement(PREFIX_CMIS, TAG_REPINFO_CAPABILITIES, NAMESPACE_CMIS);
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_ACL, source.getAclCapability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_ALL_VERSIONS_SEARCHABLE,
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ACL, source.getAclCapability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ALL_VERSIONS_SEARCHABLE,
                 source.isAllVersionsSearchableSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_CHANGES, source.getChangesCapability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_CONTENT_STREAM_UPDATABILITY,
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CHANGES, source.getChangesCapability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CONTENT_STREAM_UPDATABILITY,
                 source.getContentStreamUpdatesCapability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_GET_DESCENDANTS, source.isGetDescendantsSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_GET_FOLDER_TREE, source.isGetFolderTreeSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_GET_DESCENDANTS, source.isGetDescendantsSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_GET_FOLDER_TREE, source.isGetFolderTreeSupported());
         if (cmisVersion != CmisVersion.CMIS_1_0) {
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_ORDER_BY, source.getOrderByCapability());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_ORDER_BY, source.getOrderByCapability());
         }
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_MULTIFILING, source.isMultifilingSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_PWC_SEARCHABLE, source.isPwcSearchableSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_PWC_UPDATABLE, source.isPwcUpdatableSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_QUERY, source.getQueryCapability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_RENDITIONS, source.getRenditionsCapability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_UNFILING, source.isUnfilingSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_VERSION_SPECIFIC_FILING,
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_MULTIFILING, source.isMultifilingSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_PWC_SEARCHABLE, source.isPwcSearchableSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_PWC_UPDATABLE, source.isPwcUpdatableSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_QUERY, source.getQueryCapability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_RENDITIONS, source.getRenditionsCapability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_UNFILING, source.isUnfilingSupported());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_VERSION_SPECIFIC_FILING,
                 source.isVersionSpecificFilingSupported());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_JOIN, source.getJoinCapability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_JOIN, source.getJoinCapability());
         if (cmisVersion != CmisVersion.CMIS_1_0) {
             if (source.getCreatablePropertyTypes() != null) {
                 CreatablePropertyTypes creatablePropertyTypes = source.getCreatablePropertyTypes();
 
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES);
+                writer.writeStartElement(PREFIX_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES, NAMESPACE_CMIS);
 
                 if (creatablePropertyTypes.canCreate() != null) {
                     for (PropertyType pt : creatablePropertyTypes.canCreate()) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE, pt);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE,
+                                pt);
                     }
                 }
 
@@ -238,33 +245,38 @@ public class XMLConverter {
             if (source.getNewTypeSettableAttributes() != null) {
                 NewTypeSettableAttributes newTypeSettableAttributes = source.getNewTypeSettableAttributes();
 
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES);
+                writer.writeStartElement(PREFIX_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES, NAMESPACE_CMIS);
 
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_ID,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_ID,
                         newTypeSettableAttributes.canSetId());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAME,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAME,
                         newTypeSettableAttributes.canSetLocalName());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAMESPACE,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
+                        TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_LOCALNAMESPACE,
                         newTypeSettableAttributes.canSetLocalNamespace());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DISPLAYNAME,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DISPLAYNAME,
                         newTypeSettableAttributes.canSetDisplayName());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYNAME,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYNAME,
                         newTypeSettableAttributes.canSetQueryName());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DESCRIPTION,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_DESCRIPTION,
                         newTypeSettableAttributes.canSetDescription());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CREATEABLE,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CREATEABLE,
                         newTypeSettableAttributes.canSetCreatable());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FILEABLE,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FILEABLE,
                         newTypeSettableAttributes.canSetFileable());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYABLE,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_QUERYABLE,
                         newTypeSettableAttributes.canSetQueryable());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FULLTEXTINDEXED,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
+                        TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_FULLTEXTINDEXED,
                         newTypeSettableAttributes.canSetFulltextIndexed());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_INCLUDEDINSUPERTYTPEQUERY,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
+                        TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_INCLUDEDINSUPERTYTPEQUERY,
                         newTypeSettableAttributes.canSetIncludedInSupertypeQuery());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEPOLICY,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
+                        TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEPOLICY,
                         newTypeSettableAttributes.canSetControllablePolicy());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEACL,
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS,
+                        TAG_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES_CONTROLABLEACL,
                         newTypeSettableAttributes.canSetControllableAcl());
 
                 writeExtensions(writer, newTypeSettableAttributes);
@@ -283,16 +295,18 @@ public class XMLConverter {
             return;
         }
 
-        writer.writeStartElement(NAMESPACE_CMIS, TAG_REPINFO_ACL_CAPABILITIES);
+        writer.writeStartElement(PREFIX_CMIS, TAG_REPINFO_ACL_CAPABILITIES, NAMESPACE_CMIS);
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACLCAP_SUPPORTED_PERMISSIONS, source.getSupportedPermissions());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAGACLCAP_ACL_PROPAGATION, source.getAclPropagation());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_SUPPORTED_PERMISSIONS,
+                source.getSupportedPermissions());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAGACLCAP_ACL_PROPAGATION, source.getAclPropagation());
         if (source.getPermissions() != null) {
             for (PermissionDefinition pd : source.getPermissions()) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSIONS);
+                writer.writeStartElement(PREFIX_CMIS, TAG_ACLCAP_PERMISSIONS, NAMESPACE_CMIS);
 
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_PERMISSION, pd.getId());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_DESCRIPTION, pd.getDescription());
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_PERMISSION, pd.getId());
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_DESCRIPTION,
+                        pd.getDescription());
 
                 writeExtensions(writer, pd);
                 writer.writeEndElement();
@@ -300,12 +314,12 @@ public class XMLConverter {
         }
         if (source.getPermissionMapping() != null) {
             for (PermissionMapping pm : source.getPermissionMapping().values()) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_ACLCAP_PERMISSION_MAPPING);
+                writer.writeStartElement(PREFIX_CMIS, TAG_ACLCAP_PERMISSION_MAPPING, NAMESPACE_CMIS);
 
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_KEY, pm.getKey());
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_KEY, pm.getKey());
                 if (pm.getPermissions() != null) {
                     for (String perm : pm.getPermissions()) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_PERMISSION, perm);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACLCAP_MAPPING_PERMISSION, perm);
                     }
                 }
 
@@ -324,19 +338,19 @@ public class XMLConverter {
             return;
         }
 
-        writer.writeStartElement(NAMESPACE_CMIS, TAG_REPINFO_EXTENDED_FEATURES);
+        writer.writeStartElement(PREFIX_CMIS, TAG_REPINFO_EXTENDED_FEATURES, NAMESPACE_CMIS);
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_ID, source.getId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_URL, source.getUrl());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_COMMON_NAME, source.getCommonName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_VERSION_LABEL, source.getVersionLabel());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_DESCRIPTION, source.getDescription());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_ID, source.getId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_URL, source.getUrl());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_COMMON_NAME, source.getCommonName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_VERSION_LABEL, source.getVersionLabel());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DESCRIPTION, source.getDescription());
         if (source.getFeatureData() != null) {
             for (Map.Entry<String, String> data : source.getFeatureData().entrySet()) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_FEATURE_DATA);
+                writer.writeStartElement(PREFIX_CMIS, TAG_FEATURE_DATA, NAMESPACE_CMIS);
 
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_DATA_KEY, data.getKey());
-                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_FEATURE_DATA_VALUE, data.getValue());
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DATA_KEY, data.getKey());
+                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_FEATURE_DATA_VALUE, data.getValue());
 
                 writer.writeEndElement();
             }
@@ -365,45 +379,45 @@ public class XMLConverter {
         writer.writeStartElement(namespace, TAG_TYPE);
 
         if (source.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":" + ATTR_DOCUMENT_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_DOCUMENT_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":" + ATTR_FOLDER_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_FOLDER_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":"
-                    + ATTR_RELATIONSHIP_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_RELATIONSHIP_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":" + ATTR_POLICY_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_POLICY_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":" + ATTR_ITEM_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_ITEM_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", writer.getPrefix(NAMESPACE_CMIS) + ":" + ATTR_SECONDARY_TYPE);
+            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_SECONDARY_TYPE);
         } else {
             throw new CmisRuntimeException("Type definition has no base type id!");
         }
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_ID, source.getId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_LOCALNAME, source.getLocalName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_LOCALNAMESPACE, source.getLocalNamespace());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_DISPLAYNAME, source.getDisplayName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_QUERYNAME, source.getQueryName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_DESCRIPTION, source.getDescription());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_BASE_ID, source.getBaseTypeId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_PARENT_ID, source.getParentTypeId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_CREATABLE, source.isCreatable());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_FILEABLE, source.isFileable());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_QUERYABLE, source.isQueryable());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_FULLTEXT_INDEXED, source.isFulltextIndexed());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_INCLUDE_IN_SUPERTYPE_QUERY, source.isIncludedInSupertypeQuery());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_POLICY, source.isControllablePolicy());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_ACL, source.isControllableAcl());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ID, source.getId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_LOCALNAME, source.getLocalName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_LOCALNAMESPACE, source.getLocalNamespace());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_DISPLAYNAME, source.getDisplayName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_QUERYNAME, source.getQueryName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_DESCRIPTION, source.getDescription());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_BASE_ID, source.getBaseTypeId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_PARENT_ID, source.getParentTypeId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CREATABLE, source.isCreatable());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_FILEABLE, source.isFileable());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_QUERYABLE, source.isQueryable());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_FULLTEXT_INDEXED, source.isFulltextIndexed());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_INCLUDE_IN_SUPERTYPE_QUERY,
+                source.isIncludedInSupertypeQuery());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_POLICY, source.isControllablePolicy());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTROLABLE_ACL, source.isControllableAcl());
         if (cmisVersion != CmisVersion.CMIS_1_0 && source.getTypeMutability() != null) {
             TypeMutability tm = source.getTypeMutability();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_TYPE_MUTABILITY, NAMESPACE_CMIS);
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_CREATE, tm.canCreate());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_UPDATE, tm.canUpdate());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_DELETE, tm.canDelete());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_CREATE, tm.canCreate());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_UPDATE, tm.canUpdate());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_TYPE_MUTABILITY_DELETE, tm.canDelete());
 
             writeExtensions(writer, tm);
             writer.writeEndElement();
@@ -416,8 +430,9 @@ public class XMLConverter {
 
         if (source instanceof DocumentTypeDefinition) {
             DocumentTypeDefinition docDef = (DocumentTypeDefinition) source;
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_VERSIONABLE, docDef.isVersionable());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_CONTENTSTREAM_ALLOWED, docDef.getContentStreamAllowed());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_VERSIONABLE, docDef.isVersionable());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_CONTENTSTREAM_ALLOWED,
+                    docDef.getContentStreamAllowed());
         }
 
         if (source instanceof RelationshipTypeDefinition) {
@@ -425,14 +440,14 @@ public class XMLConverter {
             if (relDef.getAllowedSourceTypeIds() != null) {
                 for (String id : relDef.getAllowedSourceTypeIds()) {
                     if (id != null) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_SOURCE_TYPES, id);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_SOURCE_TYPES, id);
                     }
                 }
             }
             if (relDef.getAllowedTargetTypeIds() != null) {
                 for (String id : relDef.getAllowedTargetTypeIds()) {
                     if (id != null) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_TARGET_TYPES, id);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_TYPE_ALLOWED_TARGET_TYPES, id);
                     }
                 }
             }
@@ -450,47 +465,48 @@ public class XMLConverter {
 
         switch (source.getPropertyType()) {
         case STRING:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_STRING);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_STRING, NAMESPACE_CMIS);
             break;
         case ID:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_ID);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_ID, NAMESPACE_CMIS);
             break;
         case INTEGER:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_INTEGER);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_INTEGER, NAMESPACE_CMIS);
             break;
         case BOOLEAN:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_BOOLEAN);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_BOOLEAN, NAMESPACE_CMIS);
             break;
         case DATETIME:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_DATETIME);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_DATETIME, NAMESPACE_CMIS);
             break;
         case DECIMAL:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_DECIMAL);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_DECIMAL, NAMESPACE_CMIS);
             break;
         case HTML:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_HTML);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_HTML, NAMESPACE_CMIS);
             break;
         case URI:
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_TYPE_PROP_DEF_URI);
+            writer.writeStartElement(PREFIX_CMIS, TAG_TYPE_PROP_DEF_URI, NAMESPACE_CMIS);
             break;
         default:
             throw new CmisRuntimeException("Property defintion has no property type!");
         }
 
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ID, source.getId());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAME, source.getLocalName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAMESPACE, source.getLocalNamespace());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DISPLAYNAME, source.getDisplayName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYNAME, source.getQueryName());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DESCRIPTION, source.getDescription());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PROPERTY_TYPE, source.getPropertyType());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CARDINALITY, source.getCardinality());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_UPDATABILITY, source.getUpdatability());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_INHERITED, source.isInherited());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_REQUIRED, source.isRequired());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYABLE, source.isQueryable());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ORDERABLE, source.isOrderable());
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_OPENCHOICE, source.isOpenChoice());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ID, source.getId());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAME, source.getLocalName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_LOCALNAMESPACE,
+                source.getLocalNamespace());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DISPLAYNAME, source.getDisplayName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYNAME, source.getQueryName());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DESCRIPTION, source.getDescription());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PROPERTY_TYPE, source.getPropertyType());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CARDINALITY, source.getCardinality());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_UPDATABILITY, source.getUpdatability());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_INHERITED, source.isInherited());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_REQUIRED, source.isRequired());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_QUERYABLE, source.isQueryable());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_ORDERABLE, source.isOrderable());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_OPENCHOICE, source.isOpenChoice());
 
         if (source instanceof PropertyStringDefinition) {
             PropertyStringDefinition def = (PropertyStringDefinition) source;
@@ -499,7 +515,7 @@ public class XMLConverter {
                 writeProperty(writer, new PropertyStringImpl(null, def.getDefaultValue()), true);
             }
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_LENGTH, def.getMaxLength());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_LENGTH, def.getMaxLength());
         } else if (source instanceof PropertyIdDefinition) {
             PropertyIdDefinition def = (PropertyIdDefinition) source;
 
@@ -513,8 +529,8 @@ public class XMLConverter {
                 writeProperty(writer, new PropertyIntegerImpl(null, def.getDefaultValue()), true);
             }
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
         } else if (source instanceof PropertyBooleanDefinition) {
             PropertyBooleanDefinition def = (PropertyBooleanDefinition) source;
 
@@ -528,7 +544,8 @@ public class XMLConverter {
                 writeProperty(writer, new PropertyDateTimeImpl(null, def.getDefaultValue()), true);
             }
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_RESOLUTION, def.getDateTimeResolution());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_RESOLUTION,
+                    def.getDateTimeResolution());
         } else if (source instanceof PropertyDecimalDefinition) {
             PropertyDecimalDefinition def = (PropertyDecimalDefinition) source;
 
@@ -536,9 +553,9 @@ public class XMLConverter {
                 writeProperty(writer, new PropertyDecimalImpl(null, def.getDefaultValue()), true);
             }
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PRECISION, def.getPrecision());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_PRECISION, def.getPrecision());
         } else if (source instanceof PropertyHtmlDefinition) {
             PropertyHtmlDefinition def = (PropertyHtmlDefinition) source;
 
@@ -572,7 +589,7 @@ public class XMLConverter {
             return;
         }
 
-        writer.writeStartElement(NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE);
+        writer.writeStartElement(PREFIX_CMIS, TAG_PROPERTY_TYPE_CHOICE, NAMESPACE_CMIS);
 
         if (source.getDisplayName() != null) {
             writer.writeAttribute(ATTR_PROPERTY_TYPE_CHOICE_DISPLAYNAME, source.getDisplayName());
@@ -585,27 +602,27 @@ public class XMLConverter {
             case HTML:
             case URI:
                 for (String value : (List<String>) source.getValue()) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
                 }
                 break;
             case INTEGER:
                 for (BigInteger value : (List<BigInteger>) source.getValue()) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
                 }
                 break;
             case BOOLEAN:
                 for (Boolean value : (List<Boolean>) source.getValue()) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
                 }
                 break;
             case DATETIME:
                 for (GregorianCalendar value : (List<GregorianCalendar>) source.getValue()) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
                 }
                 break;
             case DECIMAL:
                 for (BigDecimal value : (List<BigDecimal>) source.getValue()) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_CHOICE_VALUE, value);
                 }
                 break;
             default:
@@ -643,7 +660,7 @@ public class XMLConverter {
         if (source.getProperties() != null) {
             Properties properties = source.getProperties();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_PROPERTIES);
+            writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_PROPERTIES, NAMESPACE_CMIS);
 
             if (properties.getPropertyList() != null) {
                 for (PropertyData<?> property : properties.getPropertyList()) {
@@ -657,7 +674,7 @@ public class XMLConverter {
         if (source.getAllowableActions() != null) {
             AllowableActions allowableActions = source.getAllowableActions();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_ALLOWABLE_ACTIONS);
+            writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_ALLOWABLE_ACTIONS, NAMESPACE_CMIS);
 
             if (allowableActions.getAllowableActions() != null) {
                 for (Action action : Action.values()) {
@@ -665,7 +682,7 @@ public class XMLConverter {
                         continue;
                     }
                     if (allowableActions.getAllowableActions().contains(action)) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, action.value(), Boolean.TRUE);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, action.value(), Boolean.TRUE);
                     }
                 }
             }
@@ -683,10 +700,10 @@ public class XMLConverter {
         if (source.getChangeEventInfo() != null) {
             ChangeEventInfo info = source.getChangeEventInfo();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_CHANGE_EVENT_INFO);
+            writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_CHANGE_EVENT_INFO, NAMESPACE_CMIS);
 
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TYPE, info.getChangeType());
-            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TIME, info.getChangeTime());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TYPE, info.getChangeType());
+            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_CHANGE_EVENT_TIME, info.getChangeTime());
 
             writeExtensions(writer, info);
             writer.writeEndElement();
@@ -694,29 +711,29 @@ public class XMLConverter {
         if (source.getAcl() != null) {
             Acl acl = source.getAcl();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_ACL);
+            writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_ACL, NAMESPACE_CMIS);
 
             if (acl.getAces() != null) {
                 for (Ace ace : acl.getAces()) {
                     if (ace != null) {
-                        writer.writeStartElement(NAMESPACE_CMIS, TAG_ACL_PERMISSISONS);
+                        writer.writeStartElement(PREFIX_CMIS, TAG_ACL_PERMISSISONS, NAMESPACE_CMIS);
 
                         if (ace.getPrincipal() != null) {
                             Principal principal = ace.getPrincipal();
 
-                            writer.writeStartElement(NAMESPACE_CMIS, TAG_ACE_PRINCIPAL);
+                            writer.writeStartElement(PREFIX_CMIS, TAG_ACE_PRINCIPAL, NAMESPACE_CMIS);
 
-                            XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACE_PRINCIPAL_ID, principal.getId());
+                            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_PRINCIPAL_ID, principal.getId());
 
                             writeExtensions(writer, principal);
                             writer.writeEndElement();
                         }
                         if (ace.getPermissions() != null) {
                             for (String perm : ace.getPermissions()) {
-                                XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACE_PERMISSIONS, perm);
+                                XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_PERMISSIONS, perm);
                             }
                         }
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_ACE_IS_DIRECT, ace.isDirect());
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_ACE_IS_DIRECT, ace.isDirect());
 
                         writeExtensions(writer, ace);
                         writer.writeEndElement();
@@ -727,16 +744,16 @@ public class XMLConverter {
             writeExtensions(writer, acl);
             writer.writeEndElement();
         }
-        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_OBJECT_EXACT_ACL, source.isExactAcl());
+        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_OBJECT_EXACT_ACL, source.isExactAcl());
         if (source.getPolicyIds() != null) {
             PolicyIdList pids = source.getPolicyIds();
 
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_POLICY_IDS);
+            writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_POLICY_IDS, NAMESPACE_CMIS);
 
             if (pids.getPolicyIds() != null) {
                 for (String id : pids.getPolicyIds()) {
                     if (id != null) {
-                        XMLUtils.write(writer, NAMESPACE_CMIS, TAG_POLICY_ID, id);
+                        XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_POLICY_ID, id);
                     }
                 }
             }
@@ -747,16 +764,17 @@ public class XMLConverter {
         if (source.getRenditions() != null) {
             for (RenditionData rend : source.getRenditions()) {
                 if (rend != null) {
-                    writer.writeStartElement(NAMESPACE_CMIS, TAG_OBJECT_RENDITION);
+                    writer.writeStartElement(PREFIX_CMIS, TAG_OBJECT_RENDITION, NAMESPACE_CMIS);
 
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_STREAM_ID, rend.getStreamId());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_MIMETYPE, rend.getMimeType());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_LENGTH, rend.getBigLength());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_KIND, rend.getKind());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_TITLE, rend.getTitle());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_HEIGHT, rend.getBigHeight());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_WIDTH, rend.getBigWidth());
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_RENDITION_DOCUMENT_ID, rend.getRenditionDocumentId());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_STREAM_ID, rend.getStreamId());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_MIMETYPE, rend.getMimeType());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_LENGTH, rend.getBigLength());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_KIND, rend.getKind());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_TITLE, rend.getTitle());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_HEIGHT, rend.getBigHeight());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_WIDTH, rend.getBigWidth());
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_RENDITION_DOCUMENT_ID,
+                            rend.getRenditionDocumentId());
 
                     writeExtensions(writer, rend);
                     writer.writeEndElement();
@@ -776,24 +794,24 @@ public class XMLConverter {
         }
 
         if (isDefaultValue) {
-            writer.writeStartElement(NAMESPACE_CMIS, TAG_PROPERTY_TYPE_DEAULT_VALUE);
+            writer.writeStartElement(PREFIX_CMIS, TAG_PROPERTY_TYPE_DEAULT_VALUE, NAMESPACE_CMIS);
         } else {
             if (source instanceof PropertyString) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_STRING);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_STRING, NAMESPACE_CMIS);
             } else if (source instanceof PropertyId) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_ID);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_ID, NAMESPACE_CMIS);
             } else if (source instanceof PropertyInteger) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_INTEGER);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_INTEGER, NAMESPACE_CMIS);
             } else if (source instanceof PropertyBoolean) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_BOOLEAN);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_BOOLEAN, NAMESPACE_CMIS);
             } else if (source instanceof PropertyDateTime) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_DATETIME);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_DATETIME, NAMESPACE_CMIS);
             } else if (source instanceof PropertyDecimal) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_DECIMAL);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_DECIMAL, NAMESPACE_CMIS);
             } else if (source instanceof PropertyHtml) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_HTML);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_HTML, NAMESPACE_CMIS);
             } else if (source instanceof PropertyUri) {
-                writer.writeStartElement(NAMESPACE_CMIS, TAG_PROP_URI);
+                writer.writeStartElement(PREFIX_CMIS, TAG_PROP_URI, NAMESPACE_CMIS);
             } else {
                 throw new CmisRuntimeException("Invalid property!");
             }
@@ -817,35 +835,35 @@ public class XMLConverter {
             List<String> values = (List<String>) source.getValues();
             if (values != null) {
                 for (String value : values) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
                 }
             }
         } else if (source instanceof PropertyInteger) {
             List<BigInteger> values = ((PropertyInteger) source).getValues();
             if (values != null) {
                 for (BigInteger value : values) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
                 }
             }
         } else if (source instanceof PropertyBoolean) {
             List<Boolean> values = ((PropertyBoolean) source).getValues();
             if (values != null) {
                 for (Boolean value : values) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
                 }
             }
         } else if (source instanceof PropertyDateTime) {
             List<GregorianCalendar> values = ((PropertyDateTime) source).getValues();
             if (values != null) {
                 for (GregorianCalendar value : values) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
                 }
             }
         } else if (source instanceof PropertyDecimal) {
             List<BigDecimal> values = ((PropertyDecimal) source).getValues();
             if (values != null) {
                 for (BigDecimal value : values) {
-                    XMLUtils.write(writer, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
+                    XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_VALUE, value);
                 }
             }
         }
@@ -863,39 +881,70 @@ public class XMLConverter {
             return;
         }
 
+        LinkedList<String> ns = new LinkedList<String>();
+
         if (source.getExtensions() != null) {
             for (CmisExtensionElement element : source.getExtensions()) {
                 if (element == null) {
                     continue;
                 }
 
-                writeExtensionElement(writer, element);
+                writeExtensionElement(writer, element, ns);
             }
         }
     }
 
-    private static void writeExtensionElement(XMLStreamWriter writer, CmisExtensionElement source)
+    private static void writeExtensionElement(XMLStreamWriter writer, CmisExtensionElement source, LinkedList<String> ns)
             throws XMLStreamException {
-        if (source == null) {
+        if (source == null || source.getName() == null) {
             return;
         }
 
-        if (source.getValue() != null) {
-            XMLUtils.write(writer, source.getNamespace(), source.getName(), source.getValue());
+        boolean addedNamespace = false;
+
+        if (source.getNamespace() != null) {
+            String prefix = writer.getPrefix(source.getNamespace());
+            if (prefix == null) {
+                int p = ns.indexOf(source.getNamespace());
+
+                if (p == -1) {
+                    prefix = "e" + (ns.size() + 1);
+                    ns.add(source.getNamespace());
+                    addedNamespace = true;
+                } else {
+                    prefix = "e" + (p + 1);
+                }
+            }
+
+            writer.writeStartElement(prefix, source.getName(), source.getNamespace());
+
+            if (addedNamespace) {
+                writer.writeNamespace(prefix, source.getNamespace());
+            }
         } else {
-            if (source.getNamespace() == null) {
-                writer.writeStartElement(source.getName());
-            } else {
-                writer.writeStartElement(source.getNamespace(), source.getName());
+            writer.writeStartElement(source.getName());
+        }
+
+        if (source.getAttributes() != null) {
+            for (Map.Entry<String, String> attr : source.getAttributes().entrySet()) {
+                writer.writeAttribute(attr.getKey(), attr.getValue());
             }
+        }
 
+        if (source.getValue() != null) {
+            writer.writeCharacters(source.getValue());
+        } else {
             if (source.getChildren() != null) {
                 for (CmisExtensionElement child : source.getChildren()) {
-                    writeExtensionElement(writer, child);
+                    writeExtensionElement(writer, child, ns);
                 }
             }
+        }
 
-            writer.writeEndElement();
+        writer.writeEndElement();
+
+        if (addedNamespace) {
+            ns.removeLast();
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java?rev=1454322&r1=1454321&r2=1454322&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Fri Mar  8 11:13:27 2013
@@ -34,18 +34,13 @@ import org.apache.chemistry.opencmis.com
 
 public class XMLUtils {
 
-    public static final String PREFIX_XSI = "xsi";
-    public static final String PREFIX_ATOM = "atom";
-    public static final String PREFIX_CMIS = "cmis";
-    public static final String PREFIX_RESTATOM = "cmisra";
-    public static final String PREFIX_APACHE_CHEMISTY = "chemistry";
-
     public static final ThreadLocal<XMLInputFactory> THREADLOCAL_XML_INPUT_FACTORY = new ThreadLocal<XMLInputFactory>() {
         @Override
         protected XMLInputFactory initialValue() {
             XMLInputFactory factory = XMLInputFactory.newInstance();
             factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
             factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
+            factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
             return factory;
         }
     };
@@ -54,7 +49,7 @@ public class XMLUtils {
         @Override
         protected XMLOutputFactory initialValue() {
             XMLOutputFactory factory = XMLOutputFactory.newInstance();
-            factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+            factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
             return factory;
         }
     };
@@ -74,11 +69,11 @@ public class XMLUtils {
      * Starts a XML document.
      */
     public static void startXmlDocument(XMLStreamWriter writer) throws XMLStreamException {
-        writer.setPrefix(PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
-        writer.setPrefix(PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
-        writer.setPrefix(PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
-        writer.setPrefix(PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
-        writer.setPrefix(PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
+        writer.setPrefix(XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
+        writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
+        writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+        writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
+        writer.setPrefix(XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
 
         writer.writeStartDocument();
     }
@@ -90,12 +85,12 @@ public class XMLUtils {
         startXmlDocument(writer);
 
         writer.writeStartElement(XMLConstants.NAMESPACE_ATOM, "entry");
-        writer.writeNamespace(PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
-        writer.writeNamespace(PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
-        writer.writeNamespace(PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
-        writer.writeNamespace(PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
+        writer.writeNamespace(XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
+        writer.writeNamespace(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
+        writer.writeNamespace(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+        writer.writeNamespace(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
         if (hasContent) {
-            writer.writeNamespace(PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
+            writer.writeNamespace(XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
         }
     }
 
@@ -107,9 +102,9 @@ public class XMLUtils {
         startXmlDocument(writer);
 
         writer.writeStartElement(XMLConstants.NAMESPACE_ATOM, "feed");
-        writer.writeNamespace(PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
-        writer.writeNamespace(PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
-        writer.writeNamespace(PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
+        writer.writeNamespace(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
+        writer.writeNamespace(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+        writer.writeNamespace(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
     }
 
     /**
@@ -117,13 +112,13 @@ public class XMLUtils {
      */
     public static void endXmlDocument(XMLStreamWriter writer) throws XMLStreamException {
         writer.writeEndDocument();
-        writer.flush();
+        writer.close();
     }
 
     /**
      * Writes a String tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, String value)
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, String value)
             throws XMLStreamException {
         if (value == null) {
             return;
@@ -132,7 +127,7 @@ public class XMLUtils {
         if (namespace == null) {
             writer.writeStartElement(tag);
         } else {
-            writer.writeStartElement(namespace, tag);
+            writer.writeStartElement(prefix, tag, namespace);
         }
         writer.writeCharacters(value);
         writer.writeEndElement();
@@ -141,55 +136,55 @@ public class XMLUtils {
     /**
      * Writes an Integer tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, BigInteger value)
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, BigInteger value)
             throws XMLStreamException {
         if (value == null) {
             return;
         }
 
-        write(writer, namespace, tag, value.toString());
+        write(writer, prefix, namespace, tag, value.toString());
     }
 
     /**
      * Writes a Decimal tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, BigDecimal value)
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, BigDecimal value)
             throws XMLStreamException {
         if (value == null) {
             return;
         }
 
-        write(writer, namespace, tag, value.toString());
+        write(writer, prefix, namespace, tag, value.toString());
     }
 
     /**
      * Writes a DateTime tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, GregorianCalendar value)
-            throws XMLStreamException {
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag,
+            GregorianCalendar value) throws XMLStreamException {
         if (value == null) {
             return;
         }
 
-        write(writer, namespace, tag, DateTimeHelper.formatXmlDateTime(value));
+        write(writer, prefix, namespace, tag, DateTimeHelper.formatXmlDateTime(value));
     }
 
     /**
      * Writes a Boolean tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, Boolean value)
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, Boolean value)
             throws XMLStreamException {
         if (value == null) {
             return;
         }
 
-        write(writer, namespace, tag, value ? "true" : "false");
+        write(writer, prefix, namespace, tag, value ? "true" : "false");
     }
 
     /**
      * Writes an Enum tag.
      */
-    public static void write(XMLStreamWriter writer, String namespace, String tag, Enum<?> value)
+    public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, Enum<?> value)
             throws XMLStreamException {
         if (value == null) {
             return;
@@ -202,7 +197,7 @@ public class XMLUtils {
             throw new XMLStreamException("Cannot get enum value", e);
         }
 
-        write(writer, namespace, tag, enumValue.toString());
+        write(writer, prefix, namespace, tag, enumValue.toString());
     }
 
     // ---------------

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java?rev=1454322&r1=1454321&r2=1454322&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java Fri Mar  8 11:13:27 2013
@@ -124,8 +124,8 @@ public abstract class AbstractXMLConvert
     protected void writeRootTag(XMLStreamWriter writer) throws XMLStreamException {
         writer.setPrefix(TEST_PREFIX, TEST_NAMESPACE);
         writer.writeStartElement(TEST_NAMESPACE, TEST_PREFIX);
-        writer.writeNamespace(XMLUtils.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
-        writer.writeNamespace(XMLUtils.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+        writer.writeNamespace(XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
+        writer.writeNamespace(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.writeNamespace(TEST_PREFIX, TEST_NAMESPACE);
     }
 
@@ -345,7 +345,7 @@ public abstract class AbstractXMLConvert
             assertEquals(name + ".length", expectedMap.size(), actualMap.size());
 
             for (Map.Entry<?, ?> entry : expectedMap.entrySet()) {
-                assertTrue(actualMap.containsKey(entry.getKey()));
+                assertTrue(name + ".contains[" + entry.getKey() + "]", actualMap.containsKey(entry.getKey()));
                 assertDataObjectsEquals(name + "[" + entry.getKey() + "]", entry.getValue(),
                         actualMap.get(entry.getKey()), ignoreMethods);
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java?rev=1454322&r1=1454321&r2=1454322&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/ObjectConvertTest.java Fri Mar  8 11:13:27 2013
@@ -25,8 +25,10 @@ import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.GregorianCalendar;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -304,11 +306,16 @@ public class ObjectConvertTest extends A
         for (int i = 0; i < randomInt(4) + 1; i++) {
             String ns = namespaces[randomInt(namespaces.length)];
 
+            Map<String, String> attr = new HashMap<String, String>();
+            for (int j = 0; j < randomInt(3); j++) {
+                attr.put(randomTag(), randomString());
+            }
+
             CmisExtensionElementImpl element;
             if (randomBoolean() || depth < 1) {
-                element = new CmisExtensionElementImpl(ns, randomTag(), null, randomString());
+                element = new CmisExtensionElementImpl(ns, randomTag(), attr, randomString());
             } else {
-                element = new CmisExtensionElementImpl(ns, randomTag(), null, createExtensions(depth - 1));
+                element = new CmisExtensionElementImpl(ns, randomTag(), attr, createExtensions(depth - 1));
             }
 
             result.add(element);



Mime
View raw message