当我尝试使用 Marshal 和 unmarshal 时,我从编译器得到“无法访问 org.exolab.castor.core.exceptions.CastorException”。我使用 Castor 1.3
try {
Writer writer = new FileWriter("out.xml");
Marshaller.marshal(person, writer);
Reader reader = new FileReader("out.xml");
metaType = (Person) Unmarshaller.unmarshal(Person.class, reader);
}catch (MarshalException e) {
} catch (ValidationException e) {
}