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