Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 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 #596967] Tue, 18 October 2005 04:22
Paul Cooper is currently offline Paul Cooper
Messages: 11
Registered: July 2009
Junior Member
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--
Previous Topic:How to print logical view of schema?
Next Topic:problems loading xml schema with targetNamespace
Goto Forum:
  


Current Time: Wed Aug 20 10:39:59 EDT 2014

Powered by FUDForum. Page generated in 0.01675 seconds