Implement xml parsing constructor.