XFADocument.java
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.xfa.AppModel
* com.adobe.xfa.Document
* com.adobe.xfa.LogMessenger
* com.adobe.xfa.ModelFactory
* com.adobe.xfa.configuration.ConfigurationModelFactory
* com.adobe.xfa.connectionset.ConnectionSetModelFactory
* com.adobe.xfa.data.DataModelFactory
* com.adobe.xfa.localeset.LocaleSetModelFactory
* com.adobe.xfa.template.TemplateModelFactory
*/
package com.adobe.aemds.guide.addon.dor;
import com.adobe.xfa.AppModel;
import com.adobe.xfa.Document;
import com.adobe.xfa.LogMessenger;
import com.adobe.xfa.ModelFactory;
import com.adobe.xfa.configuration.ConfigurationModelFactory;
import com.adobe.xfa.connectionset.ConnectionSetModelFactory;
import com.adobe.xfa.data.DataModelFactory;
import com.adobe.xfa.localeset.LocaleSetModelFactory;
import com.adobe.xfa.template.TemplateModelFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
public class XFADocument {
public static Document loadXFADocument(byte[] xdp, String encoding) {
if (xdp == null) {
return null;
}
Document document = XFADocument.createXFADocument();
document.load((InputStream)new ByteArrayInputStream(xdp), encoding, false);
return document;
}
public static Document loadXFADocument(byte[] xdp) {
return XFADocument.loadXFADocument(xdp, "UTF-8");
}
public static Document createXFADocument() {
AppModel appModel = new AppModel(null);
appModel.addFactory((ModelFactory)new TemplateModelFactory());
appModel.addFactory((ModelFactory)new DataModelFactory());
appModel.addFactory((ModelFactory)new ConfigurationModelFactory());
appModel.addFactory((ModelFactory)new LocaleSetModelFactory());
appModel.addFactory((ModelFactory)new ConnectionSetModelFactory());
Document document = new Document(appModel);
return document;
}
}