Fixed `unchecked` warnings, updated XML to JSON conversion to follow http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html

Two changes were made in this revision:
- Java unchecked warnings were fixed (this is a minor change)
- XML to JSON conversion was made more robust