From cf2fc18ec2e4e11554661b24837f385b47c1f469 Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Fri, 23 Oct 2009 21:23:29 +0000 Subject: [PATCH] Merged DEV-TEMPORARY to HEAD 17093: ETHREEOH-2590: Profile WCM web form in extras/wcm/ doesn't work properly git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17148 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/forms/xforms/Schema2XForms.java | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java index 63ce4078db..574c5185c8 100644 --- a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java +++ b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java @@ -934,12 +934,23 @@ public class Schema2XForms implements Serializable } else { + String attrNamespace = currentAttribute.getNamespace(); + String namespacePrefix = ""; + if (attrNamespace != null && attrNamespace.length() > 0) + { + String prefix =NamespaceResolver.getPrefix(xformsDocument.getDocumentElement(), attrNamespace); + if (prefix!= null && prefix.length() > 0) + { + namespacePrefix = prefix + ":"; + } + } + final String newPathToRoot = (pathToRoot == null || pathToRoot.length() == 0 - ? "@" + currentAttribute.getName() + ? "@" + namespacePrefix + currentAttribute.getName() : (pathToRoot.endsWith("/") - ? pathToRoot + "@" + currentAttribute.getName() - : pathToRoot + "/@" + currentAttribute.getName())); + ? pathToRoot + "@" + namespacePrefix + currentAttribute.getName() + : pathToRoot + "/@"+ namespacePrefix + currentAttribute.getName())); LOGGER.debug("adding attribute " + attributeName + " at " + newPathToRoot); @@ -948,9 +959,16 @@ public class Schema2XForms implements Serializable final String defaultValue = (currentAttributeUse.getConstraintType() == XSConstants.VC_NONE ? null : currentAttributeUse.getConstraintValue()); - defaultInstanceElement.setAttributeNS(this.targetNamespace, + if (namespacePrefix.length() > 0) + { + defaultInstanceElement.setAttributeNS(this.targetNamespace, attributeName, defaultValue); + } + else + { + defaultInstanceElement.setAttribute(attributeName, defaultValue); + } } catch (Exception e) {