/// <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> /// Graph to the stream /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, "QSU cannot be graphed by the R1 formatter directly, processing as SXPR", s.ToString(), null)); SXPRFormatter formatter = new SXPRFormatter(); formatter.Host = this.Host; formatter.GenericArguments = this.GenericArguments; // Convert o as SXPR formatter.Graph(s, o.GetType().GetMethod("TranslateToSXPR").Invoke(o, null), result); }
/// <summary> /// Parse from the stream /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, "QSS cannot be parsed by the R1 formatter directly, processing as SXPR", s.ToString(), null)); SXPRFormatter formatter = new SXPRFormatter(); formatter.Host = this.Host; formatter.GenericArguments = this.GenericArguments; object retval = formatter.Parse(s, result); return(retval); }
/// <summary> /// Graph to the stream /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, "QSS cannot be graphed by the R1 formatter directly, processing as SXPR", s.ToString(), null)); SXPRFormatter formatter = new SXPRFormatter(); formatter.Host = this.Host; formatter.GenericArguments = this.GenericArguments; // Convert o as SXPR formatter.Graph(s, o.GetType().GetMethod("TranslateToSXPR").Invoke(o, null), result); }
/// <summary> /// Parse from the stream /// </summary> public object Parse(System.Xml.XmlReader s, DatatypeFormatterParseResult result) { result.AddResultDetail(new NotImplementedResultDetail(ResultDetailType.Warning, "QSET cannot be parsed by the R1 formatter directly, processing as SXPR", s.ToString(), null)); SXPRFormatter formatter = new SXPRFormatter(); formatter.Host = this.Host; formatter.GenericArguments = this.GenericArguments; object retval = formatter.Parse(s, result); 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; }