add xml support and optimize
fix bug