1 41 42 package org.jfree.data.xml; 43 44 import java.util.Stack ; 45 46 import org.xml.sax.SAXException ; 47 import org.xml.sax.helpers.DefaultHandler ; 48 49 52 public class RootHandler extends DefaultHandler implements DatasetTags { 53 54 55 private Stack subHandlers; 56 57 60 public RootHandler() { 61 this.subHandlers = new Stack (); 62 } 63 64 69 public Stack getSubHandlers() { 70 return this.subHandlers; 71 } 72 73 82 public void characters(char[] ch, int start, int length) 83 throws SAXException { 84 DefaultHandler handler = getCurrentHandler(); 85 if (handler != this) { 86 handler.characters(ch, start, length); 87 } 88 } 89 90 95 public DefaultHandler getCurrentHandler() { 96 DefaultHandler result = this; 97 if (this.subHandlers != null) { 98 if (this.subHandlers.size() > 0) { 99 Object top = this.subHandlers.peek(); 100 if (top != null) { 101 result = (DefaultHandler ) top; 102 } 103 } 104 } 105 return result; 106 } 107 108 113 public void pushSubHandler(DefaultHandler subhandler) { 114 this.subHandlers.push(subhandler); 115 } 116 117 122 public DefaultHandler popSubHandler() { 123 return (DefaultHandler ) this.subHandlers.pop(); 124 } 125 126 } 127 | Popular Tags |