Static analysis for path correctness of XML queries