我想知道如何使用castorMap(版本0.9.9.1)来Map它。
<Classifica>
<Livello nome="812">1</Livello>
</Classifica>
我需要的是nome属性的值。
我试过这个:
<class name="it.ClassificaIDT" auto-complete="true">
<map-to xml="Classifica"/>
<field name="livello"
type="it.LivelloIDT"
container="false">
<bind-xml name="Livello"/>
</field>
</class>
<class name="it.LivelloIDT" auto-complete="true">
<map-to xml="Livello"/>
<field name="nome">
<bind-xml name="nome" node="attribute"/>
</field>
</class>
我的班级是:
package it;
public class ClassificaIDT {
private LivelloIDT livello;
public LivelloIDT getLivello() {
return livello;
}
public void setLivello(LivelloIDT livello) {
this.livello = livello;
}
}
上面给出了这个错误:
Caused by: Illegal Text data found as child of: Livello
value: "1"{file: [not available]; line: 42; column: 56}
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:671)
at it.bz.prov.egov.foundation.fascicoloinformatico.service.eprocs.XMLConverter.createOutputForEProcsWebService(XMLConverter.java:121)
... 148 more
Caused by: org.xml.sax.SAXException: Illegal Text data found as child of: Livello
value: "1"
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:889)
如何忽略值“1”?或者更好的是,如何将它Map到类属性?
谢谢您。
1条答案
按热度按时间dba5bblo1#
我找到了解决办法:
Map:
班级:
注意文本字段