1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.views.xslt;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import org.w3c.dom.Attr;
24 import org.w3c.dom.DOMException;
25 import org.w3c.dom.Element;
26 import org.w3c.dom.Node;
27 import org.w3c.dom.TypeInfo;
28
29 /***
30 * AbstractAdapterElement extends the abstract Node type and implements
31 * the DOM Element interface.
32 */
33 public abstract class AbstractAdapterElement extends AbstractAdapterNode implements Element {
34
35 private Map attributeAdapters;
36
37 public AbstractAdapterElement() { }
38
39 public void setAttribute(String string, String string1) throws DOMException {
40 throw operationNotSupported();
41 }
42
43 protected Map getAttributeAdapters() {
44 if ( attributeAdapters == null )
45 attributeAdapters = buildAttributeAdapters();
46 return attributeAdapters;
47 }
48
49 protected Map buildAttributeAdapters() {
50 return new HashMap();
51 }
52
53 /***
54 * No attributes, return empty attributes if asked.
55 */
56 public String getAttribute(String string) {
57 return "";
58 }
59
60 public void setAttributeNS(String string, String string1, String string2) throws DOMException {
61 throw operationNotSupported();
62 }
63
64 public String getAttributeNS(String string, String string1) {
65 return null;
66 }
67
68 public Attr setAttributeNode(Attr attr) throws DOMException {
69 throw operationNotSupported();
70 }
71
72 public Attr getAttributeNode( String name ) {
73 return (Attr)getAttributes().getNamedItem( name );
74 }
75
76 public Attr setAttributeNodeNS(Attr attr) throws DOMException {
77 throw operationNotSupported();
78 }
79
80 public Attr getAttributeNodeNS(String string, String string1) {
81 throw operationNotSupported();
82 }
83
84 public String getNodeName() {
85 return getTagName();
86 }
87
88 public short getNodeType() {
89 return Node.ELEMENT_NODE;
90 }
91
92 public String getTagName() {
93 return getPropertyName();
94 }
95
96 public boolean hasAttribute(String string) {
97 return false;
98 }
99
100 public boolean hasAttributeNS(String string, String string1) {
101 return false;
102 }
103
104 public boolean hasChildNodes() {
105 return getElementsByTagName("*").getLength() > 0;
106 }
107
108 public void removeAttribute(String string) throws DOMException {
109 throw operationNotSupported();
110 }
111
112 public void removeAttributeNS(String string, String string1) throws DOMException {
113 throw operationNotSupported();
114 }
115
116 public Attr removeAttributeNode(Attr attr) throws DOMException {
117 throw operationNotSupported();
118 }
119
120 public void setIdAttributeNode(Attr attr, boolean b) throws DOMException {
121 throw operationNotSupported();
122 }
123
124 public TypeInfo getSchemaTypeInfo() {
125 throw operationNotSupported();
126 }
127
128 public void setIdAttribute(String string, boolean b) throws DOMException {
129 throw operationNotSupported();
130 }
131
132 public void setIdAttributeNS(String string, String string1, boolean b) throws DOMException {
133 throw operationNotSupported();
134 }
135
136 }
137