Log.error(e);
}
}
public static SketchDocument load(InputStream in, File file, String fileName, ZipFile zipFile) throws Exception {
Doc doc = XMLParser.parse(in);
if(file != null) {
doc.setBaseURI(file.toURI());
}
SketchDocument sdoc = new SketchDocument();
sdoc.removePage(sdoc.getCurrentPage());
int version = Integer.parseInt(doc.xpathString("/sketchy/@version"));
Log.info("version = ",version);
if(version < NativeExport.CURRENT_VERSION) {
doc = upgradeDocument(doc);
}
loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"width");
loadNumberAttribute(doc.xpathElement("/sketchy/info"),sdoc,"height");
for(Elem e : doc.xpath("/sketchy/page")) {
loadPage(sdoc,e,zipFile);
}
String type = doc.xpathString("/sketchy/info/@type");
if("presentation".equals(type)) {
sdoc.setPresentation(true);
}
Elem info = doc.xpathElement("/sketchy/info");
if(info != null) {
loadBooleanAttribute(info,sdoc,"gridActive");
loadBooleanAttribute(info,sdoc,"pagesVisible");
if(info.hasAttr("backgroundFill")) {
sdoc.setBackgroundFill(loadFillPaint(info, "backgroundFill", zipFile));