ofXml: fixes warnings + potential crash. Closes 2268