Home » Archived » XML Schema Definition (XSD) » The content model with 10,006 states is too large 
| The content model with 10,006 states is too large [message #64570] | 
Tue, 18 October 2005 04:22   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: NOpcooperSPAM.uk.ibm.com 
 
This is a multi-part message in MIME format. 
--------------020007080906040400020902 
Content-Type: text/plain; charset=us-ascii; format=flowed 
Content-Transfer-Encoding: 7bit 
 
I'm having trouble validating what appears to me to be a perfectly valid  
schema. The problem seems to be to do with my minOccurs and maxOccurs  
attributes for an element with complex content. 
 
When they are set to minOccurs=5000 maxOccurs=5000 I see the message in  
the subject string above. When they are set to minOccurs=1  
maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and  
maxOccurs=4000 works (but is suprisingly slow). 
 
Is there some fundamental limitation with XSD that I'm missing here? 
 
I've attached the sample XSD and a test program. 
 
Thanks, 
Paul. 
 
--------------020007080906040400020902 
Content-Type: text/xml; 
 name="example.xsd" 
Content-Transfer-Encoding: 7bit 
Content-Disposition: inline; 
 filename="example.xsd" 
 
<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema     
    targetNamespace="http://www.example.com" 
    xmlns:tns="http://www.example.com"  
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsd:complexType name="ct"> 
        <xsd:sequence> 
            <xsd:element name="sortie"> 
                <xsd:complexType mixed="false"> 
                    <xsd:sequence> 
                        <xsd:element maxOccurs="5000" minOccurs="5000" 
                            name="s_poste_item"> 
                            <xsd:complexType> 
                                <xsd:sequence> 
                                    <xsd:element name="s_logonid"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="8"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_societe"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_ensemble"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="2"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_surservice"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_services"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_responsab"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_fonction"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_types"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_nom_prenom"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="20"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                </xsd:sequence> 
                            </xsd:complexType> 
                        </xsd:element> 
                    </xsd:sequence> 
                </xsd:complexType> 
            </xsd:element> 
        </xsd:sequence> 
    </xsd:complexType> 
    <xsd:element name="example" type="tns:ct"/> 
</xsd:schema> 
--------------020007080906040400020902 
Content-Type: text/plain; 
 name="example.java" 
Content-Transfer-Encoding: 7bit 
Content-Disposition: inline; 
 filename="example.java" 
 
import java.util.Iterator; 
import java.io.File; 
 
import org.eclipse.emf.common.util.URI; 
import org.eclipse.emf.ecore.resource.ResourceSet; 
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
import org.eclipse.xsd.util.XSDResourceImpl; 
import org.eclipse.xsd.XSDDiagnostic; 
 
public class example 
{ 
    public static void main(String[] args) 
    { 
        try 
        {         
            ResourceSet resourceSet = new ResourceSetImpl(); 
    		 
             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
    	    .put("*", new XSDResourceFactoryImpl()); 
            resourceSet.getLoadOptions().put( 
    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
     
     
            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
    			resourceSet.getResource(URI.createFileURI( 
                                new File("example.xsd").getCanonicalFile().toString()),  
                                                    true); 
             
    	xsdMainResource.getSchema().validate(); 
     
            Iterator diagnostics =  
                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
             
            while (diagnostics.hasNext()) 
            {             
                XSDDiagnostic diagnostic =  
                    (XSDDiagnostic) diagnostics.next(); 
     
                System.out.println("Message: " + diagnostic); 
            } 
        } 
        catch (Exception e) 
        { 
            System.out.println("Caught this: " + e); 
        } 
    } 
} 
 
--------------020007080906040400020902--
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #64595 is a reply to message #64570] | 
Tue, 18 October 2005 12:40    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: merks.ca.ibm.com 
 
This is a multi-part message in MIME format. 
--------------090107000305000802080403 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed 
Content-Transfer-Encoding: 7bit 
 
Paul, 
 
In order to validate the Unique Particle Attribute rule, the XSD model  
builds a finite state machine and that machine can get very large very  
quickly.  An <all> content model is the worst example of this since it  
will produce n! (factorial) states.  To prevent disaster (exhausting  
memory) we limit the size of the machine we will produce and when that  
limit is reached we produce the message your see.  It strikes me that  
the message should really be a warning and not an error, since it just  
means there is a constraint that isn't being validated, not that the  
schema is bad... 
 
 
Paul Cooper wrote: 
 
> I'm having trouble validating what appears to me to be a perfectly  
> valid schema. The problem seems to be to do with my minOccurs and  
> maxOccurs attributes for an element with complex content. 
> 
> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
> in the subject string above. When they are set to minOccurs=1  
> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and  
> maxOccurs=4000 works (but is suprisingly slow). 
> 
> Is there some fundamental limitation with XSD that I'm missing here? 
> 
> I've attached the sample XSD and a test program. 
> 
> Thanks, 
> Paul. 
> 
> ------------------------------------------------------------ ------------ 
> 
><?xml version="1.0" encoding="UTF-8"?> 
><xsd:schema     
>    targetNamespace="http://www.example.com" 
>    xmlns:tns="http://www.example.com"  
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>    <xsd:complexType name="ct"> 
>        <xsd:sequence> 
>            <xsd:element name="sortie"> 
>                <xsd:complexType mixed="false"> 
>                    <xsd:sequence> 
>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>                            name="s_poste_item"> 
>                            <xsd:complexType> 
>                                <xsd:sequence> 
>                                    <xsd:element name="s_logonid"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="8"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_societe"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_ensemble"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="2"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_surservice"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_services"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_responsab"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_fonction"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_types"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_nom_prenom"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="20"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                </xsd:sequence> 
>                            </xsd:complexType> 
>                        </xsd:element> 
>                    </xsd:sequence> 
>                </xsd:complexType> 
>            </xsd:element> 
>        </xsd:sequence> 
>    </xsd:complexType> 
>    <xsd:element name="example" type="tns:ct"/> 
></xsd:schema> 
> 
> ------------------------------------------------------------ ------------ 
> 
>import java.util.Iterator; 
>import java.io.File; 
> 
>import org.eclipse.emf.common.util.URI; 
>import org.eclipse.emf.ecore.resource.ResourceSet; 
>import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>import org.eclipse.xsd.util.XSDResourceImpl; 
>import org.eclipse.xsd.XSDDiagnostic; 
> 
>public class example 
>{ 
>    public static void main(String[] args) 
>    { 
>        try 
>        {         
>            ResourceSet resourceSet = new ResourceSetImpl(); 
>    		 
>             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>    	    .put("*", new XSDResourceFactoryImpl()); 
>            resourceSet.getLoadOptions().put( 
>    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>     
>     
>            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>    			resourceSet.getResource(URI.createFileURI( 
>                                new File("example.xsd").getCanonicalFile().toString()),  
>                                                    true); 
>             
>    	xsdMainResource.getSchema().validate(); 
>     
>            Iterator diagnostics =  
>                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>             
>            while (diagnostics.hasNext()) 
>            {             
>                XSDDiagnostic diagnostic =  
>                    (XSDDiagnostic) diagnostics.next(); 
>     
>                System.out.println("Message: " + diagnostic); 
>            } 
>        } 
>        catch (Exception e) 
>        { 
>            System.out.println("Caught this: " + e); 
>        } 
>    } 
>} 
>   
> 
 
 
--------------090107000305000802080403 
Content-Type: text/html; charset=ISO-8859-1 
Content-Transfer-Encoding: 7bit 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> 
</head> 
<body bgcolor="#ffffff" text="#000000"> 
Paul,<br> 
<br> 
In order to validate the Unique Particle Attribute rule, the XSD model 
builds a finite state machine and that machine can get very large very 
quickly.  An <all> content model is the worst example of this 
since it will produce n! (factorial) states.  To prevent disaster 
(exhausting memory) we limit the size of the machine we will produce 
and when that limit is reached we produce the message your see.  It 
strikes me that the message should really be a warning and not an 
error, since it just means there is a constraint that isn't being 
validated, not that the schema is bad...<br> 
<br> 
<br> 
Paul Cooper wrote: 
<blockquote cite="middj2b84$45s$1@news.eclipse.org" type="cite">I'm 
having trouble validating what appears to me to be a perfectly valid 
schema. The problem seems to be to do with my minOccurs and maxOccurs 
attributes for an element with complex content. 
  <br> 
  <br> 
When they are set to minOccurs=5000 maxOccurs=5000 I see the message in 
the subject string above. When they are set to minOccurs=1 
maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and 
maxOccurs=4000 works (but is suprisingly slow). 
  <br> 
  <br> 
Is there some fundamental limitation with XSD that I'm missing here? 
  <br> 
  <br> 
I've attached the sample XSD and a test program. 
  <br> 
  <br> 
Thanks, 
  <br> 
Paul. 
  <br> 
  <pre wrap=""> 
<hr size="4" width="90%"> 
<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema     
    targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://www.example.com">"http://www.example.com"</a> 
    xmlns:tns=<a class="moz-txt-link-rfc2396E" href="http://www.example.com">"http://www.example.com"</a>  
    xmlns:xsd=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>> 
    <xsd:complexType name="ct"> 
        <xsd:sequence> 
            <xsd:element name="sortie"> 
                <xsd:complexType mixed="false"> 
                    <xsd:sequence> 
                        <xsd:element maxOccurs="5000" minOccurs="5000" 
                            name="s_poste_item"> 
                            <xsd:complexType> 
                                <xsd:sequence> 
                                    <xsd:element name="s_logonid"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="8"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_societe"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_ensemble"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="2"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_surservice"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_services"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_responsab"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_fonction"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_types"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_nom_prenom"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="20"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                </xsd:sequence> 
                            </xsd:complexType> 
                        </xsd:element> 
                    </xsd:sequence> 
                </xsd:complexType> 
            </xsd:element> 
        </xsd:sequence> 
    </xsd:complexType> 
    <xsd:element name="example" type="tns:ct"/> 
</xsd:schema></pre> 
  <pre wrap=""> 
<hr size="4" width="90%"> 
import java.util.Iterator; 
import java.io.File; 
 
import org.eclipse.emf.common.util.URI; 
import org.eclipse.emf.ecore.resource.ResourceSet; 
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
import org.eclipse.xsd.util.XSDResourceImpl; 
import org.eclipse.xsd.XSDDiagnostic; 
 
public class example 
{ 
    public static void main(String[] args) 
    { 
        try 
        {         
            ResourceSet resourceSet = new ResourceSetImpl(); 
    		 
             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
    	    .put("*", new XSDResourceFactoryImpl()); 
            resourceSet.getLoadOptions().put( 
    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
     
     
            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
    			resourceSet.getResource(URI.createFileURI( 
                                new File("example.xsd").getCanonicalFile().toString()),  
                                                    true); 
             
    	xsdMainResource.getSchema().validate(); 
     
            Iterator diagnostics =  
                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
             
            while (diagnostics.hasNext()) 
            {             
                XSDDiagnostic diagnostic =  
                    (XSDDiagnostic) diagnostics.next(); 
     
                System.out.println("Message: " + diagnostic); 
            } 
        } 
        catch (Exception e) 
        { 
            System.out.println("Caught this: " + e); 
        } 
    } 
} 
  </pre> 
</blockquote> 
<br> 
</body> 
</html> 
 
--------------090107000305000802080403--
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #64818 is a reply to message #64595] | 
Wed, 26 October 2005 07:38    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: NOpcooperSPAM.uk.ibm.com 
 
Thanks for the response, I'll be able to code around this in my own  
logic. However, it turns out that there is another related problem. If I  
change the testcase below to indicate maxOccurs="4997" minOccurs="4997"  
then instead of getting the error message the following NPE is thrown: 
 
java.lang.NullPointerException 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl$XSDNFA.getDiagnostics(X SDParticl 
eImpl.java:1780) 
         at  
 org.eclipse.xsd.impl.XSDModelGroupImpl.validateRoot(XSDModel GroupImpl 
..java:600) 
         at  
 org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
TypeDefinitionImpl.java:1309) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDElementDeclarationImpl.validate(XSDE lementDec 
larationImpl.java:752) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
4) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDModelGroupImpl.validate(XSDModelGrou pImpl.jav 
a:487) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
4) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
TypeDefinitionImpl.java:1305) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDSchemaImpl.validate(XSDSchemaImpl.ja va:1498) 
         at example.main(example.java:30) 
 
 
