Fix toQuery() and toXml() not referencing this.obj
Add xml support to toArray()
Merge from master

- Fix toQuery() and toXml() not referencing this.obj
- Add xml support to toArray()