Hi Tim, This bug is on our top-priority list and has been listed in our bugzilla. Unfortunately we don't have enough time right now to look at it but we'll keep you posted. If you decide to help us track down the bug, any help is welcomed. The problem is that the SourceGenerator generates special classes to handle nested groups and the unmarshaller is unable to resolve the class descriptors.
Sorry for the inconvenience, Arnaud > -----Original Message----- > From: Stephenson Tim [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 24, 2002 2:15 PM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Problem in parsing nested elements > (ValidationException) > > hi all, > > i could really use some help to explain this one if you have any ideas. > > I have a schema where one element has 3 nested tags, the first is a > complex > type. I can create objects and marshal them no probs. However the > Unmarshaller consistently tries to create an 'Items' instance for each of > the nested tags and places one tag's value in each. Since all 3 are > mandatory this results in a ValdationException for the missing ones. > > It seems to me that the problem must be in the > UnmarshallerHandler.endElement or otherwise in my original schema (which > is > not mine to change unfortunately). > > TIA, tim > > Email: [EMAIL PROTECTED] > > ********************************************************* > Here is the snippet of schema: > ********************************************************* > <xs:element name="Comment" type="xs:string"/> > <xs:element name="ServiceType" type="xs:string"/> > <xs:element name="Telephone"> > <xs:complexType> > <xs:sequence> > <xs:element ref="Prefix"/> > <xs:element ref="Number"/> > </xs:sequence> > </xs:complexType> > </xs:element> > <xs:element name="TelephoneNumberDetails"> > <xs:complexType> > <xs:sequence maxOccurs="unbounded"> > <xs:element ref="Telephone"/> > <xs:element ref="ServiceType"/> > <xs:element ref="Comment"/> > </xs:sequence> > </xs:complexType> > </xs:element> > ********************************************************* > Here is the exception: > ********************************************************* > Testcase: testReadMessage(au.gov.qld.ia.intf.test.BookingTest):: > FAILED > Telephone is a required field. > junit.framework.AssertionFailedError: Telephone is a required field. > at junit.framework.Assert.fail(Assert.java:51) > at > au.gov.qld.ia.intf.test.BookingTest.testReadMessage(BookingTest.java:313 ) > at java.lang.reflect.Method.invoke(Native Method) > at junit.framework.TestCase.runTest(TestCase.java:166) > at junit.framework.TestCase.runBare(TestCase.java:140) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:131) > at junit.framework.TestSuite.runTest(TestSuite.java:173) > at junit.framework.TestSuite.run(TestSuite.java:168) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe st > Ru > nner.java:231) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT es > tR > unner.java:409) > > ********************************************************* > And here is the debug trace of what i can see after initial debugging > statements: > ********************************************************* > > > CONSTRUCT TELEPHONE DETAILS > > [junit] au.gov.qld.ia.sch.bep.TelephoneNumberDetails.constructor: > 3529412 > [junit] element start:Telephone > > CONSTRUCT FIRST TELEPHONE DETAILS ITEM > > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor2987762 > [junit] au.gov.qld.ia.sch.bep.Telephone.constructor1114115 > [junit] element start:Prefix > [junit] element end:Prefix > [junit] element start:Number > [junit] #characters:0734046971 > [junit] element end:Number > [junit] element end:Telephone > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setTelephone > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setTelephone > > ADD TELEPHONE TO FIRST TELEPHONE DETAILS ITEM > > [junit] ...adding a Telephone: > au.gov.qld.ia.sch.bep.Telephone:_prefix=_number=07340469711114115 to > 2987762 > [junit] ...adding a Telephone: > au.gov.qld.ia.sch.bep.Telephone:_prefix=_number=07340469711114115 to > 2987762 > [junit] element start:ServiceType > > CONSTRUCT 2ND TELEPHONE DETAILS ITEM > > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor2994644 > [junit] #characters:UNKNOWN > [junit] element end:ServiceType > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setServiceType > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setServiceType > [junit] element start:Comment > > CONSTRUCT 3RD TELEPHONE DETAILS ITEM > > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor7722667 > [junit] #characters:Prefix is never used; the full number is provided > in > the Number element > [junit] element end:Comment > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setComment > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setComment > [junit] element start:Telephone > > CONSTRUCT 4TH TELEPHONE DETAILS ITEM > > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor6333039 > [junit] au.gov.qld.ia.sch.bep.Telephone.constructor4737541 > [junit] element start:Prefix > [junit] element end:Prefix > [junit] element start:Number > [junit] #characters:0734046971 > [junit] element end:Number > [junit] element end:Telephone > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setTelephone > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setTelephone > > ADD TELEPHONE TO 4TH TELEPHONE DETAILS ITEM > > [junit] ...adding a Telephone: > au.gov.qld.ia.sch.bep.Telephone:_prefix=_number=07340469714737541 to > 6333039 > [junit] ...adding a Telephone: > au.gov.qld.ia.sch.bep.Telephone:_prefix=_number=07340469714737541 to > 6333039 > [junit] element start:ServiceType > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor7576378 > [junit] #characters:UNKNOWN > [junit] element end:ServiceType > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setServiceType > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setServiceType > [junit] element start:Comment > [junit] > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.constructor5515893 > [junit] #characters:Prefix is never used; the full number is provided > in > the Number element > [junit] element end:Comment > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setComment > [junit] ValidationException: Telephone is a required field.; > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.setComment > [junit] element end:TelephoneNumberDetails > [junit] - location of error: XPATH: > BEP.Contact/Person/TelephoneNumberDetails/TelephoneNumberDetails > [junit] at > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:200) > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.getServiceType > [junit] at > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescr ip > to > rImpl.java:740) > [junit] METHOD_ENTRY: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem.getServiceType > [junit] Validating object: > au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem > [junit] > ...au.gov.qld.ia.sch.bep.TelephoneNumberDetailsItem:_telephone=null, > _serviceType=UNKNOWN, _comment=Prefix is never used; the full number is > provided in the Number element2994644 > [junit] at > org.exolab.castor.xml.Validator.validate(Validator.java:118) > [junit] at > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:221) > [junit] ...Telephone is a required field. > [junit] at > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescr ip > to > rImpl.java:740) > [junit] at > org.exolab.castor.xml.Validator.validate(Validator.java:118) > [junit] at > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:255) > [junit] at > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescr ip > to > rImpl.java:740) > [junit] at > org.exolab.castor.xml.Validator.validate(Validator.java:118) > [junit] at > org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:255) > [junit] at > org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescr ip > to > rImpl.java:740) > [junit] at > org.exolab.castor.xml.Validator.validate(Validator.java:118) > [junit] at > org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java: 47 > 4) > [junit] at > org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392) > [junit] at > org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValid at > or > .java:1550) > [junit] at > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc h( > XM > LDocumentScanner.java:1149) > [junit] at > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan ne > r. > java:381) > [junit] at > org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098) > [junit] at > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338) > [junit] at > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:270) > [junit] at > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:391) > [junit] at > au.gov.qld.ia.intf.test.BookingTest.testReadMessage(BookingTest.java:308 ) > [junit] at java.lang.reflect.Method.invoke(Native Method) > [junit] at junit.framework.TestCase.runTest(TestCase.java:166) > [junit] at junit.framework.TestCase.runBare(TestCase.java:140) > [junit] at > junit.framework.TestResult$1.protect(TestResult.java:106) > [junit] at > junit.framework.TestResult.runProtected(TestResult.java:124) > [junit] at junit.framework.TestResult.run(TestResult.java:109) > [junit] at junit.framework.TestCase.run(TestCase.java:131) > [junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 7.481 sec > [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173) > [junit] at junit.framework.TestSuite.run(TestSuite.java:168) > [junit] at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe st > Ru > nner.java:231) > [junit] at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT es > tR > unner.java:409) > > Total time: 9 seconds > > ----------------------------------------------------------- > 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
