DOM.java
2.08 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
55
56
57
58
59
60
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.dom;
import com.adobe.xfa.Document;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.dom.DocumentImpl;
import com.adobe.xfa.dom.ParentNode;
import com.adobe.xfa.dom.XFANodeHolder;
public class DOM {
public static org.w3c.dom.Node attach(Node xfaNode) {
return DOM.attachNode(xfaNode, false);
}
public static org.w3c.dom.Node attach(org.w3c.dom.Document document, Node xfaNode) {
assert (document instanceof DocumentImpl);
DocumentImpl documentImpl = (DocumentImpl)document;
return documentImpl.attach(xfaNode);
}
private static XFANodeHolder attachNode(Node xfaNode, boolean recursive) {
XFANodeHolder result = null;
if (xfaNode instanceof Element.DualDomNode) {
xfaNode = ((Element.DualDomNode)((Object)xfaNode)).getXmlPeer();
}
if (xfaNode instanceof Document) {
Document xfaDoc = (Document)xfaNode;
if (recursive) {
result = new DocumentImpl(xfaDoc);
} else {
Node xfaDocChild;
for (xfaDocChild = xfaDoc.getFirstXMLChild(); xfaDocChild != null && !(xfaDocChild instanceof Element); xfaDocChild = xfaDocChild.getNextXMLSibling()) {
}
if (xfaDocChild == null) {
return null;
}
XFANodeHolder docElement = DOM.attachNode(xfaDocChild, true);
result = docElement.getDocument();
}
} else {
Element xfaParent = XFANodeHolder.getXFAParent(xfaNode);
if (xfaParent == null) {
return null;
}
XFANodeHolder parent = DOM.attachNode(xfaParent, true);
if (parent == null) {
return null;
}
assert (parent instanceof ParentNode);
ParentNode parentNode = (ParentNode)parent;
result = XFANodeHolder.createNode(parentNode, xfaNode);
parentNode.setOnlyChild(result);
}
return result;
}
}