public static XmlConfigurator getInstance(InputStream stream, Boolean validate) throws java.io.IOException { return parse(stream, validate); }
public static XmlConfigurator getInstance(Element el) throws Exception { return parse(el); }
return parse(configElement); } catch (Exception x) { throw new IOException(String.format(Util.getMessage("ParseError"), x.getLocalizedMessage()));
public static XmlConfigurator getInstance(InputStream stream, Boolean validate) throws java.io.IOException { return parse(stream, validate); }
public static XmlConfigurator getInstance(InputStream stream) throws java.io.IOException { return parse(stream); }
public static XmlConfigurator getInstance(Element el) throws java.io.IOException { return parse(el); }
public static XmlConfigurator getInstance(Element el) throws Exception { return parse(el); }
protected static XmlConfigurator parse(InputStream stream) throws java.io.IOException { /** * CAUTION: crappy code ahead ! I (bela) am not an XML expert, so the code below is pretty amateurish... * But it seems to work, and it is executed only on startup, so no perf loss on the critical path. * If somebody wants to improve this, please be my guest. */ try { DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); factory.setValidating(false); //for now DocumentBuilder builder=factory.newDocumentBuilder(); Document document=builder.parse(stream); // The root element of the document should be the "config" element, // but the parser(Element) method checks this so a check is not // needed here. Element configElement = document.getDocumentElement(); return parse(configElement); } catch(Exception x) { if(x instanceof java.io.IOException) throw (java.io.IOException)x; else { IOException tmp=new IOException(); tmp.initCause(x); throw tmp; } } }
return parse(configElement); } catch (Exception x) { throw new IOException(String.format(Util.getMessage("ParseError"), x.getLocalizedMessage()));