1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts2.views.xslt;
22
23 import org.apache.struts2.StrutsException;
24 import org.w3c.dom.DOMException;
25 import org.w3c.dom.Node;
26 import org.w3c.dom.Text;
27
28
29 /***
30 *
31 */
32 public class SimpleTextNode extends AbstractAdapterNode implements Node, Text {
33
34 public SimpleTextNode(AdapterFactory rootAdapterFactory, AdapterNode parent, String propertyName, Object value) {
35 setContext(rootAdapterFactory, parent, propertyName, value);
36 }
37
38 protected String getStringValue() {
39 return getPropertyValue().toString();
40 }
41
42 public void setData(String string) throws DOMException {
43 throw new StrutsException("Operation not supported");
44 }
45
46 public String getData() throws DOMException {
47 return getStringValue();
48 }
49
50 public int getLength() {
51 return getStringValue().length();
52 }
53
54 public String getNodeName() {
55 return "#text";
56 }
57
58 public short getNodeType() {
59 return Node.TEXT_NODE;
60 }
61
62 public String getNodeValue() throws DOMException {
63 return getStringValue();
64 }
65
66 public void appendData(String string) throws DOMException {
67 throw new StrutsException("Operation not supported");
68 }
69
70 public void deleteData(int i, int i1) throws DOMException {
71 throw new StrutsException("Operation not supported");
72 }
73
74 public void insertData(int i, String string) throws DOMException {
75 throw new StrutsException("Operation not supported");
76 }
77
78 public void replaceData(int i, int i1, String string) throws DOMException {
79 throw new StrutsException("Operation not supported");
80 }
81
82 public Text splitText(int i) throws DOMException {
83 throw new StrutsException("Operation not supported");
84 }
85
86 public String substringData(int beginIndex, int endIndex) throws DOMException {
87 return getStringValue().substring(beginIndex, endIndex);
88 }
89
90
91
92 public boolean isElementContentWhitespace() {
93 throw operationNotSupported();
94 }
95
96 public String getWholeText() {
97 throw operationNotSupported();
98 }
99
100 public Text replaceWholeText(String string) throws DOMException {
101 throw operationNotSupported();
102 }
103
104
105 }