Hi Tomasz,

This was also reported over on the forums:

http://castor.exolab.org/phpBB2/viewtopic.php?t=263

Though I was unable to reproduce the problem myself.

The user on the forums reported the problem when using a mapping file. So I tried to reproduce that, as you can see from the forum message, but was unable to.

Since you're reporting the issue with Castor generated source code,
I also tried to reproduce it using the following schema:


<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="foo" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>


</xsd:schema>

And the following xml instances:

valid-input.xml

<?xml version="1.0"?>
<root>
   <foo>Some foo data</foo>
</root>

invalid-input.xml

<?xml version="1.0"?>
<root>
   <!-- intentionally removed foo element -->
</root>

Castor definately complains when I try to unmarshal the invalid-input.xml

I also tried generating the sources with 0.9.5.3 and then unmarshalling with 0.9.5.4, but Castor still reports the error.

Since I do believe there is a problem somewhere, as you are not the only one who has experienced this, but I can't seem to reproduce it.

If you have a chance, perhaps you can modify the above schema to look more like the one you are using and see if it causes the problem or not. I'd like to be able to reproduce this so I can fix the problem.

Thanks,

--Keith




Tomasz Piontek wrote:

Hi,

I tried to use 0.9.5.4rc and it seems that it doesn't check constraints connected with required number of elements.
According to my XML-schema environment has to have at least ONE variable.


<environment>
   <variable name="PATH">/bin</variable>
</environment>

but in case

<environment>
</environment>

0.9.5.4 doesn't complain about the lack of variables.

with 0.9.5.3 the error message is:
ValidationException: A minimum of 1 _variableList object(s) (whose xml name is 'variable') are required for class: grms.types.jobdesc.Environment;
- location of error: XPATH: environment


The code was generated by SourceGenerator coming from 0.9.5.3 or 0.9.5 (i don't remember). The only thing I did was to replace castor jar 0.9.5.3 with 0.9.5.4rc

I found this searching for a cause of another error, but this I will describe in separated mail (I need more time for testing). The problem I got is not related to "rc" version.

All the best,
Tomek



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev





----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to