Is there a way to use DOM methods such as getElementById("id")
or getElementsByTagName("tag")
on a file that is selected by the user?
My program has the user select a set of HTML files that are formatted in a specific way that is somewhat difficult to search through when treated like one big string, but would be very easy if I could use DOM methods.
I am currently using the HTML5 File API to get a FileList
and a FileReader
object to parse the files and create strings.
Is using DOM methods possible, or alternatively, is there a better way to parse selected HTML files? A library like JSoup would be helpful, is there something similar in JavaScript?