public override Field Parse(XmlElement fieldNode, bool optional, ParsingContext context) { Operator op = Operator.None; string defaultValue = null; string key = null; string ns = ""; XmlElement operatorElement = GetOperatorElement(fieldNode); if (operatorElement != null) { if (operatorElement.HasAttribute("value")) { defaultValue = operatorElement.GetAttribute("value"); } op = Operator.GetOperator(operatorElement.LocalName); if (operatorElement.HasAttribute("key")) { key = operatorElement.GetAttribute("key"); } if (operatorElement.HasAttribute("ns")) { ns = operatorElement.GetAttribute("ns"); } if (operatorElement.HasAttribute("dictionary")) { context.Dictionary = operatorElement.GetAttribute("dictionary"); } } FastType type = GetType(fieldNode, context); var scalar = new Scalar(GetName(fieldNode, context), type, op, type.GetValue(defaultValue), optional); if (fieldNode.HasAttribute("id")) { scalar.Id = fieldNode.GetAttribute("id"); } if (key != null) { scalar.Key = new QName(key, ns); } scalar.Dictionary = context.Dictionary; ParseExternalAttributes(fieldNode, scalar); return(scalar); }
public override IFieldValue CreateValue(string value) { return(_fastType.GetValue(value)); }