/// <summary> /// Parse a CE instance from <paramref name="s"/> /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeR2FormatterParseResult result) { CDFormatter realFormatter = new CDFormatter(); if (String.IsNullOrEmpty(s.GetAttribute("flavorId")) || s.GetAttribute("flavorId") != "CD.CE") { result.AddResultDetail(new FixedValueMisMatchedResultDetail(s.GetAttribute("flavorId"), "CD.CE", s.ToString())); } realFormatter.Host = this.Host; var retVal = realFormatter.Parse <CE <String> >(s, result); retVal.Flavor = null; return(retVal); }
/// <summary> /// Parse the string /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeR2FormatterParseResult result) { // Temporary holding value for value string tValue = null; if (s.GetAttribute("value") != null) { tValue = s.GetAttribute("value"); } // Parse the CD stuff CDFormatter baseFormatter = new CDFormatter(); baseFormatter.Host = this.Host; var retVal = baseFormatter.Parse <PQR>(s, result); // Interpret the value // If the value was interpreted if (!String.IsNullOrEmpty(tValue)) { try { retVal.Value = Util.Convert <decimal>(tValue); if (tValue.Contains(".")) { retVal.Precision = tValue.Length - tValue.IndexOf(".") - 1; } } catch (Exception e) { result.Code = ResultCode.Error; result.AddResultDetail(new ResultDetail(ResultDetailType.Error, e.Message, s.ToString(), e)); } } // Validate new ANYFormatter().Validate(retVal, s.ToString(), result); return(retVal); }