Hi Werner, We have about 600 classes that we currently expose via EJBs and we want to expose some of these services to non-Java clients. We don't want to have to regenerate another 600 classes and populate these or change the existing EJB clients to use the new set of classes (especially since we don't control the clients). Is that a decent reason? As an aside, if we did go with the schema first approach, do you have an FAQ or something that explains why one would use Castor for this scenario instead of JAXB?
Thanks, Josh ----- Original Message ---- From: Werner Guttmann <[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, June 7, 2007 3:58:36 PM Subject: Re: [castor-user] Castor namespace help when using multiple schemas Before I reply to this, let me just ask why you don't generate Java classes from an (existing?) XML schema, and switch away from a mapping file based approach ? Werner Josh Foure wrote: > Hi all, > I am trying to use Castor 1.0M4 as my binding framework inside of XFire > 1.2.6 but I am running into a namespace problem. I can reproduce the > problem using Castor 1.1 which is what I will describe now. I have a > Castor mapping file that defines the mapping for a class "order.Order" > in the "http://order <http://order/>"; namespace. This order has an > orderNumber and 2 names. The names are of type "common.Name" which is > in the "http://common <http://common/>"; namespace. The mapping file > looks as follows: > > <?xml version="1.0" encoding="UTF-8"?> > <mapping> > <class name="order.Order"> > <map-to xml="order" ns-uri="http://order <http://order/>"; > ns-prefix="order"/> > <field name="orderNumber" type="integer"> > <bind-xml name="order-number" node="element"/> > </field> > <field name="sellerName" type="common.Name"> > <bind-xml name="seller-name" node="element"/> > </field> > <field name="buyerName" type="common.Name"> > <bind-xml name="buyer-name" node="element"/> > </field> > </class> > <class name="common.Name"> > <map-to xml="name" ns-uri="http://common <http://common/>"; > ns-prefix="common"/> > <field name="firstName" type="java.lang.String"> > <bind-xml name="first-name" node="element"/> > </field> > <field name="lastName" type="java.lang.String"> > <bind-xml name="last-name" node="element"/> > </field> > </class> > </mapping> > > When I create an instance of Order and pass in an orderNumber and 2 > names, Castor generates the following XML: > > <?xml version="1.0" encoding="UTF-8"?> > <order:order xmlns:order="http://order <http://order/>";> > <order:order-number>1234</order:order-number> > <common:seller-name xmlns:common="http://common <http://common/>";> > <common:first-name>Bob</common:first-name> > <common:last-name>Smith</common:last-name> > </common:seller-name> > <common:buyer-name xmlns:common="http://common <http://common/>";> > <common:first-name>Fred</common:first-name> > <common:last-name>Peterson</common:last-name> > </common:buyer-name> > </order:order> > > The problem is that I cannot generate an XML schema for this (I want a > schema for my common types and another for the order). If my > seller-name and buyer-name complex types use the "type" attribute to > specify my common Name type, then the namespace of seller-name and > buyer-name should be "order" and not "common". If my complex types use > the "ref" attribute to point to a Name element in my common schema, then > I cannot change the name of the element from "name" to "buyer-name" and > "seller-name". Please let me know if I am missing something and there > is a way to have Castor generate XML in such a way that I can break out > the schemas. > > I am happy to reply back with the schema I would like to use but I did > not want to clutter up this initial email. > Thank you, > Josh > > ------------------------------------------------------------------------ > Park yourself in front of a world of choices in alternative vehicles. > Visit the Yahoo! Auto Green Center. > <http://us.rd.yahoo.com/evt=48246/*http://autos.yahoo.com/green_center/;_ylc=X3oDMTE5cDF2bXZzBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDZ3JlZW4tY2VudGVy> --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email ____________________________________________________________________________________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/