I'm guessing this is not the expected behaviour :-) 
Paul. 
 
 
Ed Merks wrote: 
 
> Paul, 
>  
> In order to validate the Unique Particle Attribute rule, the XSD model  
> builds a finite state machine and that machine can get very large very  
> quickly.  An <all> content model is the worst example of this since it  
> will produce n! (factorial) states.  To prevent disaster (exhausting  
> memory) we limit the size of the machine we will produce and when that  
> limit is reached we produce the message your see.  It strikes me that  
> the message should really be a warning and not an error, since it just  
> means there is a constraint that isn't being validated, not that the  
> schema is bad... 
>  
>  
> Paul Cooper wrote: 
>  
>> I'm having trouble validating what appears to me to be a perfectly  
>> valid schema. The problem seems to be to do with my minOccurs and  
>> maxOccurs attributes for an element with complex content. 
>> 
>> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
>> in the subject string above. When they are set to minOccurs=1  
>> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and  
>> maxOccurs=4000 works (but is suprisingly slow). 
>> 
>> Is there some fundamental limitation with XSD that I'm missing here? 
>> 
>> I've attached the sample XSD and a test program. 
>> 
>> Thanks, 
>> Paul. 
>> 
>> ------------------------------------------------------------ ------------ 
>> 
>><?xml version="1.0" encoding="UTF-8"?> 
>><xsd:schema     
>>    targetNamespace="http://www.example.com" 
>>    xmlns:tns="http://www.example.com"  
>>    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>>    <xsd:complexType name="ct"> 
>>        <xsd:sequence> 
>>            <xsd:element name="sortie"> 
>>                <xsd:complexType mixed="false"> 
>>                    <xsd:sequence> 
>>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>>                            name="s_poste_item"> 
>>                            <xsd:complexType> 
>>                                <xsd:sequence> 
>>                                    <xsd:element name="s_logonid"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="8"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_societe"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_ensemble"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="2"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_surservice"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_services"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_responsab"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_fonction"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_types"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_nom_prenom"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="20"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                </xsd:sequence> 
>>                            </xsd:complexType> 
>>                        </xsd:element> 
>>                    </xsd:sequence> 
>>                </xsd:complexType> 
>>            </xsd:element> 
>>        </xsd:sequence> 
>>    </xsd:complexType> 
>>    <xsd:element name="example" type="tns:ct"/> 
>></xsd:schema> 
>> 
>> ------------------------------------------------------------ ------------ 
>> 
>>import java.util.Iterator; 
>>import java.io.File; 
>> 
>>import org.eclipse.emf.common.util.URI; 
>>import org.eclipse.emf.ecore.resource.ResourceSet; 
>>import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>>import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>>import org.eclipse.xsd.util.XSDResourceImpl; 
>>import org.eclipse.xsd.XSDDiagnostic; 
>> 
>>public class example 
>>{ 
>>    public static void main(String[] args) 
>>    { 
>>        try 
>>        {         
>>            ResourceSet resourceSet = new ResourceSetImpl(); 
>>    		 
>>             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>>    	    .put("*", new XSDResourceFactoryImpl()); 
>>            resourceSet.getLoadOptions().put( 
>>    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>>     
>>     
>>            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>>    			resourceSet.getResource(URI.createFileURI( 
>>                                new File("example.xsd").getCanonicalFile().toString()),  
>>                                                    true); 
>>             
>>    	xsdMainResource.getSchema().validate(); 
>>     
>>            Iterator diagnostics =  
>>                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>>             
>>            while (diagnostics.hasNext()) 
>>            {             
>>                XSDDiagnostic diagnostic =  
>>                    (XSDDiagnostic) diagnostics.next(); 
>>     
>>                System.out.println("Message: " + diagnostic); 
>>            } 
>>        } 
>>        catch (Exception e) 
>>        { 
>>            System.out.println("Caught this: " + e); 
>>        } 
>>    } 
>>} 
>>   
>> 
>
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #64840 is a reply to message #64818] | 
Wed, 26 October 2005 08:00   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: merks.ca.ibm.com 
 
Paul, 
 
No, you guess correctly. ;-)  Please open a bugzilla and I'll fix it for  
tomorrow's build. 
 
 
Paul Cooper wrote: 
 
