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
This commit is contained in:
Gavin Cornwell
2009-10-23 21:23:29 +00:00
parent 6178a24372
commit cf2fc18ec2

View File

@@ -934,12 +934,23 @@ public class Schema2XForms implements Serializable
} }
else 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 = final String newPathToRoot =
(pathToRoot == null || pathToRoot.length() == 0 (pathToRoot == null || pathToRoot.length() == 0
? "@" + currentAttribute.getName() ? "@" + namespacePrefix + currentAttribute.getName()
: (pathToRoot.endsWith("/") : (pathToRoot.endsWith("/")
? pathToRoot + "@" + currentAttribute.getName() ? pathToRoot + "@" + namespacePrefix + currentAttribute.getName()
: pathToRoot + "/@" + currentAttribute.getName())); : pathToRoot + "/@"+ namespacePrefix + currentAttribute.getName()));
LOGGER.debug("adding attribute " + attributeName + LOGGER.debug("adding attribute " + attributeName +
" at " + newPathToRoot); " at " + newPathToRoot);
@@ -948,9 +959,16 @@ public class Schema2XForms implements Serializable
final String defaultValue = (currentAttributeUse.getConstraintType() == XSConstants.VC_NONE final String defaultValue = (currentAttributeUse.getConstraintType() == XSConstants.VC_NONE
? null ? null
: currentAttributeUse.getConstraintValue()); : currentAttributeUse.getConstraintValue());
defaultInstanceElement.setAttributeNS(this.targetNamespace, if (namespacePrefix.length() > 0)
{
defaultInstanceElement.setAttributeNS(this.targetNamespace,
attributeName, attributeName,
defaultValue); defaultValue);
}
else
{
defaultInstanceElement.setAttribute(attributeName, defaultValue);
}
} }
catch (Exception e) catch (Exception e)
{ {