mimic a js dom using jdom