Hi all, I have the following code [1] that I expect to raise a xml parser exception but it raises a typecast exception [2]. Instead I get the expected exception [3] when substituting the call to local:h with direct parse -xml() (as for the snippet in the comment). Any clue? Thanks, Marco. [1] declare function local:f($rdf as node()){ $rdf }; declare function local:h(){ parse-xml("xxx") }; declare function local:g(){ let $rdf := local:h() (: parse-xml("xxx") :) let $validate := local:f($rdf) (:$rdf:) return ($validate) }; local:g() [2] Stopped at /home/lettere/tmp/basex80/basex/file, 2/18: [XPTY0004] Cannot cast from empty-sequence() to node(). [3] Stopped at /home/lettere/tmp/basex80/basex/file, 11/26: [FODC0006] SAX: "file:/home/lettere/tmp/basex80/basex/file" (Line 1): Content is not allowed in prolog.