AttrImpl.java
4.32 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.dom;
import com.adobe.xfa.Attribute;
import com.adobe.xfa.Element;
import com.adobe.xfa.dom.ElementImpl;
import com.adobe.xfa.dom.NodeImpl;
import com.adobe.xfa.dom.QNameImpl;
import com.adobe.xfa.ut.StringUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.TypeInfo;
public class AttrImpl
extends NodeImpl
implements Attr {
static final int CHECK_DEFAULT = 1;
static final int CHECK_PREFIX = 2;
private final ElementImpl mOwner;
private final Attribute mXFAAttr;
private QNameImpl mQName;
private final String mValue;
private static final QNameImpl gTemporaryQName = new QNameImpl("");
public Attribute getmXFAAttr() {
return this.mXFAAttr;
}
AttrImpl(ElementImpl owner, Attribute xfaAttr) {
super(owner);
this.mOwner = owner;
this.mXFAAttr = xfaAttr;
this.mValue = this.mXFAAttr.getAttrValue();
}
@Override
public String getLocalName() {
this.populate();
return this.mQName.getLocalName();
}
@Override
public String getName() {
this.populate();
return this.mQName.getQName();
}
@Override
public String getNamespaceURI() {
this.populate();
return this.mQName.getNamespace();
}
@Override
public String getPrefix() {
this.populate();
return this.mQName.getPrefix();
}
@Override
public org.w3c.dom.Element getOwnerElement() {
return this.mOwner;
}
@Override
public TypeInfo getSchemaTypeInfo() {
return null;
}
@Override
public boolean getSpecified() {
return true;
}
@Override
public String getValue() {
return this.mValue;
}
@Override
public boolean isEqualNode(Node other) {
if (this == other) {
return true;
}
if (!(other instanceof AttrImpl)) {
return false;
}
AttrImpl otherAttr = (AttrImpl)other;
if (this.mQName.getLocalName() != otherAttr.mQName.getLocalName() || this.mQName.getNamespace() != otherAttr.mQName.getNamespace()) {
return false;
}
return StringUtils.equalsWithNull(this.mValue, otherAttr.mValue);
}
@Override
public boolean isId() {
return this.mOwner.getXFAElement().getModel().getDocument().isId(this.mOwner.getNamespaceURI(), this.mOwner.getLocalName(), this.mQName.getNamespace() == null ? "" : this.mQName.getNamespace(), this.mQName.getLocalName());
}
@Override
public boolean isSameNode(Node other) {
if (!(other instanceof AttrImpl)) {
return false;
}
AttrImpl otherAttr = (AttrImpl)other;
return this.mXFAAttr == otherAttr.mXFAAttr;
}
@Override
public void setValue(String value) throws DOMException {
throw new DOMException(7, "");
}
@Override
public String getNodeName() {
return this.getName();
}
@Override
public short getNodeType() {
return 2;
}
@Override
public String getNodeValue() throws DOMException {
return this.mValue;
}
final boolean isNamespaceAttr(int checkType) {
String prefix = this.mXFAAttr.getPrefix();
if ((checkType & 2) != 0 && prefix == "xmlns") {
return true;
}
if ((checkType & 1) != 0 && StringUtils.isEmpty(prefix) && this.mXFAAttr.getName() == "xmlns") {
return true;
}
return false;
}
final boolean isPopulated() {
return this.mQName != null;
}
final void populate() {
if (this.mQName == null) {
this.doPopulate();
}
}
private void doPopulate() {
assert (this.mQName == null);
this.mQName = gTemporaryQName;
try {
String localName = this.mXFAAttr.getLocalName();
String prefix = this.mXFAAttr.getPrefix();
String namespaceURI = "";
if (prefix != "xmlns" && localName != "xmlns") {
namespaceURI = this.mOwner.lookupNamespaceURI(StringUtils.isEmpty(prefix) ? null : prefix);
}
this.mQName = new QNameImpl(namespaceURI, prefix, localName);
}
catch (Exception e) {
this.mQName = null;
}
}
}