Hello Boss, castor is not that much good as JAXB, You can't everything in castor. if something is making a trouble better move to some other marshalling framework like JAXB, JiBx, XMLBeans...etc
here we wont any support. i sent a lot of email to [email protected] nobody respond properly Actually i didn't any respond from them. i am still waiting for my previous post. Better switch to better framework. Thanks On Tue, May 29, 2012 at 11:32 PM, drowelbuod <[email protected]> wrote: > > Hello. > > I want to marshal an object to an XML with Castor. > > To do so, I used the castor XML conversor to generate the Java classes from > the XSD files. > > When I marshal an object using the generated classes I get an XML. > But there is problem in the XML generated when the xsi:type is required to > reference a subclass, because I don't get the reference to the namespace > defined in the XSD of the subclass. > > So I get: > ... > <bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="getUser"> > ... > > But I would like to obtain something like: > ... > <bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="bn:getUser"> > ... > > Or something like: > ... > <bodyContent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:type="B:getUser"> > ... > > > With this definition of XSD files used: > File A.xsd > ... > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:an="http://www.mydefinition.com/A" > targetNamespace="http://www.mydefinition.com/A" > elementFormDefault="qualified"> > ... > <xsd:complexType name="bodyContentType"/> > ... > > > File B.xsd > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:an="http://www.mydefinition.com/A" > xmlns:bn="http://www.mydefinition.com/B" > targetNamespace="http://www.mydefinition.com/B" > elementFormDefault="qualified"> > <xsd:import namespace="http://www.mydefinition.com/A" > schemaLocation="./A.xsd"/> > ... > <xsd:complexType name="getUser" > > <xsd:complexContent> > <xsd:extension base="an:bodyContentType"> > <xsd:sequence> > <xsd:element name="webExId" > type="xsd:string"/> > </xsd:sequence> > </xsd:extension> > </xsd:complexContent> > </xsd:complexType> > ... > > > The XML conversor of Castor doesn't add the namespace information to > generate it. > > How can force to add this information in the generation? > May be I need change something in the XSD files? > > Thanks in advance. > > -- > View this message in context: > http://old.nabble.com/xsi%3Atype-and-hierarchy-definition-tp33926856p33926856.html > Sent from the Castor - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >

