1 package net.myvietnam.mvncore.configuration; 2 3 56 57 import java.io.IOException ; 58 59 import org.xml.sax.SAXException ; 60 61 71 public class BaseConfigurationXMLReader extends ConfigurationXMLReader 72 { 73 74 private Configuration config; 75 76 79 public BaseConfigurationXMLReader() 80 { 81 super(); 82 } 83 84 89 public BaseConfigurationXMLReader(Configuration conf) 90 { 91 this(); 92 setConfiguration(conf); 93 } 94 95 99 public Configuration getConfiguration() 100 { 101 return config; 102 } 103 104 108 public void setConfiguration(Configuration conf) 109 { 110 config = conf; 111 } 112 113 117 public Configuration getParsedConfiguration() 118 { 119 return getConfiguration(); 120 } 121 122 130 protected void processKeys() throws IOException , SAXException 131 { 132 fireElementStart(getRootName(), null); 133 new SAXConverter().process(getConfiguration()); 134 fireElementEnd(getRootName()); 135 } 136 137 143 class SAXConverter extends HierarchicalConfigurationConverter 144 { 145 150 protected void elementStart(String name, Object value) 151 { 152 fireElementStart(name, null); 153 if(value != null) 154 { 155 fireCharacters(value.toString()); 156 } 157 } 158 159 163 protected void elementEnd(String name) 164 { 165 fireElementEnd(name); 166 } 167 } 168 } 169 | Popular Tags |