optimization in parsing to XML