fix for schema2xforms converter when dealing with elements that have anonymous complexTypes which are repeated. the proper nodeset wasn't being associated since the bind was incomplete. also correcting an issue where bind can only be required for simple schema types since complex types have complex values which aren't implicitly validated.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4789 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-01-11 03:57:24 +00:00
parent 383d84e536
commit badba0e799
2 changed files with 45 additions and 14 deletions

View File

@@ -1474,18 +1474,16 @@ public class SchemaFormBuilder
pathToRoot);
modelSection.appendChild(bindElement);
if (typeName != null)
{
this.startBindElement(bindElement,
schema,
controlType,
null,
pathToRoot,
SchemaUtil.getOccurance(elementDecl));
}
LOGGER.debug("adding bind for control " + controlType +
" type " + typeName +
" path to root " + pathToRoot);
this.startBindElement(bindElement,
schema,
controlType,
null,
pathToRoot,
SchemaUtil.getOccurance(elementDecl));
}
//addComplexType(xForm,modelSection, formSection,(ComplexType)controlType,elementDecl,pathToRoot, relative);
this.addComplexType(xForm,
modelSection,
defaultInstanceElement,
@@ -2616,7 +2614,9 @@ public class SchemaFormBuilder
String nodeset = pathToRoot;
if (o.isRepeated())
{
nodeset = pathToRoot + "[position() != last()]";
}
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":nodeset",
@@ -2629,9 +2629,11 @@ public class SchemaFormBuilder
schema,
controlType);
if (typeName != null && typeName.length() != 0)
{
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":type",
typeName);
}
}
final short constraintType =
@@ -2647,9 +2649,12 @@ public class SchemaFormBuilder
NamespaceConstants.XFORMS_PREFIX + ":readonly",
(constraintType == XSConstants.VC_FIXED) + "()");
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":required",
(o.minimum != 0) + "()");
if (controlType instanceof XSSimpleTypeDefinition)
{
bindElement.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":required",
(o.minimum != 0) + "()");
}
//no more minOccurs & maxOccurs element: add a constraint if maxOccurs>1:
//count(.) <= maxOccurs && count(.) >= minOccurs