1 16 19 package org.apache.xml.serializer; 20 21 import java.io.IOException ; 22 import java.io.OutputStream ; 23 import java.io.Writer ; 24 import java.util.Properties ; 25 26 import org.w3c.dom.Node ; 27 import org.xml.sax.Attributes ; 28 import org.xml.sax.ContentHandler ; 29 import org.xml.sax.Locator ; 30 import org.xml.sax.SAXException ; 31 import org.xml.sax.ext.LexicalHandler ; 32 33 42 public class ToTextSAXHandler extends ToSAXHandler 43 { 44 48 public void endElement(String elemName) throws SAXException 49 { 50 if (m_tracer != null) 51 super.fireEndElem(elemName); 52 } 53 54 57 public void endElement(String arg0, String arg1, String arg2) 58 throws SAXException 59 { 60 if (m_tracer != null) 61 super.fireEndElem(arg2); 62 } 63 64 public ToTextSAXHandler(ContentHandler hdlr, LexicalHandler lex, String encoding) 65 { 66 super(hdlr, lex, encoding); 67 } 68 69 72 public ToTextSAXHandler(ContentHandler handler, String encoding) 73 { 74 super(handler,encoding); 75 } 76 77 public void comment(char ch[], int start, int length) 78 throws org.xml.sax.SAXException 79 { 80 if (m_tracer != null) 81 super.fireCommentEvent(ch, start, length); 82 } 83 84 public void comment(String data) throws org.xml.sax.SAXException 85 { 86 final int length = data.length(); 87 if (length > m_charsBuff.length) 88 { 89 m_charsBuff = new char[length*2 + 1]; 90 } 91 data.getChars(0, length, m_charsBuff, 0); 92 comment(m_charsBuff, 0, length); 93 } 94 95 98 public Properties getOutputFormat() 99 { 100 return null; 101 } 102 103 106 public OutputStream getOutputStream() 107 { 108 return null; 109 } 110 111 114 public Writer getWriter() 115 { 116 return null; 117 } 118 119 124 public void indent(int n) throws SAXException 125 { 126 } 127 128 131 public boolean reset() 132 { 133 return false; 134 } 135 136 139 public void serialize(Node node) throws IOException 140 { 141 } 142 143 146 public boolean setEscaping(boolean escape) 147 { 148 return false; 149 } 150 151 154 public void setIndent(boolean indent) 155 { 156 } 157 158 161 public void setOutputFormat(Properties format) 162 { 163 } 164 165 168 public void setOutputStream(OutputStream output) 169 { 170 } 171 172 175 public void setWriter(Writer writer) 176 { 177 } 178 179 182 public void addAttribute( 183 String uri, 184 String localName, 185 String rawName, 186 String type, 187 String value) 188 { 189 } 190 191 194 public void attributeDecl( 195 String arg0, 196 String arg1, 197 String arg2, 198 String arg3, 199 String arg4) 200 throws SAXException 201 { 202 } 203 204 207 public void elementDecl(String arg0, String arg1) throws SAXException 208 { 209 } 210 211 214 public void externalEntityDecl(String arg0, String arg1, String arg2) 215 throws SAXException 216 { 217 } 218 219 222 public void internalEntityDecl(String arg0, String arg1) 223 throws SAXException 224 { 225 } 226 227 230 public void endPrefixMapping(String arg0) throws SAXException 231 { 232 } 233 234 237 public void ignorableWhitespace(char[] arg0, int arg1, int arg2) 238 throws SAXException 239 { 240 } 241 242 246 public void processingInstruction(String arg0, String arg1) 247 throws SAXException 248 { 249 if (m_tracer != null) 250 super.fireEscapingEvent(arg0, arg1); 251 } 252 253 256 public void setDocumentLocator(Locator arg0) 257 { 258 } 259 260 263 public void skippedEntity(String arg0) throws SAXException 264 { 265 } 266 267 270 public void startElement( 271 String arg0, 272 String arg1, 273 String arg2, 274 Attributes arg3) 275 throws SAXException 276 { 277 flushPending(); 278 super.startElement(arg0, arg1, arg2, arg3); 279 } 280 281 284 public void endCDATA() throws SAXException 285 { 286 } 287 288 291 public void endDTD() throws SAXException 292 { 293 } 294 295 298 public void startCDATA() throws SAXException 299 { 300 } 301 302 303 306 public void startEntity(String arg0) throws SAXException 307 { 308 } 309 310 311 315 public void startElement( 316 String elementNamespaceURI, 317 String elementLocalName, 318 String elementName) throws SAXException 319 { 320 super.startElement(elementNamespaceURI, elementLocalName, elementName); 321 } 322 323 public void startElement( 324 String elementName) throws SAXException 325 { 326 super.startElement(elementName); 327 } 328 329 330 334 public void endDocument() throws SAXException { 335 336 flushPending(); 337 m_saxHandler.endDocument(); 338 339 if (m_tracer != null) 340 super.fireEndDoc(); 341 } 342 343 347 public void characters(String characters) 348 throws SAXException 349 { 350 final int length = characters.length(); 351 if (length > m_charsBuff.length) 352 { 353 m_charsBuff = new char[length*2 + 1]; 354 } 355 characters.getChars(0, length, m_charsBuff, 0); 356 357 m_saxHandler.characters(m_charsBuff, 0, length); 358 359 } 360 363 public void characters(char[] characters, int offset, int length) 364 throws SAXException 365 { 366 367 m_saxHandler.characters(characters, offset, length); 368 369 if (m_tracer != null) 371 super.fireCharEvent(characters, offset, length); 372 } 373 374 377 public void addAttribute(String name, String value) 378 { 379 } 381 382 383 public boolean startPrefixMapping( 384 String prefix, 385 String uri, 386 boolean shouldFlush) 387 throws SAXException 388 { 389 return false; 391 } 392 393 394 public void startPrefixMapping(String prefix, String uri) 395 throws org.xml.sax.SAXException 396 { 397 } 399 400 401 public void namespaceAfterStartElement( 402 final String prefix, 403 final String uri) 404 throws SAXException 405 { 406 } 408 409 } 410 | Popular Tags |