public Configuration parse() {
   if (parsed) {
     throw new BuilderException("Each XMLConfigBuilder can only be used once.");
   }
   parsed = true;
   parseConfiguration(parser.evalNode("/configuration"));
   return (Configuration) configuration;
 }
  // TODO 增加解析方法,原方法不解析相同的resource
  public void parse1() {
    // if (!configuration.isResourceLoaded(resource)) {
    configurationElement(parser.evalNode("/mapper"));
    configuration.addLoadedResource(resource);
    bindMapperForNamespace();
    // }

    parsePendingResultMaps();
    parsePendingChacheRefs();
    parsePendingStatements();
  }
 private void propertiesElement(XNode context) throws Exception {
   if (context != null) {
     Properties defaults = context.getChildrenAsProperties();
     String resource = context.getStringAttribute("resource");
     String url = context.getStringAttribute("url");
     if (resource != null && url != null) {
       throw new BuilderException(
           "The properties element cannot specify both a URL and a resource based property file reference.  Please specify one or the other.");
     }
     if (resource != null) {
       defaults.putAll(Resources.getResourceAsProperties(resource));
     } else if (url != null) {
       defaults.putAll(Resources.getUrlAsProperties(url));
     }
     Properties vars = configuration.getVariables();
     if (vars != null) {
       defaults.putAll(vars);
     }
     parser.setVariables(defaults);
     configuration.setVariables(defaults);
   }
 }