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