Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsalter2005-06-05 21:29:52 +0000
committercsalter2005-06-05 21:29:52 +0000
commit5e0e76d91f62b0a012811cea1835f34653882abc (patch)
tree6dfea097bd09ca7df6f8f286d071db7c25166d87 /bundles/org.eclipse.wst.xml.core/src-contentmodel
parent616efcd8f1673fa869f22de7a585ca24fe9c9b5c (diff)
downloadwebtools.sourceediting-5e0e76d91f62b0a012811cea1835f34653882abc.tar.gz
webtools.sourceediting-5e0e76d91f62b0a012811cea1835f34653882abc.tar.xz
webtools.sourceediting-5e0e76d91f62b0a012811cea1835f34653882abc.zip
enable facet validation
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src-contentmodel')
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/internal/util/CMValidator.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/internal/util/CMValidator.java b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/internal/util/CMValidator.java
index bcc06af071..6b6957495c 100644
--- a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/internal/util/CMValidator.java
+++ b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/internal/util/CMValidator.java
@@ -748,32 +748,38 @@ public class CMValidator
//
public boolean canPush(Arc arc)
{
- boolean result = true;
- /*
+ boolean result = true;
try
{
if (arc.kind == Arc.REPEAT)
- {
+ {
if (arc.cmNode instanceof CMContent)
{
- CMContent content = (CMContent)arc.cmNode;
- ItemCount itemCount = (ItemCount)activeItemCountList.get(activeItemCountList.size() - 1);
+ CMContent content = (CMContent)arc.cmNode;
- // here we need to compute if we can do another repeat
- // if we increase the repeat count by '1' will this violate the maxOccurs
+ // we only need to do 'special' facet checking if the maxOccurs is > 1
+ // values of '0' and '-1' (unbounded) work 'for free' without any special checking
//
- if (itemCount.count + 1 >= content.getMaxOccur())
- {
- result = false;
+ if (content.getMaxOccur() > 1)
+ {
+ ItemCount itemCount = (ItemCount)activeItemCountList.get(activeItemCountList.size() - 1);
+
+ // here we need to compute if we can do another repeat
+ // if we increase the repeat count by '1' will this violate the maxOccurs
+ //
+ if (itemCount.count + 1 >= content.getMaxOccur())
+ {
+ result = false;
+ }
}
- //System.out.println("canPush REPEAT (" + itemCount.count + ")" + content.getNodeName() + " result= " + result);
+ //System.out.println("canPush REPEAT (" + itemCount.count + ")" + content.getNodeName() + " result= " + result);
}
}
}
catch (Exception e)
{
e.printStackTrace();
- }*/
+ }
//System.out.flush();
return result;
}

Back to the top