Convert to and from xml to javascript object