[xsd-users] Code generation fails for schemas with large maxOccurs values

david.r.moss at selex-comms.com david.r.moss at selex-comms.com
Tue May 13 05:42:17 EDT 2008


Hi,

We're working with some third-party schemas that define large (not 
'unbounded') maxOccurs values for sequences. When compiling the schemas, 
no code is generated, although the build step reports no errors. A test 
schema that recreates the problem is as follows:

<?xml version="1.0" ?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
  <xsd:element name="bigList" >
    <xsd:complexType>
     <xsd:sequence>
       <xsd:element name="someItem" type="xsd:string" maxOccurs="9957"/>
     </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

It is compiled for cxx-tree with no additional command line options using 
XSD version 3.0.0.

No code is generated when maxOccurs="9957" or greater and when it's a 
smaller "large" number the code generation takes a very (very) long time. 
I realise that in general this is bad practise as XML validation is slow 
with large bounds as mentioned in this previous post:

http://codesynthesis.com/pipermail/xsd-users/2007-February/000812.html

but surely the code generation should still work - we may well be stuck 
with these schemas. I've also tried the same example with XSD version 
3.1.0 and this time the limit seems to be  when maxOccurs="9949" or 
greater that no code is generated!

Cheers,
Dave.

Dave Moss 
SELEX Communications 
Grange Road 
Christchurch 
Dorset  BH23 4JE 
United Kingdom 
Tel: + 44 (0) 1202 404841 
Email: david.r.moss at selex-comms.com 


------------------------------------------------------------
This email and any attached files contains company confidential information which may be legally privileged. It is intended only for the person(s) or entity to which it is addressed and solely for the purposes set forth therein.  If you are not the intended recipient or have received this email in error please notify the sender by return, delete it from your system and destroy any local copies.  It is strictly forbidden to use the information in this email including any attachment or part thereof including copying, disclosing, distributing, amending or using for any other purpose.

In addition the sender excludes all liabilities (whether tortious or common law) for damage or breach arising or related to this email including but not limited to viruses and libel.
SELEX Communications Limited is a Private Limited Company registered in England and Wales under Company Number 964533 and whose Registered Office is Marconi House, New Street, CHELMSFORD, Essex. CM1 1PL. England.



More information about the xsd-users mailing list