store document elements in array