Refactor HCParser to do all XML creation at the same time

Change-Id: I00aa75009fc0850254b37178bffb4b89ba220c0e