> Thanks for the response, I'll be able to code around this in my own  
> logic. However, it turns out that there is another related problem. If  
> I change the testcase below to indicate maxOccurs="4997"  
> minOccurs="4997" then instead of getting the error message the  
> following NPE is thrown: 
> 
> java.lang.NullPointerException 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl$XSDNFA.getDiagnostics(X SDParticl 
> eImpl.java:1780) 
>         at  
>  org.eclipse.xsd.impl.XSDModelGroupImpl.validateRoot(XSDModel GroupImpl 
> ..java:600) 
>         at  
>  org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
> TypeDefinitionImpl.java:1309) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDElementDeclarationImpl.validate(XSDE lementDec 
> larationImpl.java:752) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
> 4) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDModelGroupImpl.validate(XSDModelGrou pImpl.jav 
> a:487) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
> 4) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
> TypeDefinitionImpl.java:1305) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDSchemaImpl.validate(XSDSchemaImpl.ja va:1498) 
>         at example.main(example.java:30) 
> 
> 
> I'm guessing this is not the expected behaviour :-) 
> Paul. 
> 
> 
> Ed Merks wrote: 
> 
>> Paul, 
>> 
>> In order to validate the Unique Particle Attribute rule, the XSD  
>> model builds a finite state machine and that machine can get very  
>> large very quickly.  An <all> content model is the worst example of  
>> this since it will produce n! (factorial) states.  To prevent  
>> disaster (exhausting memory) we limit the size of the machine we will  
>> produce and when that limit is reached we produce the message your  
>> see.  It strikes me that the message should really be a warning and  
>> not an error, since it just means there is a constraint that isn't  
>> being validated, not that the schema is bad... 
>> 
>> 
>> Paul Cooper wrote: 
>> 
>>> I'm having trouble validating what appears to me to be a perfectly  
>>> valid schema. The problem seems to be to do with my minOccurs and  
>>> maxOccurs attributes for an element with complex content. 
>>> 
>>> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
>>> in the subject string above. When they are set to minOccurs=1  
>>> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000  
>>> and maxOccurs=4000 works (but is suprisingly slow). 
>>> 
>>> Is there some fundamental limitation with XSD that I'm missing here? 
>>> 
>>> I've attached the sample XSD and a test program. 
>>> 
>>> Thanks, 
>>> Paul. 
>>> 
>>>  ------------------------------------------------------------ ------------  
>>> 
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?> 
>>> <xsd:schema       targetNamespace="http://www.example.com" 
>>>    xmlns:tns="http://www.example.com"     
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>>>    <xsd:complexType name="ct"> 
>>>        <xsd:sequence> 
>>>            <xsd:element name="sortie"> 
>>>                <xsd:complexType mixed="false"> 
>>>                    <xsd:sequence> 
>>>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>>>                            name="s_poste_item"> 
>>>                            <xsd:complexType> 
>>>                                <xsd:sequence> 
>>>                                    <xsd:element name="s_logonid"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="8"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_societe"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_ensemble"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="2"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_surservice"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_services"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_responsab"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_fonction"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_types"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_nom_prenom"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="20"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                </xsd:sequence> 
>>>                            </xsd:complexType> 
>>>                        </xsd:element> 
>>>                    </xsd:sequence> 
>>>                </xsd:complexType> 
>>>            </xsd:element> 
>>>        </xsd:sequence> 
>>>    </xsd:complexType> 
>>>    <xsd:element name="example" type="tns:ct"/> 
>>> </xsd:schema> 
>>> 
>>>  ------------------------------------------------------------ ------------  
>>> 
>>> 
>>> import java.util.Iterator; 
>>> import java.io.File; 
>>> 
>>> import org.eclipse.emf.common.util.URI; 
>>> import org.eclipse.emf.ecore.resource.ResourceSet; 
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>>> import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>>> import org.eclipse.xsd.util.XSDResourceImpl; 
>>> import org.eclipse.xsd.XSDDiagnostic; 
>>> 
>>> public class example 
>>> { 
>>>    public static void main(String[] args) 
>>>    { 
>>>        try 
>>>        {                   ResourceSet resourceSet = new  
>>> ResourceSetImpl(); 
>>>            
>>>             
>>>  resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>>>            .put("*", new XSDResourceFactoryImpl()); 
>>>            resourceSet.getLoadOptions().put( 
>>>            XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>>>                  XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>>>                resourceSet.getResource(URI.createFileURI( 
>>>                                new  
>>> File("example.xsd").getCanonicalFile().toString()),  
>>>                                                    true); 
>>>                   xsdMainResource.getSchema().validate(); 
>>>               Iterator diagnostics =                     
>>> xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>>>                       while (diagnostics.hasNext()) 
>>>            {                           XSDDiagnostic diagnostic =  
>>>                    (XSDDiagnostic) diagnostics.next(); 
>>>                   System.out.println("Message: " + diagnostic); 
>>>            } 
>>>        } 
>>>        catch (Exception e) 
>>>        { 
>>>            System.out.println("Caught this: " + e); 
>>>        } 
>>>    } 
>>> } 
>>>   
>>> 
>>
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #596982 is a reply to message #64570] | 
Tue, 18 October 2005 12:40   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
This is a multi-part message in MIME format. 
--------------090107000305000802080403 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed 
Content-Transfer-Encoding: 7bit 
 
Paul, 
 
In order to validate the Unique Particle Attribute rule, the XSD model  
builds a finite state machine and that machine can get very large very  
quickly.  An <all> content model is the worst example of this since it  
will produce n! (factorial) states.  To prevent disaster (exhausting  
memory) we limit the size of the machine we will produce and when that  
limit is reached we produce the message your see.  It strikes me that  
the message should really be a warning and not an error, since it just  
means there is a constraint that isn't being validated, not that the  
schema is bad... 
 
 
Paul Cooper wrote: 
 
> I'm having trouble validating what appears to me to be a perfectly  
> valid schema. The problem seems to be to do with my minOccurs and  
> maxOccurs attributes for an element with complex content. 
> 
> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
> in the subject string above. When they are set to minOccurs=1  
> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and  
> maxOccurs=4000 works (but is suprisingly slow). 
> 
> Is there some fundamental limitation with XSD that I'm missing here? 
> 
> I've attached the sample XSD and a test program. 
> 
> Thanks, 
> Paul. 
> 
> ------------------------------------------------------------ ------------ 
> 
><?xml version="1.0" encoding="UTF-8"?> 
><xsd:schema     
>    targetNamespace="http://www.example.com" 
>    xmlns:tns="http://www.example.com"  
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>    <xsd:complexType name="ct"> 
>        <xsd:sequence> 
>            <xsd:element name="sortie"> 
>                <xsd:complexType mixed="false"> 
>                    <xsd:sequence> 
>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>                            name="s_poste_item"> 
>                            <xsd:complexType> 
>                                <xsd:sequence> 
>                                    <xsd:element name="s_logonid"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="8"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_societe"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_ensemble"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="2"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_surservice"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_services"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_responsab"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_fonction"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="3"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_types"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="1"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                    <xsd:element name="s_nom_prenom"> 
>                                    <xsd:simpleType> 
>                                    <xsd:restriction base="xsd:string"> 
>                                    <xsd:maxLength value="20"/> 
>                                    <xsd:whiteSpace value="preserve"/> 
>                                    </xsd:restriction> 
>                                    </xsd:simpleType> 
>                                    </xsd:element> 
>                                </xsd:sequence> 
>                            </xsd:complexType> 
>                        </xsd:element> 
>                    </xsd:sequence> 
>                </xsd:complexType> 
>            </xsd:element> 
>        </xsd:sequence> 
>    </xsd:complexType> 
>    <xsd:element name="example" type="tns:ct"/> 
></xsd:schema> 
> 
> ------------------------------------------------------------ ------------ 
> 
>import java.util.Iterator; 
>import java.io.File; 
> 
>import org.eclipse.emf.common.util.URI; 
>import org.eclipse.emf.ecore.resource.ResourceSet; 
>import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>import org.eclipse.xsd.util.XSDResourceImpl; 
>import org.eclipse.xsd.XSDDiagnostic; 
> 
>public class example 
>{ 
>    public static void main(String[] args) 
>    { 
>        try 
>        {         
>            ResourceSet resourceSet = new ResourceSetImpl(); 
>    		 
>             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>    	    .put("*", new XSDResourceFactoryImpl()); 
>            resourceSet.getLoadOptions().put( 
>    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>     
>     
>            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>    			resourceSet.getResource(URI.createFileURI( 
>                                new File("example.xsd").getCanonicalFile().toString()),  
>                                                    true); 
>             
>    	xsdMainResource.getSchema().validate(); 
>     
>            Iterator diagnostics =  
>                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>             
>            while (diagnostics.hasNext()) 
>            {             
>                XSDDiagnostic diagnostic =  
>                    (XSDDiagnostic) diagnostics.next(); 
>     
>                System.out.println("Message: " + diagnostic); 
>            } 
>        } 
>        catch (Exception e) 
>        { 
>            System.out.println("Caught this: " + e); 
>        } 
>    } 
>} 
>   
> 
 
 
--------------090107000305000802080403 
Content-Type: text/html; charset=ISO-8859-1 
Content-Transfer-Encoding: 7bit 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> 
</head> 
<body bgcolor="#ffffff" text="#000000"> 
Paul,<br> 
<br> 
In order to validate the Unique Particle Attribute rule, the XSD model 
builds a finite state machine and that machine can get very large very 
quickly.  An <all> content model is the worst example of this 
since it will produce n! (factorial) states.  To prevent disaster 
(exhausting memory) we limit the size of the machine we will produce 
and when that limit is reached we produce the message your see.  It 
strikes me that the message should really be a warning and not an 
error, since it just means there is a constraint that isn't being 
validated, not that the schema is bad...<br> 
<br> 
<br> 
Paul Cooper wrote: 
<blockquote cite="middj2b84$45s$1@news.eclipse.org" type="cite">I'm 
having trouble validating what appears to me to be a perfectly valid 
schema. The problem seems to be to do with my minOccurs and maxOccurs 
attributes for an element with complex content. 
  <br> 
  <br> 
When they are set to minOccurs=5000 maxOccurs=5000 I see the message in 
the subject string above. When they are set to minOccurs=1 
maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and 
maxOccurs=4000 works (but is suprisingly slow). 
  <br> 
  <br> 
Is there some fundamental limitation with XSD that I'm missing here? 
  <br> 
  <br> 
I've attached the sample XSD and a test program. 
  <br> 
  <br> 
Thanks, 
  <br> 
Paul. 
  <br> 
  <pre wrap=""> 
<hr size="4" width="90%"> 
<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema     
    targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://www.example.com">"http://www.example.com"</a> 
    xmlns:tns=<a class="moz-txt-link-rfc2396E" href="http://www.example.com">"http://www.example.com"</a>  
    xmlns:xsd=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>> 
    <xsd:complexType name="ct"> 
        <xsd:sequence> 
            <xsd:element name="sortie"> 
                <xsd:complexType mixed="false"> 
                    <xsd:sequence> 
                        <xsd:element maxOccurs="5000" minOccurs="5000" 
                            name="s_poste_item"> 
                            <xsd:complexType> 
                                <xsd:sequence> 
                                    <xsd:element name="s_logonid"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="8"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_societe"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_ensemble"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="2"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_surservice"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_services"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_responsab"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_fonction"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="3"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_types"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="1"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                    <xsd:element name="s_nom_prenom"> 
                                    <xsd:simpleType> 
                                    <xsd:restriction base="xsd:string"> 
                                    <xsd:maxLength value="20"/> 
                                    <xsd:whiteSpace value="preserve"/> 
                                    </xsd:restriction> 
                                    </xsd:simpleType> 
                                    </xsd:element> 
                                </xsd:sequence> 
                            </xsd:complexType> 
                        </xsd:element> 
                    </xsd:sequence> 
                </xsd:complexType> 
            </xsd:element> 
        </xsd:sequence> 
    </xsd:complexType> 
    <xsd:element name="example" type="tns:ct"/> 
</xsd:schema></pre> 
  <pre wrap=""> 
<hr size="4" width="90%"> 
import java.util.Iterator; 
import java.io.File; 
 
import org.eclipse.emf.common.util.URI; 
import org.eclipse.emf.ecore.resource.ResourceSet; 
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
import org.eclipse.xsd.util.XSDResourceImpl; 
import org.eclipse.xsd.XSDDiagnostic; 
 
public class example 
{ 
    public static void main(String[] args) 
    { 
        try 
        {         
            ResourceSet resourceSet = new ResourceSetImpl(); 
    		 
             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
    	    .put("*", new XSDResourceFactoryImpl()); 
            resourceSet.getLoadOptions().put( 
    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
     
     
            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
    			resourceSet.getResource(URI.createFileURI( 
                                new File("example.xsd").getCanonicalFile().toString()),  
                                                    true); 
             
    	xsdMainResource.getSchema().validate(); 
     
            Iterator diagnostics =  
                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
             
            while (diagnostics.hasNext()) 
            {             
                XSDDiagnostic diagnostic =  
                    (XSDDiagnostic) diagnostics.next(); 
     
                System.out.println("Message: " + diagnostic); 
            } 
        } 
        catch (Exception e) 
        { 
            System.out.println("Caught this: " + e); 
        } 
    } 
} 
  </pre> 
</blockquote> 
<br> 
</body> 
</html> 
 
--------------090107000305000802080403--
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #597081 is a reply to message #64595] | 
Wed, 26 October 2005 07:38   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Thanks for the response, I'll be able to code around this in my own  
logic. However, it turns out that there is another related problem. If I  
change the testcase below to indicate maxOccurs="4997" minOccurs="4997"  
then instead of getting the error message the following NPE is thrown: 
 
java.lang.NullPointerException 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl$XSDNFA.getDiagnostics(X SDParticl 
eImpl.java:1780) 
         at  
 org.eclipse.xsd.impl.XSDModelGroupImpl.validateRoot(XSDModel GroupImpl 
..java:600) 
         at  
 org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
TypeDefinitionImpl.java:1309) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDElementDeclarationImpl.validate(XSDE lementDec 
larationImpl.java:752) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
4) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDModelGroupImpl.validate(XSDModelGrou pImpl.jav 
a:487) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
4) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
TypeDefinitionImpl.java:1305) 
         at  
 org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
