new version using template.

1, fix some bugs;
2, using template to improve every xml parser;