Brian, Can you send me your sample schema (a complete schema, not just the fragment) and your test case and I can take a look at it in more detail.
Thanks, --Keith "Brian Dillon (ext. 944)" wrote: > > Keith, > > I made sure that I had elementFormDefault="qualified" and then I regenerated > and I still get the same problem. However, to test what you had said I tried > to umarshall a String of > > <Person xmlns="http://www.fineos.com/XMLSchema/ta/garage"> > <oid>PE:3003:34456</oid> > </Person> > > This would work ok. However this is not what is output by Castors own > marhsaller. Is there anyway of changing that ? > > Thanks, > > Brian > > -----Original Message----- > From: Keith Visco [mailto:[EMAIL PROTECTED] > Sent: 03 November 2003 15:37 > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] Marshalled Object Not Unmarshalled correclty > > Hi Brian, > > Since you are using a namespace prefix on the oid element, it may be a > namespace issue. Since the oid element definition is not top-level, then > it does not automatically inherit the targetNamespace. Make sure you > have elementFormDefault="qualified" on the <schema> element. Otherwise > the oid element does not belong to the "ta" namespace. This would > explain why Castor is having trouble matching "ta:oid" with "oid", since > they belong to different namespaces. > > --Keith > > "Brian Dillon (ext. 944)" wrote: > > > > Hi, > > > > This is still a problem for me, it may mean not being able to use the > latest > > version of Castor. For clarity I have re-stated my problem here; > > > > I have a Person which extends BusinessEntity the XSD extracts are; > > > > <xsd:complexType name="Person"> > > <xsd:complexContent> > > <xsd:extension base="ta:BusinessEntity"> > > <xsd:sequence> > > <xsd:element name="dateOfBirth" > > type="xsd:dateTime" minOccurs="0"/> > > <xsd:element name="firstName" > > type="xsd:string" minOccurs="0"/> > > </xsd:sequence> > > </xsd:extension> > > </xsd:complexContent> > > </xsd:complexType> > > > > And > > > > <xsd:complexType name="BusinessEntity" abstract="true"> > > <xsd:sequence> > > <xsd:element name="oid" type="ta:Oid"/> > > </xsd:sequence> > > </xsd:complexType> > > > > If I marshall this (using Castor 0.9.5.2) I get; > > > > <Person xmlns:ta="http://www.fineos.com/XMLSchema/ta" > > xmlns="http://www.fineos.com/XMLSchema/ta/garage"> > > <ta:oid>PE:3003:34456</ta:oid> > > ...other tags > > </Person> > > > > However When I try to unmarshall I get a validation exception; > > > > Error: > > > > > com.fineos.ta.test.driver.OTestCases.XMLToJavaBindingTests.XMLToJavaBindingT > > ests_CastorBusinessEntityValidationException: oid is a required field.; > > > > I have regenerated the classes and they look ok, PersonDescriptor extends > > BusinessEntityDescriptor and the Namespaces look ok. > > > > public class PersonDescriptor extends > > com.fineos.ta.xmlTypes.castor.BusinessEntityDescriptor { > > > > and > > > > public class BusinessEntityDescriptor extends > > org.exolab.castor.xml.util.XMLClassDescriptorImpl { > > > > The generated constructor for PersonDescriptor is; > > > > public PersonDescriptor() { > > super(); > > setExtendsWithoutFlatten(new > > com.fineos.ta.xmlTypes.castor.BusinessEntityDescriptor()); > > nsURI = "http://www.fineos.com/XMLSchema/ta/garage"; > > xmlName = "Person"; > > > > > > and for BusinessEntityDescriptor is; > > > > public BusinessEntityDescriptor() { > > super(); > > nsURI = "http://www.fineos.com/XMLSchema/ta"; > > xmlName = "BusinessEntity"; > > > > > > The definition of the OID is defined in BusinessEntityDescriptor as; > > > > //-- _oid > > desc = new > > > org.exolab.castor.xml.util.XMLFieldDescriptorImpl(com.fineos.ta.xmlTypes.cas > > tor.Oid.class, "_oid", "oid", org.exolab.castor.xml.NodeType.Element); > > > > Anyone got any Ideas ? Has this happened before ? > > > > Thanks for you're help, > > > > Brian > > > > -----Original Message----- > > From: Keith Visco [mailto:[EMAIL PROTECTED] > > Sent: 17 October 2003 20:17 > > To: [EMAIL PROTECTED] > > Subject: Re: [castor-dev] Marshalled Object Not Unmarshalled correclty > > > > Brian, > > > > The class descriptors generated with Castor 0.9.3 may not have been > > generated properly, with the correct namespaces for you instances. You > > might want to try re-generating the source code with Castor 0.9.5.2. > > > > --Keith > > > > "Brian Dillon (ext. 944)" wrote: > > > > > > Hi, > > > > > > Looking into this further it seems that if you unmarshall like; > > > > > > Unmarshaller unmar = new > > > Unmarshaller(com.fineos.ta.test.garage.bo.xmlTypes.castor.Person.class); > > > unmar.setIgnoreExtraElements(true); > > > > > > Where the PersonDescriptor extends BusinessEntityDescriptor then the OID > > > (which is defined in the BusinessEntity) is ignored and therefore we get > a > > > ValidationException like; > > > > > > Error: > > > > > > com.fineos.ta.test.driver.OTestCases.XMLToJavaBindingTests.XMLToJavaBindingT > > > ests_CastorBusinessEntityValidationException: oid is a required field.; > > > > > > > > > If 'unmar.setIgnoreExtraElements(true);' is commented out then we get > the > > > exception'; > > > > > > Error: > > > > > > com.fineos.ta.test.driver.OTestCases.XMLToJavaBindingTests.XMLToJavaBindingT > > > ests_CastorBusinessEntityorg.xml.sax.SAXException: unable to find > > > FieldDescriptor for 'oid' in ClassDescriptor of Person > > > > > > Does anyone know whether there was a bug introduced in version 0.9.5.2 > to > > do > > > with inheritance or is there someting else I should be trying. > > > > > > thanks, > > > > > > Brian > > > -----Original Message----- > > > From: Brian Dillon (ext. 944) [mailto:[EMAIL PROTECTED] > > > Sent: 17 October 2003 14:38 > > > To: [EMAIL PROTECTED] > > > Subject: [castor-dev] Marshalled Object Not Unmarshalled correclty > > > > > > Hi, > > > > > > I have recently (in the past couple of days) moved from Castor 0.9.3.21 > to > > > 0.9.5.2. I am now seeing an issue were an object marhsalled by castor > as; > > > > > > <Person xmlns="http://www.fineos.com/XMLSchema/ta/garage"> > > > <ns1:oid > > > xmlns:ns1="http://www.fineos.com/XMLSchema/ta">PE:3003:34456</ns1:oid> > > > </Person> > > > > > > Where Person extends an Object called BusinessEntity; > > > > > > If I try to unmarshall this as a Person I get a validation exception; > > > > > > Error: > > > > > > com.fineos.ta.test.driver.OTestCases.XMLToJavaBindingTests.XMLToJavaBindingT > > > ests_CastorBusinessEntityValidationException: oid is a required field.; > > > > > > Is there some new issue to do with namespaces (for extended types) and > > > unmarshalling that I should know about ? > > > > > > Thanks, > > > > > > Brian > > > > > > ********************************************************************** > > > The information contained in this e-mail is confidential, may be > > privileged > > > and is intended only for the user of the recipient named above. If you > > are > > > not the intended recipient or a representative of the intended > recipient, > > > you have received this e-mail in error and must not copy, use or > disclose > > > the contents of this e-mail to anybody else. If you have received this > > > e-mail in error, please notify the sender immediately by return e-mail > and > > > permanently delete the copy you received. This e-mail has been swept > for > > > computer viruses. However, you should carry out your own virus checks. > > > Registered in Ireland, No. 205721. http://www.FINEOS.com > > > ********************************************************************** > > > > > > ----------------------------------------------------------- > > > 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 > > > > ----------------------------------------------------------- > > 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 > > > > ----------------------------------------------------------- > > 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 > > ----------------------------------------------------------- > 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
