// Path: src/main/java/cn/zxl/xxoo/annotation/DateAnnotationHandler.java
// public class DateAnnotationHandler {
// 
// 	/**
// 	 * 处理构建xml过程中的注解
// 	 * @param field field
// 	 * @param fieldValue fieldValue
// 	 * @return String
// 	 */
// 	public static String handle(final Field field,final Object fieldValue){
// 		if (field.getType() != Date.class) {
// 			return fieldValue.toString();
// 		}
// 		Annotation annotation = Annotations.getAnnotation(field, ADate.class);
// 		if (annotation != null && annotation instanceof ADate) {
// 			ADate dateAnnotation = (ADate) annotation;
// 		    String format = dateAnnotation.format();
// 			if (format != null) {
// 				return new SimpleDateFormat(format).format((Date)fieldValue);
// 			}
// 		}
// 		return fieldValue.toString();
// 	}
// 	
// 	/**
// 	 * 处理解析xml过程中的注解
// 	 * @param field field
// 	 * @param fieldValue fieldValue
// 	 * @return Date
// 	 * @throws ParseException 解析日期字符串异常
// 	 */
// 	public static Date handle(final Field field,final String fieldValue) throws ParseException{
// 		if (field.getType() != Date.class) {
// 			return new SimpleDateFormat().parse(fieldValue);
// 		}
// 		Annotation annotation = Annotations.getAnnotation(field, ADate.class);
// 		if (annotation != null && annotation instanceof ADate) {
// 			ADate dateAnnotation = (ADate) annotation;
// 		    String format = dateAnnotation.format();
// 			if (format != null) {
// 				return new SimpleDateFormat(format).parse(fieldValue);
// 			}
// 		}
// 		return XmlProcessor.DEFAULT_DATE_FORMAT.parse(fieldValue);
// 	}
// }


import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import cn.zxl.xxoo.annotation.DateAnnotationHandler;
import cn.zxl.xxoo.exception.XmlParseException;
import cn.zxl.xxoo.utils.Commons;
import cn.zxl.xxoo.utils.Reflects;


	private <T> T parseRecursion(Class<T> clazz,Node root) throws IllegalArgumentException, IllegalAccessException, InstantiationException, ParseException, SecurityException, NoSuchMethodException, InvocationTargetException{
		if (Commons.isNull(clazz) || !Reflects.isComplexType(clazz)) {
			return null;
		}
		T object = (T) Reflects.getInstance(clazz);
		if (!Reflects.hasField(clazz)) {
			return object;
		}
		NodeList nodeList = root.getChildNodes();
        for (int i = 0 ; i < nodeList.getLength() ; i++) {
        	Node node = nodeList.item(i);
        	if (node.getNodeType() != Node.ELEMENT_NODE) {
				continue;
			}
        	String nodeName = node.getNodeName();
        	String nodeValue = node.getTextContent();
        	if (nodeName == null || nodeValue == null) {
				continue;
			}
			Field field = null;
			try {
				field = clazz.getDeclaredField(nodeName);
			}catch (NoSuchFieldException e) {
				continue;
			}
			field.setAccessible(true);
			if (!Reflects.isComplexType(field.getType()) && nodeValue.trim().length() > 0 ) {
				Constructor constructor = field.getType().getConstructor(String.class);
				if (Date.class.isAssignableFrom(field.getType())) {

// Path: src/main/java/cn/zxl/xxoo/annotation/DateAnnotationHandler.java
// public class DateAnnotationHandler {
// 
// 	/**
// 	 * 处理构建xml过程中的注解
// 	 * @param field field
// 	 * @param fieldValue fieldValue
// 	 * @return String
// 	 */
// 	public static String handle(final Field field,final Object fieldValue){
// 		if (field.getType() != Date.class) {
// 			return fieldValue.toString();
// 		}
// 		Annotation annotation = Annotations.getAnnotation(field, ADate.class);
// 		if (annotation != null && annotation instanceof ADate) {
// 			ADate dateAnnotation = (ADate) annotation;
// 		    String format = dateAnnotation.format();
// 			if (format != null) {
// 				return new SimpleDateFormat(format).format((Date)fieldValue);
// 			}
// 		}
// 		return fieldValue.toString();
// 	}
// 	
// 	/**
// 	 * 处理解析xml过程中的注解
// 	 * @param field field
// 	 * @param fieldValue fieldValue
// 	 * @return Date
// 	 * @throws ParseException 解析日期字符串异常
// 	 */
// 	public static Date handle(final Field field,final String fieldValue) throws ParseException{
// 		if (field.getType() != Date.class) {
// 			return new SimpleDateFormat().parse(fieldValue);
// 		}
// 		Annotation annotation = Annotations.getAnnotation(field, ADate.class);
// 		if (annotation != null && annotation instanceof ADate) {
// 			ADate dateAnnotation = (ADate) annotation;
// 		    String format = dateAnnotation.format();
// 			if (format != null) {
// 				return new SimpleDateFormat(format).parse(fieldValue);
// 			}
// 		}
// 		return XmlProcessor.DEFAULT_DATE_FORMAT.parse(fieldValue);
// 	}
// }


// Path: src/main/java/cn/zxl/xxoo/support/DomConfigurableXmlParser.java
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import cn.zxl.xxoo.annotation.DateAnnotationHandler;
import cn.zxl.xxoo.exception.XmlParseException;
import cn.zxl.xxoo.utils.Commons;
import cn.zxl.xxoo.utils.Reflects;


	private <T> T parseRecursion(Class<T> clazz,Node root) throws IllegalArgumentException, IllegalAccessException, InstantiationException, ParseException, SecurityException, NoSuchMethodException, InvocationTargetException{
		if (Commons.isNull(clazz) || !Reflects.isComplexType(clazz)) {
			return null;
		}
		T object = (T) Reflects.getInstance(clazz);
		if (!Reflects.hasField(clazz)) {
			return object;
		}
		NodeList nodeList = root.getChildNodes();
        for (int i = 0 ; i < nodeList.getLength() ; i++) {
        	Node node = nodeList.item(i);
        	if (node.getNodeType() != Node.ELEMENT_NODE) {
				continue;
			}
        	String nodeName = node.getNodeName();
        	String nodeValue = node.getTextContent();
        	if (nodeName == null || nodeValue == null) {
				continue;
			}
			Field field = null;
			try {
				field = clazz.getDeclaredField(nodeName);
			}catch (NoSuchFieldException e) {
				continue;
			}
			field.setAccessible(true);
			if (!Reflects.isComplexType(field.getType()) && nodeValue.trim().length() > 0 ) {
				Constructor constructor = field.getType().getConstructor(String.class);
				if (Date.class.isAssignableFrom(field.getType())) {

					field.set(object, DateAnnotationHandler.handle(field, nodeValue));
