刚用Castor,一段Spring的配置如下
。。。。。//在ContentNegotiatingViewResolver中 <bean class="org.springframework.web.servlet.view.xml.MarshallingView" > <property name="marshaller"> <ref bean="castorMarshaller"/> </property> </bean> </list> </property> </bean> <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" > <property name="mappingLocation" value="classpath:castormapping.xml" /> </bean>
三个问题:1 怎么在castormapping.xml中设置list的mapping?如果不设置,默认的tag是array-list。
2 我在castormapping.xml中<class>里设置<map-to xml="dev" /> ,出来后会是
<dev xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst... xsi:type="dev">
怎么才能把xmlns:xsi,xsi:type去掉?
3我用chrome测试,会有提示Resource interpreted as Document but transferred with MIME type application/xml.这是什么情况?
昨天看了下Castor的解决方案。对如List的问题,官方给出的方法是新建个类,包上list
例如
在 mapping.xml中
这样第2个问题也消失了,只有marshall默认的list的时候才会出现一堆xsi:= =
不过第三个问题还是存在 - -