changed arrayToXml method to protected