private QilNode CompileElement(NodeCtor node)
{
QilNode qilNs = CompileStringAvt(node.NsAvt);
QilNode qilName = CompileStringAvt(node.NameAvt);
QilNode qname;
if (qilName.NodeType == QilNodeType.LiteralString && (qilNs == null || qilNs.NodeType == QilNodeType.LiteralString))
{
string name = (string)(QilLiteral)qilName;
string prefix, local, nsUri;
bool isValid = _compiler.ParseQName(name, out prefix, out local, (IErrorHelper)this);
if (qilNs == null)
{
nsUri = isValid ? ResolvePrefix(/*ignoreDefaultNs:*/false, prefix) : _compiler.CreatePhantomNamespace();
}
else
{
nsUri = (string)(QilLiteral)qilNs;
}
qname = _f.QName(local, nsUri, prefix);
}
else
{ // Process AVT
if (qilNs != null)
{
qname = _f.StrParseQName(qilName, qilNs);
}
else
{
qname = ResolveQNameDynamic(/*ignoreDefaultNs:*/false, qilName);
}
}
_outputScope.PushScope();
// ToDo if we don't have AVT we shouldn't do this:
_outputScope.InvalidateAllPrefixes();
QilNode content = CompileInstructions(node.Content);
_outputScope.PopScope();
return _f.ElementCtor(qname, content);
}