Add optional filter parameter for filtering

* Allows early filtering to speed up parsing and only include nodes
of certain names.
* NOTE: Doesn't work with headless files. Headless files will be included
despite filter.