Hi, I'm having difficulty getting default namespaces to be generated properly in an output XML file for lists created using a container="false" field.
Basically, I'm trying to generate XML like the following: <?xml version="1.0" encoding="UTF-8"?> <ServiceResponse xmlns="http://www.globallink.com/v1/service"> <items> <item><id>1</id></item> <item><id>1</id></item> </items> </ServiceResponse> I've tried creating a mapping file where either I specify the mapping only at the top level, or for each class. My problem is that I can't get the "items" list above (created by a container="false" field) to go into a proper namespace. The closest I can currently get is: <?xml version="1.0" encoding="UTF-8"?> <ServiceResponse xmlns="http://www.globallink.com/v1/service"> <items xmlns=""> <item><id>1</id></item> <item><id>1</id></item> </items> </ServiceResponse> Here is my mapping file: <?xml version="1.0" encoding="UTF-8"?> <mapping> <class name="com. globallink.data.ServiceResponse"> <map-to xml="ServiceResponse" ns-uri="http://www.globallink.com/v1/service" element-definition="false" /> <field name="items" type="com.globallink.data.Item" container="false" collection="array"> <bind-xml name="items"/> </field> </class> <class name="com.globallink.data.Item"> <map-to xml="item" /> <field name="id" type="string"> <bind-xml name="id"/> </field> </class> </mapping> And my java code: StringWriter writer = new StringWriter(); ServiceResponse response = new ServiceResponse (); Item[] items = new Item[2]; Item item; item = new Item(); item.setId("1"); items [0] = item; item = new Item (); item.setId("2"); items [1] = item; response.setItems(items); try { Mapping mapping = new Mapping(); mapping.loadMapping("castor.xml"); Marshaller marshaller = new Marshaller(writer); marshaller.setMapping(mapping); marshaller.marshal(response); System.out.println(writer.getBuffer().toString()); } catch (Exception e) { e.printStackTrace(); } } Any suggestions? Thanks, Gregg --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

