Javascript code for parsing and using XDI