Hey guys, 

I am setting a ns-prefix on my parent element but it is not carrying over to
the child elements. I am setting the configuration in my mapping.xml as such 

<mapping>
<class name="org.test.Container">
        <map-to xml="rls" ns-prefix="rls"/>
        
        <field name="collection1"
            type="org.test.Object1"
            collection="arraylist">
            <bind-xml name="assignment"/>
        </field>
        
        <field name="collection2"
            type="org.test.Object2"
            collection="arraylist">
            <bind-xml name="definition"/>
        </field>
    </class>

    <class name="org.test.Object1" >
       
       <field name="Target"
            type="org.test.ObjectXBean">
            <bind-xml name="Target"/>
        </field>
       ......
        
    </class>
.......
</mapping> 

When castor generates the XML i get the following 

<rls:rls>
<assignment>
<Target>...</Target>
</assignment>
</rls:rls>

I am expecting :

<rls:rls>
<rls:assignment>
<rls:Target>...</rls:Target>
</rls:assignment>
</rls:rls>


Here is the marshalling code: 

            Mapping mapping = new Mapping();
            mapping.loadMapping(getCoreResources().getURL("mapping.xml"));
            // Create XMLContext
            XMLContext xmlContext = new XMLContext();
            xmlContext.setProperty(XMLConfiguration.NAMESPACES, "true");
            xmlContext.addMapping(mapping);

            StringWriter writer = new StringWriter();
            Marshaller marshaller = xmlContext.createMarshaller();
            marshaller.setWriter(writer);
            marshaller.marshal(obj);

Am i missing anything ? 

-- 
View this message in context: 
http://old.nabble.com/ns-prefix-not-applied-on-all-child-elements-tp30219095p30219095.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


Reply via email to