Hello, I have not found anything in the archives that directly addresses this particular behavior. I'm testing the unmarshal operation in code generated by sourceGenerator.
Issue: when a xsd:group is included in a sequence, at least one of that group's elements must be present in the instance file, regardless of whether all the elements have a minOccurrs="0" attribute, and regardless of whether the group's sequence element has a minOccurs="0" attributes. Leaving aside the issue of whether there are better ways to design a schema... this appears to be valid schema syntax, (... xmlspy 2004 validates the instance, using its default parser). I'm moving on after spending some time debugging this, but I thought I'd make a note of it. Thanks, Rich Trevor ##### the message on the MarshallException ### -error-if-this-is-used- is a required field. ##### this instance causes the MarshallException ##### <?xml version="1.0" encoding="UTF-8"?> <test xmlns="http://www.foo.org/foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.foo.org/foo C:\tmp\test.xsd"> <a>A</a> <b>B</b> </test> ##### this instance unmarshalls without error ##### <?xml version="1.0" encoding="UTF-8"?> <test xmlns="http://www.foo.org/foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.foo.org/foo C:\tmp\test.xsd"> <a>A</a> <b>B</b> <c>C</c> </test> ##### schema file: test.xsd ############# <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://www.foo.org/foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.foo.org/foo" elementFormDefault="qualified"> <xsd:element name="test" type="TestType"/> <xsd:complexType name="TestType"> <xsd:sequence> <xsd:group ref="RequiredElementGroup"/> <xsd:group ref="OptionalElementGroup"/> </xsd:sequence> </xsd:complexType> <xsd:group name="RequiredElementGroup"> <xsd:sequence> <xsd:element name="a" type="xsd:string"/> <xsd:element name="b" type="xsd:string"/> </xsd:sequence> </xsd:group> <xsd:group name="OptionalElementGroup"> <xsd:sequence> <xsd:element name="c" type="xsd:string" minOccurs="0"/> <xsd:element name="d" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:group> </xsd:schema> ########## unit test code ##########3 public void testUnmarshal() throws MarshalException, ValidationException { Test t = null; try { t = (Test)Test.unmarshal(new FileReader(TEST_FNAME)); } catch (FileNotFoundException ex) { fail("File not Found: " + TEST_FNAME); } catch (ValidationException ex) { fail("ValidationException: " + ex.getMessage()); } catch (MarshalException ex) { fail("MarshalException: " + ex.getMessage()); } } ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
