1 5 package com.opensymphony.webwork.views.xslt; 6 7 import org.w3c.dom.DOMException ; 8 import org.w3c.dom.Node ; 9 import org.w3c.dom.Text ; 10 11 12 17 public class SimpleTextNode extends DefaultAdapterNode implements Text , AdapterNode { 18 20 public SimpleTextNode(DOMAdapter rootAdapter, AdapterNode parent, String propertyName, Object value) { 21 super(rootAdapter, parent, propertyName, value); 22 } 23 24 26 public void setData(String string) throws DOMException { 27 throw new RuntimeException ("Operation not supported"); 28 } 29 30 public String getData() throws DOMException { 31 return getStringValue(); 32 } 33 34 public int getLength() { 35 return getStringValue().length(); 36 } 37 38 public String getNodeName() { 39 return "#text"; 40 } 41 42 public short getNodeType() { 43 return Node.TEXT_NODE; 44 } 45 46 public String getNodeValue() throws DOMException { 47 return getStringValue(); 48 } 49 50 public void appendData(String string) throws DOMException { 51 throw new RuntimeException ("Operation not supported"); 52 } 53 54 public void deleteData(int i, int i1) throws DOMException { 55 throw new RuntimeException ("Operation not supported"); 56 } 57 58 public void insertData(int i, String string) throws DOMException { 59 throw new RuntimeException ("Operation not supported"); 60 } 61 62 public void replaceData(int i, int i1, String string) throws DOMException { 63 throw new RuntimeException ("Operation not supported"); 64 } 65 66 public Text splitText(int i) throws DOMException { 67 throw new RuntimeException ("Operation not supported"); 68 } 69 70 public String substringData(int beginIndex, int endIndex) throws DOMException { 71 return getStringValue().substring(beginIndex, endIndex); 72 } 73 74 private String getStringValue() { 75 return getValue().toString(); 76 } 77 } 78 | Popular Tags |