>at main.main(main.java:51)
那一行是什么?你debug一下看你的stacktrace,好像是marshall回xml的时候出的问题
那一行是什么?你debug一下看你的stacktrace,好像是marshall回xml的时候出的问题
解决方案 »
- cascase="all" 但不能级联保存
- 大家进来看看,小问题!
- Axis1.4认证问题!
- struts+spring+hibernate报错:could not initialize proxy - no Session
- 关于tomcat6集群的问题
- 关于struts中的奇怪的错误.高手们.路过帮帮我呀.
- jsp:useBean的问题,高手请进
- 移植jsp+struts网站到linux上的问题,移过去后访问不了数据库mysql
- 急问一个ireport打印的问题???????????????????
- 我在使用eclips的时候遇到了一些问题,请各位指点
- 大家帮忙看看!一个关于J2EE的问题!!在县等待!!
- 请问J2EE的配置错误提示 (急)
import org.exolab.castor.mapping.Mapping;
import org.exolab.castor.mapping.MappingException;import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.Marshaller;import java.io.IOException;
import java.io.FileReader;
import java.io.OutputStreamWriter;import org.xml.sax.InputSource;public class main { public static void main(String args[]) { Mapping mapping = new Mapping(); try {
// 1. Load the mapping information from the file
mapping.loadMapping( "mapping.xml" ); // 2. Unmarshal the data
Unmarshaller unmar = new Unmarshaller(mapping);
MyOrder order = (MyOrder)unmar.unmarshal(new InputSource(new FileReader("order.xml"))); // 3. Do some processing on the data
float total = order.getTotalPrice();
System.out.println("Order total price = " + total);
order.setTotal(total); // 4. marshal the data with the total price back and print the XML in the console
Marshaller marshaller = new Marshaller(new OutputStreamWriter(System.out));
marshaller.setMapping(mapping);
marshaller.marshal(order);//line51
//上面这行有问题,只是不知改怎么改 } catch (Exception e) {
System.out.println(e);
return;
}
}
}
} catch (Exception e) {
e.printStackTrace();
return;
}
例子也是castor-0.9.4.1的doc中的例子