以下代码不起作用。运行这些行时出现异常[Object objPoints = serializer.read(Point.class, file);] 详细来说,源附件不包含 Persister.class 的源。
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import java.io.File;
Serializer serializer = new Persister();
File file = new File("1.xml");
Object objPoints = serializer.read(Point.class, file);
点等级如下:
@Root
public class Point {
@Element
private float X;
@Element
private float Y;
}
我从此链接引用。