1 16 19 package org.apache.xalan.templates; 20 21 import javax.xml.transform.TransformerException ; 22 23 import org.apache.xalan.transformer.TransformerImpl; 24 import org.apache.xml.serializer.SerializationHandler; 25 import org.xml.sax.SAXException ; 26 27 32 public class ElemTextLiteral extends ElemTemplateElement 33 { 34 35 39 private boolean m_preserveSpace; 40 41 47 public void setPreserveSpace(boolean v) 48 { 49 m_preserveSpace = v; 50 } 51 52 58 public boolean getPreserveSpace() 59 { 60 return m_preserveSpace; 61 } 62 63 67 private char m_ch[]; 68 69 73 private String m_str; 74 75 80 public void setChars(char[] v) 81 { 82 m_ch = v; 83 } 84 85 90 public char[] getChars() 91 { 92 return m_ch; 93 } 94 95 100 public synchronized String getNodeValue() 101 { 102 103 if(null == m_str) 104 { 105 m_str = new String (m_ch); 106 } 107 108 return m_str; 109 } 110 111 112 116 private boolean m_disableOutputEscaping = false; 117 118 138 public void setDisableOutputEscaping(boolean v) 139 { 140 m_disableOutputEscaping = v; 141 } 142 143 163 public boolean getDisableOutputEscaping() 164 { 165 return m_disableOutputEscaping; 166 } 167 168 175 public int getXSLToken() 176 { 177 return Constants.ELEMNAME_TEXTLITERALRESULT; 178 } 179 180 185 public String getNodeName() 186 { 187 return "#Text"; 188 } 189 190 199 public void execute( 200 TransformerImpl transformer) 201 throws TransformerException 202 { 203 try 204 { 205 SerializationHandler rth = transformer.getResultTreeHandler(); 206 if (TransformerImpl.S_DEBUG) { 207 rth.flushPending(); 209 transformer.getTraceManager().fireTraceEvent(this); 210 } 211 212 if (m_disableOutputEscaping) 213 { 214 rth.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); 215 } 216 217 rth.characters(m_ch, 0, m_ch.length); 218 219 if (m_disableOutputEscaping) 220 { 221 rth.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); 222 } 223 } 224 catch(SAXException se) 225 { 226 throw new TransformerException (se); 227 } 228 finally 229 { 230 if (TransformerImpl.S_DEBUG) { 231 try 232 { 233 transformer.getResultTreeHandler().flushPending(); 235 transformer.getTraceManager().fireTraceEndEvent(this); 236 } 237 catch (SAXException se) 238 { 239 throw new TransformerException (se); 240 } 241 } 242 } 243 } 244 } 245 | Popular Tags |