Hi Kevin,

Unfortunately, I still have the xmlns in my fields with your settings.
Which Version of Castor are you using? (Although I already tried different Versions...)

Thanks,
Chakrit



Am 26.01.2012 08:45, schrieb Kilroy, Kevin:
Hi,

I use it in the way you want. My mapping files look the same as you have, maybe 
there is a property in my CastorMarshaller that achieves this:

<!-- Responsible for marshalling&  un-marshalling of XML into pojos. -->        
                                      
<bean id="castorMarshaller" 
class="org.springframework.oxm.castor.CastorMarshaller">
        <property name="mappingLocations">
                <array>
                        <value>${castor.mapping.path}</value>
                        <value>${castor.mapping.ws.shared.path}</value>
                </array>
        </property>
       <property name="ignoreExtraElements" value="true" />
       <property name="ignoreExtraAttributes" value="true" />
        <property name="suppressXsiType" value="true" />
</bean>

Hope this helps,

Kevin.


-----Original Message-----
From: crushcha [mailto:[email protected]]
Sent: 25 January 2012 20:00
To: [email protected]
Subject: [castor-user] [XML] specify namespace for class but not for fields

Hi all

I'm working with Spring WS and CastorMarshaller with a mapping file.
For a XML request to a webservice, I need to specify the namespace for the 
class, but not for its fields (i.e. namespace must be empty for fields).An 
example of what I'm doing follows:

mapping.xml:
<mapping>
<class name="some.package.className">
<map-to xml="className" ns-uri="theNamespace" />  <field name="field" type="string">  <bind-xml name="field" 
node="element"/>  </field>  </class>  </mapping>

generated XML:
<className xmlns="theNamespace">
<field xmlns="theNamespace">value</field>
</className>

desired XML:
<className xmlns="theNamespace">
<field>value</field>
</className>

(I omitted surrounding soap envelope, header, body in XMLs)

Thanks in advance for any help!

Reply via email to