ponentImpl.java:541) 
         at  
 org.eclipse.xsd.impl.XSDSchemaImpl.validate(XSDSchemaImpl.ja va:1498) 
         at example.main(example.java:30) 
 
 
I'm guessing this is not the expected behaviour :-) 
Paul. 
 
 
Ed Merks wrote: 
 
> Paul, 
>  
> In order to validate the Unique Particle Attribute rule, the XSD model  
> builds a finite state machine and that machine can get very large very  
> quickly.  An <all> content model is the worst example of this since it  
> will produce n! (factorial) states.  To prevent disaster (exhausting  
> memory) we limit the size of the machine we will produce and when that  
> limit is reached we produce the message your see.  It strikes me that  
> the message should really be a warning and not an error, since it just  
> means there is a constraint that isn't being validated, not that the  
> schema is bad... 
>  
>  
> Paul Cooper wrote: 
>  
>> I'm having trouble validating what appears to me to be a perfectly  
>> valid schema. The problem seems to be to do with my minOccurs and  
>> maxOccurs attributes for an element with complex content. 
>> 
>> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
>> in the subject string above. When they are set to minOccurs=1  
>> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000 and  
>> maxOccurs=4000 works (but is suprisingly slow). 
>> 
>> Is there some fundamental limitation with XSD that I'm missing here? 
>> 
>> I've attached the sample XSD and a test program. 
>> 
>> Thanks, 
>> Paul. 
>> 
>> ------------------------------------------------------------ ------------ 
>> 
>><?xml version="1.0" encoding="UTF-8"?> 
>><xsd:schema     
>>    targetNamespace="http://www.example.com" 
>>    xmlns:tns="http://www.example.com"  
>>    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>>    <xsd:complexType name="ct"> 
>>        <xsd:sequence> 
>>            <xsd:element name="sortie"> 
>>                <xsd:complexType mixed="false"> 
>>                    <xsd:sequence> 
>>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>>                            name="s_poste_item"> 
>>                            <xsd:complexType> 
>>                                <xsd:sequence> 
>>                                    <xsd:element name="s_logonid"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="8"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_societe"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_ensemble"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="2"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_surservice"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_services"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_responsab"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_fonction"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="3"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_types"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="1"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                    <xsd:element name="s_nom_prenom"> 
>>                                    <xsd:simpleType> 
>>                                    <xsd:restriction base="xsd:string"> 
>>                                    <xsd:maxLength value="20"/> 
>>                                    <xsd:whiteSpace value="preserve"/> 
>>                                    </xsd:restriction> 
>>                                    </xsd:simpleType> 
>>                                    </xsd:element> 
>>                                </xsd:sequence> 
>>                            </xsd:complexType> 
>>                        </xsd:element> 
>>                    </xsd:sequence> 
>>                </xsd:complexType> 
>>            </xsd:element> 
>>        </xsd:sequence> 
>>    </xsd:complexType> 
>>    <xsd:element name="example" type="tns:ct"/> 
>></xsd:schema> 
>> 
>> ------------------------------------------------------------ ------------ 
>> 
>>import java.util.Iterator; 
>>import java.io.File; 
>> 
>>import org.eclipse.emf.common.util.URI; 
>>import org.eclipse.emf.ecore.resource.ResourceSet; 
>>import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>>import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>>import org.eclipse.xsd.util.XSDResourceImpl; 
>>import org.eclipse.xsd.XSDDiagnostic; 
>> 
>>public class example 
>>{ 
>>    public static void main(String[] args) 
>>    { 
>>        try 
>>        {         
>>            ResourceSet resourceSet = new ResourceSetImpl(); 
>>    		 
>>             resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>>    	    .put("*", new XSDResourceFactoryImpl()); 
>>            resourceSet.getLoadOptions().put( 
>>    		XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>>     
>>     
>>            XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>>    			resourceSet.getResource(URI.createFileURI( 
>>                                new File("example.xsd").getCanonicalFile().toString()),  
>>                                                    true); 
>>             
>>    	xsdMainResource.getSchema().validate(); 
>>     
>>            Iterator diagnostics =  
>>                    xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>>             
>>            while (diagnostics.hasNext()) 
>>            {             
>>                XSDDiagnostic diagnostic =  
>>                    (XSDDiagnostic) diagnostics.next(); 
>>     
>>                System.out.println("Message: " + diagnostic); 
>>            } 
>>        } 
>>        catch (Exception e) 
>>        { 
>>            System.out.println("Caught this: " + e); 
>>        } 
>>    } 
>>} 
>>   
>> 
>
 |  
 |  
  |  
| Re: The content model with 10,006 states is too large [message #597091 is a reply to message #64818] | 
Wed, 26 October 2005 08:00   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Paul, 
 
No, you guess correctly. ;-)  Please open a bugzilla and I'll fix it for  
tomorrow's build. 
 
 
Paul Cooper wrote: 
 
> Thanks for the response, I'll be able to code around this in my own  
> logic. However, it turns out that there is another related problem. If  
> I change the testcase below to indicate maxOccurs="4997"  
> minOccurs="4997" then instead of getting the error message the  
> following NPE is thrown: 
> 
> java.lang.NullPointerException 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl$XSDNFA.getDiagnostics(X SDParticl 
> eImpl.java:1780) 
>         at  
>  org.eclipse.xsd.impl.XSDModelGroupImpl.validateRoot(XSDModel GroupImpl 
> ..java:600) 
>         at  
>  org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
> TypeDefinitionImpl.java:1309) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDElementDeclarationImpl.validate(XSDE lementDec 
> larationImpl.java:752) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
> 4) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDModelGroupImpl.validate(XSDModelGrou pImpl.jav 
> a:487) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDParticleImpl.validate(XSDParticleImp l.java:58 
> 4) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl.validate(X SDComplex 
> TypeDefinitionImpl.java:1305) 
>         at  
>  org.eclipse.xsd.impl.XSDConcreteComponentImpl.validate(XSDCo ncreteCom 
> ponentImpl.java:541) 
>         at  
>  org.eclipse.xsd.impl.XSDSchemaImpl.validate(XSDSchemaImpl.ja va:1498) 
>         at example.main(example.java:30) 
> 
> 
> I'm guessing this is not the expected behaviour :-) 
> Paul. 
> 
> 
> Ed Merks wrote: 
> 
>> Paul, 
>> 
>> In order to validate the Unique Particle Attribute rule, the XSD  
>> model builds a finite state machine and that machine can get very  
>> large very quickly.  An <all> content model is the worst example of  
>> this since it will produce n! (factorial) states.  To prevent  
>> disaster (exhausting memory) we limit the size of the machine we will  
>> produce and when that limit is reached we produce the message your  
>> see.  It strikes me that the message should really be a warning and  
>> not an error, since it just means there is a constraint that isn't  
>> being validated, not that the schema is bad... 
>> 
>> 
>> Paul Cooper wrote: 
>> 
>>> I'm having trouble validating what appears to me to be a perfectly  
>>> valid schema. The problem seems to be to do with my minOccurs and  
>>> maxOccurs attributes for an element with complex content. 
>>> 
>>> When they are set to minOccurs=5000 maxOccurs=5000 I see the message  
>>> in the subject string above. When they are set to minOccurs=1  
>>> maxOccurs=5000 then everything is fine. Similarly, minOccurs=4000  
>>> and maxOccurs=4000 works (but is suprisingly slow). 
>>> 
>>> Is there some fundamental limitation with XSD that I'm missing here? 
>>> 
>>> I've attached the sample XSD and a test program. 
>>> 
>>> Thanks, 
>>> Paul. 
>>> 
>>>  ------------------------------------------------------------ ------------  
>>> 
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?> 
>>> <xsd:schema       targetNamespace="http://www.example.com" 
>>>    xmlns:tns="http://www.example.com"     
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
>>>    <xsd:complexType name="ct"> 
>>>        <xsd:sequence> 
>>>            <xsd:element name="sortie"> 
>>>                <xsd:complexType mixed="false"> 
>>>                    <xsd:sequence> 
>>>                        <xsd:element maxOccurs="5000" minOccurs="5000" 
>>>                            name="s_poste_item"> 
>>>                            <xsd:complexType> 
>>>                                <xsd:sequence> 
>>>                                    <xsd:element name="s_logonid"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="8"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_societe"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_ensemble"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="2"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_surservice"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_services"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_responsab"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_fonction"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="3"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_types"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="1"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                    <xsd:element name="s_nom_prenom"> 
>>>                                    <xsd:simpleType> 
>>>                                    <xsd:restriction base="xsd:string"> 
>>>                                    <xsd:maxLength value="20"/> 
>>>                                    <xsd:whiteSpace value="preserve"/> 
>>>                                    </xsd:restriction> 
>>>                                    </xsd:simpleType> 
>>>                                    </xsd:element> 
>>>                                </xsd:sequence> 
>>>                            </xsd:complexType> 
>>>                        </xsd:element> 
>>>                    </xsd:sequence> 
>>>                </xsd:complexType> 
>>>            </xsd:element> 
>>>        </xsd:sequence> 
>>>    </xsd:complexType> 
>>>    <xsd:element name="example" type="tns:ct"/> 
>>> </xsd:schema> 
>>> 
>>>  ------------------------------------------------------------ ------------  
>>> 
>>> 
>>> import java.util.Iterator; 
>>> import java.io.File; 
>>> 
>>> import org.eclipse.emf.common.util.URI; 
>>> import org.eclipse.emf.ecore.resource.ResourceSet; 
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; 
>>> import org.eclipse.xsd.util.XSDResourceFactoryImpl; 
>>> import org.eclipse.xsd.util.XSDResourceImpl; 
>>> import org.eclipse.xsd.XSDDiagnostic; 
>>> 
>>> public class example 
>>> { 
>>>    public static void main(String[] args) 
>>>    { 
>>>        try 
>>>        {                   ResourceSet resourceSet = new  
>>> ResourceSetImpl(); 
>>>            
>>>             
>>>  resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap() 
>>>            .put("*", new XSDResourceFactoryImpl()); 
>>>            resourceSet.getLoadOptions().put( 
>>>            XSDResourceImpl.XSD_TRACK_LOCATION, Boolean.TRUE); 
>>>                  XSDResourceImpl xsdMainResource = (XSDResourceImpl) 
>>>                resourceSet.getResource(URI.createFileURI( 
>>>                                new  
>>> File("example.xsd").getCanonicalFile().toString()),  
>>>                                                    true); 
>>>                   xsdMainResource.getSchema().validate(); 
>>>               Iterator diagnostics =                     
>>> xsdMainResource.getSchema().getAllDiagnostics().iterator(); 
>>>                       while (diagnostics.hasNext()) 
>>>            {                           XSDDiagnostic diagnostic =  
>>>                    (XSDDiagnostic) diagnostics.next(); 
>>>                   System.out.println("Message: " + diagnostic); 
>>>            } 
>>>        } 
>>>        catch (Exception e) 
>>>        { 
>>>            System.out.println("Caught this: " + e); 
>>>        } 
>>>    } 
>>> } 
>>>   
>>> 
>>
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Mon Nov 03 18:56:01 EST 2025 
 Powered by  FUDForum. Page generated in 0.04458 seconds  
 |