Add xml support to toArray()