snaker-core/src/main/java/org/snaker/engine/cfg/Configuration.java
private void parser(String resource) {
		//解析所有配置节点，并实例化class指定的类
		DocumentBuilder documentBuilder = XmlHelper.createDocumentBuilder();
		try {
			if (documentBuilder != null) {
				InputStream input = StreamHelper.openStream(resource);
				if(input == null) return;
				Document doc = documentBuilder.parse(input);
				Element configElement = doc.getDocumentElement();
				NodeList nodeList = configElement.getChildNodes();
				int nodeSize = nodeList.getLength();
				for(int i = 0; i < nodeSize; i++) {
					Node node = nodeList.item(i);
					if (node.getNodeType() == Node.ELEMENT_NODE) {
						Element element = (Element)node;
						String name = element.getAttribute("name");
						String className = element.getAttribute("class");
						String proxy = element.getAttribute("proxy");
						if(StringHelper.isEmpty(name)) {
							name = className;
						}
						if(ServiceContext.exist(name)) {
							log.warn("Duplicate name is:" + name);
							continue;
						}
						Class<?> clazz = ClassHelper.loadClass(className);
						if(TransactionInterceptor.class.isAssignableFrom(clazz)) {
							interceptor = (TransactionInterceptor)ClassHelper.instantiate(clazz);
							ServiceContext.put(name, interceptor);
							continue;
						}
						if(proxy != null && proxy.equalsIgnoreCase("transaction")) {
							txClass.put(name, clazz);
						} else {
							ServiceContext.put(name, clazz);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new SnakerException("资源解析失败，请检查配置文件[" + resource + "]", e.getCause());
		}
	}
private void parser(String resource) {
		//解析所有配置节点，并实例化class指定的类
		DocumentBuilder documentBuilder = XmlHelper.createDocumentBuilder();
		try {
			if (documentBuilder != null) {
				InputStream input = StreamHelper.openStream(resource);
				if(input == null) return;
				Document doc = documentBuilder.parse(input);
				Element configElement = doc.getDocumentElement();
				NodeList nodeList = configElement.getChildNodes();
				int nodeSize = nodeList.getLength();
				for(int i = 0; i < nodeSize; i++) {
					Node node = nodeList.item(i);
					if (node.getNodeType() == Node.ELEMENT_NODE) {
						Element element = (Element)node;
						String name = element.getAttribute("name");
						String className = element.getAttribute("class");
						String proxy = element.getAttribute("proxy");
						if(StringHelper.isEmpty(name)) {
							name = className;
						}
						if(ServiceContext.exist(name)) {
							log.warn("Duplicate name is:" + name);
							continue;
						}
						Class<?> clazz = ClassHelper.loadClass(className);
						if(TransactionInterceptor.class.isAssignableFrom(clazz)) {
							interceptor = (TransactionInterceptor)ClassHelper.instantiate(clazz);
							ServiceContext.put(name, interceptor);
							continue;
						}
						if(proxy != null && proxy.equalsIgnoreCase("transaction")) {
							txClass.put(name, clazz);
						} else {
							ServiceContext.put(name, clazz);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new SnakerException("资源解析失败，请检查配置文件[" + resource + "]", e.getCause());
		}
	}
解析给定resource配置，并注册到ServiceContext上下文中
@param resource 资源