refactored the code to construct XML from a raw Rexle array format.