improved xml parser algorithm and bug fixed