/// <summary> /// Parse the object from <paramref name="s"/> /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result) { // Parse ANYFormatter anyFormatter = new ANYFormatter(); GTS retVal = anyFormatter.Parse <GTS>(s, result); // Is there any need to continue? if (retVal.NullFlavor != null) { return(retVal); } // Now determine the type of GTS string typeName = s.GetAttribute("type", "http://www.w3.org/2001/XMLSchema-instance"); IDatatypeFormatter formatter; // Parse the type switch (typeName) { case "IVL_TS": formatter = new IVLFormatter(); break; case "PIVL_TS": formatter = new PIVLFormatter(); break; case "EIVL_TS": formatter = new EIVLFormatter(); break; case "SXPR_TS": formatter = new SXPRFormatter(); break; case "SXCM_TS": formatter = new SXCMFormatter(); break; default: result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Error, String.Format("Cannot parse a GTS Hull of type '{0}'", typeName), s.ToString(), null)); return(null); } // Graph the Hull formatter.Host = this.Host; formatter.GenericArguments = new Type[] { typeof(TS) }; retVal.Hull = formatter.Parse(s, result) as SXCM <TS>; // Correct the flavor, the flavor of the hull becomes the flavor of the object retVal.Flavor = retVal.Flavor ?? retVal.Hull.Flavor; retVal.Hull.Flavor = null; retVal.NullFlavor = retVal.NullFlavor ?? (retVal.Hull.NullFlavor != null ? retVal.Hull.NullFlavor.Clone() as CS <NullFlavor> : null); retVal.Hull.NullFlavor = null; // Set the details return(retVal); }
/// <summary> /// Parse the object from <paramref name="s"/> /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result) { // Parse ANYFormatter anyFormatter = new ANYFormatter(); GTS retVal = anyFormatter.Parse<GTS>(s, result); // Is there any need to continue? if (retVal.NullFlavor != null) { return retVal; } // Now determine the type of GTS string typeName = s.GetAttribute("type", "http://www.w3.org/2001/XMLSchema-instance"); IDatatypeFormatter formatter; // Parse the type switch (typeName) { case "IVL_TS": formatter = new IVLFormatter(); break; case "PIVL_TS": formatter = new PIVLFormatter(); break; case "EIVL_TS": formatter = new EIVLFormatter(); break; case "SXPR_TS": formatter = new SXPRFormatter(); break; case "SXCM_TS": formatter = new SXCMFormatter(); break; default: result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Error, String.Format("Cannot parse a GTS Hull of type '{0}'", typeName), s.ToString(), null)); return null; } // Graph the Hull formatter.Host = this.Host; formatter.GenericArguments = new Type[] { typeof(TS) }; retVal.Hull = formatter.Parse(s, result) as SXCM<TS>; // Correct the flavor, the flavor of the hull becomes the flavor of the object retVal.Flavor = retVal.Flavor ?? retVal.Hull.Flavor; retVal.Hull.Flavor = null; retVal.NullFlavor = retVal.NullFlavor ?? (retVal.Hull.NullFlavor != null ? retVal.Hull.NullFlavor.Clone() as CS<NullFlavor> : null); retVal.Hull.NullFlavor = null; // Set the details return retVal; }