move lxml.etree import outside of function
add xpath validation to filter xpath
Merge pull request #1242 from dimagi/xpath-validation

Filter xpath validation