To understand what's going on, please have a look the source of this file. Also read ECMAscript for XML