public override string GetValue(XmlElement element, Context context) { if(element != null) { if (element.HasAttribute(Name, string.Empty)) { return element.GetAttribute(Name); } else if (element.HasAttribute(Name, ResourceManager.VariableNamespace)) { IValueNode value = (IValueNode)context.GetVariable(element.GetAttribute(Name, ResourceManager.VariableNamespace)); value.InitNewState(context); return value.Value; } else { XmlElement valueNode = element[element.Name + "." + Name]; if (valueNode != null) { IValueNode value = (IValueNode)SequenceFactory.Instance.CreateChildrenAsSequence(valueNode, context); value.InitNewState(context); return value.Value; } } } return null; }
private static Func<ISequenceNode> BuildVariableCreator(ParseTreeNode node, Context context) { ParseTreeNode nameNode = FindNode(node, SpeechExpression.NameLiteralName); string varName = nameNode.Token.Text; return () => { return context.GetVariable(varName); }; }