private QilNode CompileXPathExpression(string expr)
{
XPathScanner scanner;
QilNode result;
SetEnvironmentFlags(/*allowVariables:*/true, /*allowCurrent:*/true, /*allowKey:*/true);
if (expr == null)
{
result = PhantomXPathExpression();
}
else
{
try
{
// Note that the constructor may throw an exception, for example, in case of the expression "'"
scanner = new XPathScanner(expr);
result = _xpathParser.Parse(scanner, _xpathBuilder, LexKind.Eof);
}
catch (XslLoadException e)
{
if (_xslVersion != XslVersion.ForwardsCompatible)
{
ReportErrorInXPath(/*[XT0300]*/e);
}
result = _f.Error(_f.String(e.Message));
}
}
if (result is QilIterator)
{
result = _f.Nop(result);
}
return result;
}