/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { PDVFormatter qtyf = new PDVFormatter(); qtyf.Host = this.Host; qtyf.Graph(s, o, result); }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public virtual void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the EN ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; baseFormatter.Graph(s, o, result); // EN instance var enInstance = o as EN; // Format the properties if not nul if (enInstance.NullFlavor != null) return; // Format the use if (enInstance.Use != null) s.WriteAttributeString("use", Util.ToWireFormat(enInstance.Use)); // Parts foreach (var enxp in enInstance.Part) { s.WriteStartElement("part", "urn:hl7-org:v3"); // Output the type var hostResult = this.Host.Graph(s, enxp); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); // end part } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; // Graph baseFormatter.Graph(s, o, result); // Instance IProbability instance = o as IProbability; if (instance.NullFlavor != null) { return; } // Graph UVP properties if (instance.Probability.HasValue) { s.WriteAttributeString("probability", Util.ToWireFormat(instance.Probability.Value)); } // Value if (instance.Value != null) { s.WriteStartElement("value", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Value as IGraphable); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; // Graph baseFormatter.Graph(s, o, result); // Instance IProbability instance = o as IProbability; if (instance.NullFlavor != null) return; // Graph UVP properties if (instance.Probability.HasValue) s.WriteAttributeString("probability", Util.ToWireFormat(instance.Probability.Value)); // Value if (instance.Value != null) { s.WriteStartElement("value", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Value as IGraphable); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> saving /// results in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Base formatter is the CD type CDFormatter baseFormatter = new CDFormatter(); baseFormatter.Host = this.Host; // Graph the value if the null flavor of the object is not null PQR opqr = o as PQR; if (opqr.NullFlavor == null && opqr.Value.HasValue) { // Precision if (opqr.Precision == null) { s.WriteAttributeString("value", Util.ToWireFormat(opqr.Value)); } else { s.WriteAttributeString("value", String.Format(String.Format("{{0:0.{0}}}", new String('0', opqr.Precision)), opqr.Value)); } } // Graph the base stuff baseFormatter.Graph(s, o, result); }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> storing result /// in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get a strongly typed instance of o PQ opq = o as PQ; // Output additional attributes // Since a PQ with null flavor derived can still have a unit // we only want to check for null flavors not derived if (opq.NullFlavor == null || opq.NullFlavor.Equals(NullFlavor.Derived)) { if (opq.Unit != null) s.WriteAttributeString("unit", Util.ToWireFormat(opq.Unit)); if (opq.CodingRationale != null) s.WriteAttributeString("codingRationale", Util.ToWireFormat(opq.CodingRationale)); } // Output the PDV and QTY formatter helper data PDVFormatter pdvFormatter = new PDVFormatter(); pdvFormatter.Host = this.Host; pdvFormatter.Graph(s, o, result); // Output the translations (if they exist) if(opq.Translation != null && (opq.NullFlavor == null || opq.NullFlavor.Equals(NullFlavor.Derived))) foreach (var trans in opq.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); // Graph var hostResult = this.Host.Graph(s, trans); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph object <paramref name="o"/> onto the stream /// </summary> public void Graph(XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph ANY QTYFormatter baseFormatter = new QTYFormatter(); baseFormatter.Host = this.Host; // Null ? IAny anyInstance = o as IAny; IPrimitiveDataValue pdv = o as IPrimitiveDataValue; IRealValue rv = o as IRealValue; // Format if (pdv.Value != null && anyInstance.NullFlavor == null) { if (rv == null || rv.Precision == 0) { s.WriteAttributeString("value", Util.ToWireFormat(pdv.Value)); } else if (rv != null) { s.WriteAttributeString("value", String.Format(DatatypeR2Formatter.FormatterCulture, String.Format("{{0:0.{0}}}", new String('0', rv.Precision), DatatypeR2Formatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), rv.Value)); } } // Format the base baseFormatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the base ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Do not graph if null flavor is present if ((o as ANY).NullFlavor != null) return; var originalText = o as IOriginalText; // Write out the original text first if (originalText.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalText.OriginalText); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Now the terms foreach (var term in (o as IEnumerable)) { s.WriteStartElement("term", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, term as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ADXP instance = o as ADXP; // Start with the part type and code attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, instance, result); // Format data if (instance.Type != null && instance.Type.HasValue) { s.WriteAttributeString("type", Util.ToWireFormat(instance.Type)); } if (instance.Value != null) { s.WriteAttributeString("value", instance.Value); } if (instance.Code != null) { s.WriteAttributeString("code", instance.Code); } if (instance.CodeSystem != null) { s.WriteAttributeString("codeSystem", instance.CodeSystem); } if (instance.CodeSystemVersion != null) { s.WriteAttributeString("codeSystemVersion", instance.CodeSystemVersion); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); // Graph baseFormatter.Graph(s, o, result); // Null ? IAny anyInstance = o as IAny; TEL tel = o as TEL; // Null flavor if (anyInstance.NullFlavor != null) return; // Format attributes if (tel.Value != null) // Value s.WriteAttributeString("value", tel.Value); if (tel.Use != null) // Use s.WriteAttributeString("use", Util.ToWireFormat(tel.Use)); if (tel.Capabilities != null) // Capabilities s.WriteAttributeString("capabilities", Util.ToWireFormat(tel.Capabilities)); // format elements if (tel.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, tel.UseablePeriod); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Translate the object to a QSET Type t = o.GetType(); MethodInfo mi = t.GetMethod("TranslateToQSET"); object qsetInstance = mi.Invoke(o, null); // Now pass to the qset formatter this.Host.Graph(s, qsetInstance as IGraphable); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // First off, QSET cannot be instantiated so the formatter should find out // which of the QSET classes are actually instantiated and output the appropriate // xsi type information before passing off to the appropriate formatter s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(o.GetType())); var hostResult = this.Host.Graph(s, o as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast to any var any = o as IAny; // Output flavor id if (any.Flavor == null && any.NullFlavor == null) s.WriteAttributeString("flavorId", "EN.ON"); // Do a base format base.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { SETFormatter formatter = new SETFormatter(); formatter.Host = this.Host; // Create new generic arguments var uvpType = typeof(UVP<>); var genType = uvpType.MakeGenericType(GenericArguments); formatter.GenericArguments = new Type[] { genType }; formatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format base attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); if ((o as ANY).NullFlavor != null) { return; // no need to continue formatting } // Get the values the formatter needs to represent in XML Type eivlType = o.GetType(); object operatorValue = eivlType.GetProperty("Operator").GetValue(o, null), valueValue = eivlType.GetProperty("Value").GetValue(o, null), originalTextValue = eivlType.GetProperty("OriginalText").GetValue(o, null), offsetValue = eivlType.GetProperty("Offset").GetValue(o, null), eventValue = eivlType.GetProperty("Event").GetValue(o, null) ; // Low / high closed if (operatorValue != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "EIVL", s.ToString())); } if (valueValue != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Value", "EIVL", s.ToString())); } if (eventValue != null) { s.WriteAttributeString("event", Util.ToWireFormat(eventValue)); } // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Valid combinations if (offsetValue != null) { s.WriteStartElement("offset", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, offsetValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Any formatter ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.GenericArguments = this.GenericArguments; anyFormatter.Host = this.Host; // Graph base anyFormatter.Graph(s, o, result); // Instance II iiInstance = o as II; // Other nullFlavor if (iiInstance.NullFlavor != null) { return; } // Properties if (iiInstance.Root != null) { s.WriteAttributeString("root", iiInstance.Root); } if (iiInstance.Extension != null) { s.WriteAttributeString("extension", iiInstance.Extension); } if (iiInstance.IdentifierName != null) { s.WriteAttributeString("identifierName", iiInstance.IdentifierName); } if (iiInstance.Displayable != null) { s.WriteAttributeString("displayable", Util.ToWireFormat(iiInstance.Displayable)); } if (iiInstance.Scope != null) { s.WriteAttributeString("scope", Util.ToWireFormat(iiInstance.Scope)); } if (iiInstance.Reliability != null) { s.WriteAttributeString("reliability", Util.ToWireFormat(iiInstance.Reliability)); } if (iiInstance.AssigningAuthorityName != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail( ResultDetailType.Warning, "AssigningAuthorityName", "II", s.ToString() )); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { SETFormatter formatter = new SETFormatter(); formatter.Host = this.Host; // Create new generic arguments var uvpType = typeof(UVP <>); var genType = uvpType.MakeGenericType(GenericArguments); formatter.GenericArguments = new Type[] { genType }; formatter.Graph(s, o, result); }
/// <summary> /// Graph object <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get an instance ref ICodedSimple instance_ics = (ICodedSimple)o; // Do a base format ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o as ANY, result); // Format the coded simple if (instance_ics.CodeValue != null && ((ANY)o).NullFlavor == null) s.WriteAttributeString("code", Util.ToWireFormat(instance_ics.CodeValue)); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { var any = o as IAny; // Output flavor id if(any.Flavor == null && (any.NullFlavor == null || ((NullFlavor)any.NullFlavor).IsChildConcept(NullFlavor.Other))) s.WriteAttributeString("flavorId", "CD.CV"); // Do a base format CDFormatter realFormatter = new CDFormatter(); realFormatter.Host = this.Host; realFormatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast to any var any = o as IAny; // Output flavor id if (any.Flavor == null && any.NullFlavor == null) { s.WriteAttributeString("flavorId", "EN.PN"); } // Do a base format base.Graph(s, o, result); }
/// <summary> /// Graph object <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the base data ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Is null flavor set? if ((o as ANY).NullFlavor != null) { return; } // Original text IOriginalText originalText = o as IOriginalText; if (originalText.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalText.OriginalText); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Get properties we'll be graphing object lowValue = o.GetType().GetProperty("Low").GetValue(o, null), highValue = o.GetType().GetProperty("High").GetValue(o, null); // Graph low / hi if (lowValue != null) { s.WriteStartElement("low", "urn:hl7-org:v3"); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); var hostResult = this.Host.Graph(s, lowValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); var hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph the object <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { AD instance = o as AD; // Base formatting ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, instance, result); // Use if (instance.Use != null && !instance.Use.IsNull) { s.WriteAttributeString("use", Util.ToWireFormat(instance.Use)); } // No need to format if (instance.NullFlavor != null) { return; } // Is not ordered if (instance.IsNotOrdered != null && instance.IsNotOrdered.HasValue) { s.WriteAttributeString("isNotOrdered", Util.ToWireFormat(instance.IsNotOrdered)); } // Parts if (instance.Part != null) { foreach (var part in instance.Part) { s.WriteStartElement("part", "urn:hl7-org:v3"); ADXPFormatter adFormatter = new ADXPFormatter(); adFormatter.Graph(s, part, result); s.WriteEndElement(); } } // Useable period if (instance.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); GTSFormatter gtsFormatter = new GTSFormatter(); gtsFormatter.Host = this.Host; gtsFormatter.Graph(s, instance.UseablePeriod, result); s.WriteEndElement(); } }
/// <summary> /// Graph object <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the base data ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Is null flavor set? if ((o as ANY).NullFlavor != null) return; // Original text IOriginalText originalText = o as IOriginalText; if (originalText.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalText.OriginalText); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Get properties we'll be graphing object lowValue = o.GetType().GetProperty("Low").GetValue(o, null), highValue = o.GetType().GetProperty("High").GetValue(o, null); // Graph low / hi if (lowValue != null) { s.WriteStartElement("low", "urn:hl7-org:v3"); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); var hostResult = this.Host.Graph(s, lowValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); var hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; baseFormatter.Graph(s, o, result); // Graph elements ISampledList instance = o as ISampledList; if (instance.NullFlavor != null) { return; } // Origin if (instance.Origin != null) { s.WriteStartElement("origin", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Origin as IGraphable); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Scaling if (instance.Scale != null) { s.WriteStartElement("scale", "urn:hl7-org:v3"); // Output xsi type s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(instance.Scale.GetType())); var hostResult = this.Host.Graph(s, instance.Scale); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Digits if (instance.Items != null) { foreach (var itm in instance.Items) { s.WriteStartElement("digit", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, itm); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } } }
/// <summary> /// Graph object <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get an instance ref ICodedSimple instance_ics = (ICodedSimple)o; // Do a base format ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o as ANY, result); // Format the coded simple if (instance_ics.CodeValue != null && ((ANY)o).NullFlavor == null) { s.WriteAttributeString("code", Util.ToWireFormat(instance_ics.CodeValue)); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { var any = o as IAny; // Output flavor id if (any.Flavor == null && (any.NullFlavor == null || ((NullFlavor)any.NullFlavor).IsChildConcept(NullFlavor.Other))) { s.WriteAttributeString("flavorId", "CD.CV"); } // Do a base format CDFormatter realFormatter = new CDFormatter(); realFormatter.Host = this.Host; realFormatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format base attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); if ((o as ANY).NullFlavor != null) return; // no need to continue formatting // Get the values the formatter needs to represent in XML Type eivlType = o.GetType(); object operatorValue = eivlType.GetProperty("Operator").GetValue(o, null), valueValue = eivlType.GetProperty("Value").GetValue(o, null), originalTextValue = eivlType.GetProperty("OriginalText").GetValue(o, null), offsetValue = eivlType.GetProperty("Offset").GetValue(o, null), eventValue = eivlType.GetProperty("Event").GetValue(o, null) ; // Low / high closed if (operatorValue != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "EIVL", s.ToString())); if (valueValue != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Value", "EIVL", s.ToString())); if (eventValue != null) s.WriteAttributeString("event", Util.ToWireFormat(eventValue)); // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Valid combinations if (offsetValue != null) { s.WriteStartElement("offset", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, offsetValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; baseFormatter.Graph(s, o, result); // Graph elements ISampledList instance = o as ISampledList; if (instance.NullFlavor != null) return; // Origin if (instance.Origin != null) { s.WriteStartElement("origin", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Origin as IGraphable); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Scaling if (instance.Scale != null) { s.WriteStartElement("scale", "urn:hl7-org:v3"); // Output xsi type s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(instance.Scale.GetType())); var hostResult = this.Host.Graph(s, instance.Scale); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Digits if (instance.Items != null) { foreach (var itm in instance.Items) { s.WriteStartElement("digit", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, itm); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Quantity formatter ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Graph the others IQuantity qty = o as IQuantity; // Uncertainty type if (qty.NullFlavor == null && qty.UncertaintyType != null && qty.UncertaintyType.HasValue) { s.WriteAttributeString("uncertaintyType", Util.ToWireFormat(qty.UncertaintyType.Value)); } // Elements // Expression if (qty.Expression != null) { s.WriteStartElement("expression", "urn:hl7-org:v3"); this.Host.Graph(s, qty.Expression as IGraphable); s.WriteEndElement(); } if (qty.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); this.Host.Graph(s, qty.OriginalText as IGraphable); s.WriteEndElement(); } if (qty.NullFlavor == null && qty.Uncertainty != null) { s.WriteStartElement("uncertainty", "urn:hl7-org:v3"); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(qty.Uncertainty.DataType)); this.Host.Graph(s, qty.Uncertainty as IGraphable); s.WriteEndElement(); } if (qty.UncertainRange != null) { s.WriteStartElement("uncertainRange", "urn:hl7-org:v3"); this.Host.Graph(s, qty.UncertainRange); s.WriteEndElement(); } }
/// <summary> /// Graph the object <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast the object to GTS GTS instance = o as GTS; // Hull instance corrections if (instance.Hull != null) { if (instance.NullFlavor != null) { instance.Hull.NullFlavor = instance.Hull.NullFlavor ?? instance.NullFlavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "NullFlavor", "Hull.NullFlavor", instance.Hull.NullFlavor, s.ToString())); } if (instance.Flavor != null) { instance.Hull.Flavor = instance.Hull.Flavor ?? instance.Flavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Flavor", "Hull.Flavor", instance.Hull.Flavor, s.ToString())); } } else { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Cannot graph a GTS instance with a null Hull", s.ToString())); return; } // Map QSET/SXPR/SXCM object instanceHull = instance.Hull; if (instanceHull is SXPR <TS> ) { instanceHull = (instanceHull as SXPR <TS>).TranslateToQSET(); } // Emit the type name string xsiTypeName = Util.CreateXSITypeName(instanceHull.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName); // Host results var hostResult = this.Host.Graph(s, (IGraphable)instanceHull); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> storing result /// in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get a strongly typed instance of o PQ opq = o as PQ; // Output additional attributes // Since a PQ with null flavor derived can still have a unit // we only want to check for null flavors not derived if (opq.NullFlavor == null || opq.NullFlavor.Equals(NullFlavor.Derived)) { if (opq.Unit != null) { s.WriteAttributeString("unit", Util.ToWireFormat(opq.Unit)); } if (opq.CodingRationale != null) { s.WriteAttributeString("codingRationale", Util.ToWireFormat(opq.CodingRationale)); } } // Output the PDV and QTY formatter helper data PDVFormatter pdvFormatter = new PDVFormatter(); pdvFormatter.Host = this.Host; pdvFormatter.Graph(s, o, result); // Output the translations (if they exist) if (opq.Translation != null && (opq.NullFlavor == null || opq.NullFlavor.Equals(NullFlavor.Derived))) { foreach (var trans in opq.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); // Graph var hostResult = this.Host.Graph(s, trans); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> storing result /// in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get a strongly typed instance of o MO omo = o as MO; // Output additional attributes // Since a MO with null flavor derived can still have a currency // we only want to check for null flavors not derived if (omo.NullFlavor == null || omo.NullFlavor.Equals(NullFlavor.Derived)) { if (omo.Currency != null) s.WriteAttributeString("currency", Util.ToWireFormat(omo.Currency)); } // Output the PDV and QTY formatter helper data PDVFormatter pdvFormatter = new PDVFormatter(); pdvFormatter.Host = this.Host; pdvFormatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> saving /// results in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Base formatter is the CD type CDFormatter baseFormatter = new CDFormatter(); baseFormatter.Host = this.Host; // Graph the value if the null flavor of the object is not null PQR opqr = o as PQR; if (opqr.NullFlavor == null && opqr.Value.HasValue) { // Precision if (opqr.Precision == null) s.WriteAttributeString("value", Util.ToWireFormat(opqr.Value)); else s.WriteAttributeString("value", String.Format(String.Format("{{0:0.{0}}}", new String('0', opqr.Precision)), opqr.Value)); } // Graph the base stuff baseFormatter.Graph(s, o, result); }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Output base properties base.Graph(s, o, result); // Output code SC instance = o as SC; if (instance.NullFlavor != null) return; // Code if (instance.Code != null) { s.WriteStartElement("code", "urn:hl7-org:v3"); // Code var hostResult = this.Host.Graph(s, instance.Code); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ADXP instance = o as ADXP; // Start with the part type and code attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, instance, result); // Format data if (instance.Type != null && instance.Type.HasValue) s.WriteAttributeString("type", Util.ToWireFormat(instance.Type)); if (instance.Value != null) s.WriteAttributeString("value", instance.Value); if (instance.Code != null) s.WriteAttributeString("code", instance.Code); if (instance.CodeSystem != null) s.WriteAttributeString("codeSystem", instance.CodeSystem); if (instance.CodeSystemVersion != null) s.WriteAttributeString("codeSystemVersion", instance.CodeSystemVersion); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { PDVFormatter qtyf = new PDVFormatter(); qtyf.Host = this.Host; qtyf.Graph(s, o, result); CO instance = o as CO; // Code property if (instance.NullFlavor != null) return; if (instance.Code != null) { s.WriteStartElement("code", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Code); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); // Graph baseFormatter.Graph(s, o, result); // Null ? IAny anyInstance = o as IAny; TEL tel = o as TEL; // Null flavor if (anyInstance.NullFlavor != null) { return; } // Format attributes if (tel.Value != null) // Value { s.WriteAttributeString("value", tel.Value); } if (tel.Use != null) // Use { s.WriteAttributeString("use", Util.ToWireFormat(tel.Use)); } if (tel.Capabilities != null) // Capabilities { s.WriteAttributeString("capabilities", Util.ToWireFormat(tel.Capabilities)); } // format elements if (tel.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, tel.UseablePeriod); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the base ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Do not graph if null flavor is present if ((o as ANY).NullFlavor != null) { return; } var originalText = o as IOriginalText; // Write out the original text first if (originalText.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalText.OriginalText); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Now the terms foreach (var term in (o as IEnumerable)) { s.WriteStartElement("term", "urn:hl7-org:v3"); // JF: Output XSI:Type string xsiTypeName = DatatypeR2Formatter.CreateXSITypeName(term.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName); var hostResult = this.Host.Graph(s, term as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph the object <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { AD instance = o as AD; // Base formatting ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, instance, result); // Use if (instance.Use != null && !instance.Use.IsNull) s.WriteAttributeString("use", Util.ToWireFormat(instance.Use)); // No need to format if (instance.NullFlavor != null) return; // Is not ordered if (instance.IsNotOrdered != null && instance.IsNotOrdered.HasValue) s.WriteAttributeString("isNotOrdered", Util.ToWireFormat(instance.IsNotOrdered)); // Parts if(instance.Part != null) foreach (var part in instance.Part) { s.WriteStartElement("part", "urn:hl7-org:v3"); ADXPFormatter adFormatter = new ADXPFormatter(); adFormatter.Graph(s, part, result); s.WriteEndElement(); } // Useable period if (instance.UseablePeriod != null) { s.WriteStartElement("useablePeriod", "urn:hl7-org:v3"); GTSFormatter gtsFormatter = new GTSFormatter(); gtsFormatter.Host = this.Host; gtsFormatter.Graph(s, instance.UseablePeriod, result); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> storing result /// in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get a strongly typed instance of o MO omo = o as MO; // Output additional attributes // Since a MO with null flavor derived can still have a currency // we only want to check for null flavors not derived if (omo.NullFlavor == null || omo.NullFlavor.Equals(NullFlavor.Derived)) { if (omo.Currency != null) { s.WriteAttributeString("currency", Util.ToWireFormat(omo.Currency)); } } // Output the PDV and QTY formatter helper data PDVFormatter pdvFormatter = new PDVFormatter(); pdvFormatter.Host = this.Host; pdvFormatter.Graph(s, o, result); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { PDVFormatter qtyf = new PDVFormatter(); qtyf.Host = this.Host; qtyf.Graph(s, o, result); CO instance = o as CO; // Code property if (instance.NullFlavor != null) { return; } if (instance.Code != null) { s.WriteStartElement("code", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, instance.Code); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public virtual void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Base formatter ANYFormatter anyFormatter = new ANYFormatter(); // Format the base anyFormatter.Graph(s, o, result); // Nullflavor? ST instance = o as ST; if (instance.NullFlavor != null) { return; } // format properties if (instance.Value != null) { s.WriteAttributeString("value", instance.Value); } if (instance.Language != null) { s.WriteAttributeString("language", instance.Language); } // format translation if (instance.Translation != null) { foreach (var tx in instance.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, tx); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } } }
/// <summary> /// Graph the object <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast the object to GTS GTS instance = o as GTS; // Hull instance corrections if (instance.Hull != null) { if (instance.NullFlavor != null) { instance.Hull.NullFlavor = instance.Hull.NullFlavor ?? instance.NullFlavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "NullFlavor", "Hull.NullFlavor", instance.Hull.NullFlavor, s.ToString())); } if (instance.Flavor != null) { instance.Hull.Flavor = instance.Hull.Flavor ?? instance.Flavor; result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Flavor", "Hull.Flavor", instance.Hull.Flavor, s.ToString())); } } else { result.AddResultDetail(new ResultDetail(ResultDetailType.Error, "Cannot graph a GTS instance with a null Hull", s.ToString())); return; } // Map QSET/SXPR/SXCM object instanceHull = instance.Hull; if (instanceHull is SXPR<TS>) instanceHull = (instanceHull as SXPR<TS>).TranslateToQSET(); // Emit the type name string xsiTypeName = Util.CreateXSITypeName(instanceHull.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName); // Host results var hostResult = this.Host.Graph(s, (IGraphable)instanceHull); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); }
/// <summary> /// Graphs object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); // Graph baseFormatter.Graph(s, o, result); // Null ? IAny anyInstance = o as IAny; IPrimitiveDataValue pdv = o as IPrimitiveDataValue; // Null flavor if (anyInstance.NullFlavor != null) return; // Format if (pdv.Value != null) { s.WriteAttributeString("value", Util.ToWireFormat(pdv.Value)); } }
/// <summary> /// Graphs object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANYFormatter baseFormatter = new ANYFormatter(); // Graph baseFormatter.Graph(s, o, result); // Null ? IAny anyInstance = o as IAny; IPrimitiveDataValue pdv = o as IPrimitiveDataValue; // Null flavor if (anyInstance.NullFlavor != null) { return; } // Format if (pdv.Value != null) { s.WriteAttributeString("value", Util.ToWireFormat(pdv.Value)); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> storing /// details in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast to strongly typed data IColl collInstance = o as IColl; IAny anyInstance = o as IAny; // Base formatter ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.Graph(s, o, result); // Graphing a COLL is easy, we just iterate over the items if (anyInstance.NullFlavor == null) { foreach (var itm in collInstance) { // Start the item tag s.WriteStartElement("item", "urn:hl7-org:v3"); // Output an XSI type if the type does not match the generic parameter if (itm.GetType() != GenericArguments[0]) { var xsiName = DatatypeR2Formatter.CreateXSITypeName(itm.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiName); } // Format the item var hostResult = this.Host.Graph(s, itm as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); // End of item tag s.WriteEndElement(); } } }
/// <summary> /// Graphs <paramref name="o"/> to <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Any formatter ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.GenericArguments = this.GenericArguments; anyFormatter.Host = this.Host; // Graph base anyFormatter.Graph(s, o, result); // Instance II iiInstance = o as II; // Other nullFlavor if (iiInstance.NullFlavor != null) return; // Properties if (iiInstance.Root != null) s.WriteAttributeString("root", iiInstance.Root); if (iiInstance.Extension != null) s.WriteAttributeString("extension", iiInstance.Extension); if (iiInstance.IdentifierName != null) s.WriteAttributeString("identifierName", iiInstance.IdentifierName); if (iiInstance.Displayable != null) s.WriteAttributeString("displayable", Util.ToWireFormat(iiInstance.Displayable)); if (iiInstance.Scope != null) s.WriteAttributeString("scope", Util.ToWireFormat(iiInstance.Scope)); if (iiInstance.Reliability != null) s.WriteAttributeString("reliability", Util.ToWireFormat(iiInstance.Reliability)); if (iiInstance.AssigningAuthorityName != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail( ResultDetailType.Warning, "AssigningAuthorityName", "II", s.ToString() )); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> storing /// details in <paramref name="result"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Cast to strongly typed data IColl collInstance = o as IColl; IAny anyInstance = o as IAny; // Base formatter ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.Graph(s, o, result); // Graphing a COLL is easy, we just iterate over the items if(anyInstance.NullFlavor == null) foreach (var itm in collInstance) { // Start the item tag s.WriteStartElement("item", "urn:hl7-org:v3"); // Output an XSI type if the type does not match the generic parameter if (itm.GetType() != GenericArguments[0]) { var xsiName = DatatypeR2Formatter.CreateXSITypeName(itm.GetType()); s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiName); } // Format the item var hostResult = this.Host.Graph(s, itm as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); // End of item tag s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public override void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Output base properties base.Graph(s, o, result); // Output code SC instance = o as SC; if (instance.NullFlavor != null) { return; } // Code if (instance.Code != null) { s.WriteStartElement("code", "urn:hl7-org:v3"); // Code var hostResult = this.Host.Graph(s, instance.Code); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }
/// <summary> /// Graphs <paramref name="o"/> onto <paramref name="s"/> /// </summary> public virtual void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the EN ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Host = this.Host; baseFormatter.GenericArguments = this.GenericArguments; baseFormatter.Graph(s, o, result); // EN instance var enInstance = o as EN; // Format the properties if not nul if (enInstance.NullFlavor != null) { return; } // Format the use if (enInstance.Use != null) { s.WriteAttributeString("use", Util.ToWireFormat(enInstance.Use)); } // Parts foreach (var enxp in enInstance.Part) { s.WriteStartElement("part", "urn:hl7-org:v3"); // Output the type var hostResult = this.Host.Graph(s, enxp); result.AddResultDetail(hostResult.Details); s.WriteEndElement(); // end part } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format base attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); if ((o as ANY).NullFlavor != null) return; // no need to continue formatting // Get the values the formatter needs to represent in XML Type ivlType = o.GetType(); object operatorValue = ivlType.GetProperty("Operator").GetValue(o, null), lowValue = ivlType.GetProperty("Low").GetValue(o, null), highValue = ivlType.GetProperty("High").GetValue(o, null), widthValue = ivlType.GetProperty("Width").GetValue(o, null), originalTextValue = ivlType.GetProperty("OriginalText").GetValue(o, null), lowClosedValue = ivlType.GetProperty("LowClosed").GetValue(o, null), highClosedValue = ivlType.GetProperty("HighClosed").GetValue(o, null), valueValue = ivlType.GetProperty("Value").GetValue(o, null); // Low / high closed if (lowClosedValue != null) s.WriteAttributeString("lowClosed", Util.ToWireFormat(lowClosedValue)); if (highClosedValue != null) s.WriteAttributeString("highClosed", Util.ToWireFormat(highClosedValue)); if (operatorValue != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "IVL", s.ToString())); // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } bool invalidCombo = false; // Valid combinations if (lowValue != null) { s.WriteStartElement("low", "urn:hl7-org:v3"); // Low value XSI? if (lowValue.GetType() != GenericArguments[0]) s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); var hostResult = this.Host.Graph(s, lowValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); if (highValue.GetType() != GenericArguments[0]) s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(highValue.GetType())); hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } invalidCombo |= valueValue != null || widthValue != null; } else if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); // High value XSI if (highValue.GetType() != GenericArguments[0]) s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(highValue.GetType())); var hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); invalidCombo |= valueValue != null || widthValue != null; } if (widthValue != null && ((lowValue == null) ^ (highValue == null) || lowValue == null && highValue == null )) { s.WriteStartElement("width", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, widthValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); if (valueValue != null) { s.WriteStartElement("any", "urn:hl7-org:v3"); // Value value xsi type if (valueValue.GetType() != GenericArguments[0]) s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(valueValue.GetType())); hostResult = this.Host.Graph(s, valueValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } invalidCombo |= lowValue != null || highValue != null; } else if (valueValue != null) { s.WriteStartElement("any", "urn:hl7-org:v3"); // Value value xsi type if (valueValue.GetType() != GenericArguments[0]) s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(valueValue.GetType())); var hostResult = this.Host.Graph(s, valueValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); invalidCombo |= lowValue != null || highValue != null; } else invalidCombo = true; // Invalid combination, warn if(invalidCombo) result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Warning, "This IVL is not conformant to the ISO21090 data types specification. Only 'Value' and/or 'Width', or 'Low' and/or 'High' are permitted. All data has been serialized but may not be interpreted by a remote system", s.ToString(), null)); }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> /// <remarks>For some reason this type is not defined in the ISO Data types XSD</remarks> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format the base ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.Graph(s, o, result); // If null flavor is not if ((o as IAny).NullFlavor != null) return; // Get the property information Type pivlType = o.GetType(); object valueValue = pivlType.GetProperty("Value").GetValue(o, null), operatorValue = pivlType.GetProperty("Operator").GetValue(o, null), alignmentValue = pivlType.GetProperty("Alignment").GetValue(o, null), phaseValue = pivlType.GetProperty("Phase").GetValue(o, null), periodValue = pivlType.GetProperty("Period").GetValue(o, null), institutionSpecifiedValue = pivlType.GetProperty("InstitutionSpecified").GetValue(o, null), countValue = pivlType.GetProperty("Count").GetValue(o, null), frequencyValue = pivlType.GetProperty("Frequency").GetValue(o, null), originalTextValue = pivlType.GetProperty("OriginalText").GetValue(o, null); // Attributes if (institutionSpecifiedValue != null) s.WriteAttributeString("isFlexible", institutionSpecifiedValue.ToString().ToLower()); if (alignmentValue != null) s.WriteAttributeString("alignment", Util.ToWireFormat(alignmentValue)); if (countValue != null) s.WriteAttributeString("count", Util.ToWireFormat(countValue)); if (operatorValue != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "PIVL", s.ToString())); if (valueValue != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Value", "PIVL", s.ToString())); // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } // Phase if (phaseValue != null) { s.WriteStartElement("phase", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, phaseValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } // Frequency or period if(frequencyValue != null) { s.WriteStartElement("frequency", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, frequencyValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } else if (periodValue != null) { s.WriteStartElement("period", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, periodValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); if (frequencyValue != null) result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Warning, "'Period' and 'Frequency' specified, this is not permitted, either 'Period' xor 'Frequency' may be represented. Will only represent 'Period' property", s.ToString(), null)); } }
/// <summary> /// Graph object <paramref name="o"/> onto stream <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Get an instance ref ED instance_ed = (ED)o; // Do a base format ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Null flavor if (((ANY)o).NullFlavor != null) { return; } // Attributes if (instance_ed.MediaType != null && instance_ed.Representation != EncapsulatedDataRepresentation.TXT) s.WriteAttributeString("mediaType", instance_ed.MediaType); if (instance_ed.Language != null) s.WriteAttributeString("language", instance_ed.Language); if (instance_ed.Compression != null) s.WriteAttributeString("compression", Util.ToWireFormat(instance_ed.Compression)); if (instance_ed.IntegrityCheckAlgorithm != null) s.WriteAttributeString("integrityCheckAlgorithm", Util.ToWireFormat(instance_ed.IntegrityCheckAlgorithm)); Encoding textEncoding = System.Text.Encoding.UTF8; // Representation of data if(instance_ed.Data != null && instance_ed.Data.Length > 0) switch(instance_ed.Representation) { case EncapsulatedDataRepresentation.TXT: s.WriteAttributeString("value", textEncoding.GetString(instance_ed.Data)); break; case EncapsulatedDataRepresentation.B64: s.WriteStartElement("data", "urn:hl7-org:v3"); s.WriteBase64(instance_ed.Data, 0, instance_ed.Data.Length); s.WriteEndElement();// data break; case EncapsulatedDataRepresentation.XML: s.WriteStartElement("xml", "urn:hl7-org:v3"); s.WriteRaw(instance_ed.XmlData.OuterXml); s.WriteEndElement(); // xml break; } // Elements if (instance_ed.Reference != null) { s.WriteStartElement("reference", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, instance_ed.Reference); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (instance_ed.IntegrityCheck != null && instance_ed.IntegrityCheck.Length > 0) { s.WriteStartElement("integrityCheck", "urn:hl7-org:v3"); s.WriteBase64(instance_ed.IntegrityCheck, 0, instance_ed.IntegrityCheck.Length); s.WriteEndElement(); // intcheck } if (instance_ed.Thumbnail != null) { s.WriteStartElement("thumbnail", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, instance_ed.Thumbnail); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (instance_ed.Description != null) { s.WriteStartElement("description", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, instance_ed.Description); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } if (instance_ed.Translation != null && !instance_ed.Translation.IsNull) { foreach (var trans in instance_ed.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); var hostResult = Host.Graph(s, trans); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); // translation } } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // XP is special, it does not extend anything so we have to graph from scratch var instance = o as ENXP; // Null flavor? if (instance.NullFlavor != null) s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor)); else { // Validate DatatypeR2FormatterParseResult tResult = new DatatypeR2FormatterParseResult(result.ValidateConformance); new ANYFormatter().Validate(instance, s.ToString(), tResult); result.AddResultDetail(tResult.Details); // Qualifiers (copy for modification) SET<CS<EntityNamePartQualifier>> qualifiers = new SET<CS<EntityNamePartQualifier>>(); if(instance.Qualifier != null) foreach (var qlf in instance.Qualifier) qualifiers.Add(qlf.Clone() as CS<EntityNamePartQualifier>); // Unsupported properties if (instance.ControlActExt != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "ControlActExt", "ENXP", s.ToString())); if (instance.ControlActRoot != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "ControlActRoot", "ENXP", s.ToString())); if (instance.ValidTimeHigh != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "ValidTimeHigh", "ENXP", s.ToString())); if (instance.ValidTimeLow != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "ValidTimeLow", "ENXP", s.ToString())); if (instance.Flavor != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Flavor", "ENXP", s.ToString())); if (instance.UpdateMode != null) result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "UpdateMode", "ENXP", s.ToString())); // Output the supported properties if (instance.Value != null) s.WriteAttributeString("value", instance.Value); if (instance.Code != null) s.WriteAttributeString("code", instance.Code); if (instance.CodeSystem != null) s.WriteAttributeString("codeSystem", instance.CodeSystem); if (instance.CodeSystemVersion != null) s.WriteAttributeString("codeSystemVersion", instance.CodeSystemVersion); if (instance.Type != null) { // Qualifiers that count as TITLE EntityNamePartQualifier[] titleQualifiers = new EntityNamePartQualifier[] { EntityNamePartQualifier.Professional, EntityNamePartQualifier.Nobility, EntityNamePartQualifier.Academic , EntityNamePartQualifier.LegalStatus }; // If type is not SFX or PFX then output the type, // if it is either SFX or PFX then don't output the type // but do modify the qualifier switch(instance.Type.Value) { case EntityNamePartType.Prefix: if (instance.Qualifier == null) instance.Qualifier = new SET<CS<EntityNamePartQualifier>>(); if(!qualifiers.Contains(EntityNamePartQualifier.Prefix)) qualifiers.Add(EntityNamePartQualifier.Prefix); // Change the instance type if(Array.Exists(titleQualifiers, q => qualifiers.Contains(q))) s.WriteAttributeString("type", "TITLE"); break; case EntityNamePartType.Suffix: if (instance.Qualifier == null) instance.Qualifier = new SET<CS<EntityNamePartQualifier>>(); if (!qualifiers.Contains(EntityNamePartQualifier.Suffix)) qualifiers.Add(EntityNamePartQualifier.Suffix); // Change the instance type if (Array.Exists(titleQualifiers, q => qualifiers.Contains(q))) s.WriteAttributeString("type", "TITLE"); break; default: s.WriteAttributeString("type", Util.ToWireFormat(instance.Type)); break; } } if (!qualifiers.IsEmpty) s.WriteAttributeString("qualifier", Util.ToWireFormat(qualifiers)); } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> /// <remarks>For some reason this type is not defined in the ISO Data types XSD</remarks> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format the base ANYFormatter anyFormatter = new ANYFormatter(); anyFormatter.Graph(s, o, result); // If null flavor is not if ((o as IAny).NullFlavor != null) { return; } // Get the property information Type pivlType = o.GetType(); object valueValue = pivlType.GetProperty("Value").GetValue(o, null), operatorValue = pivlType.GetProperty("Operator").GetValue(o, null), alignmentValue = pivlType.GetProperty("Alignment").GetValue(o, null), phaseValue = pivlType.GetProperty("Phase").GetValue(o, null), periodValue = pivlType.GetProperty("Period").GetValue(o, null), institutionSpecifiedValue = pivlType.GetProperty("InstitutionSpecified").GetValue(o, null), countValue = pivlType.GetProperty("Count").GetValue(o, null), frequencyValue = pivlType.GetProperty("Frequency").GetValue(o, null), originalTextValue = pivlType.GetProperty("OriginalText").GetValue(o, null); // Attributes if (institutionSpecifiedValue != null) { s.WriteAttributeString("isFlexible", institutionSpecifiedValue.ToString().ToLower()); } if (alignmentValue != null) { s.WriteAttributeString("alignment", Util.ToWireFormat(alignmentValue)); } if (countValue != null) { s.WriteAttributeString("count", Util.ToWireFormat(countValue)); } if (operatorValue != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "PIVL", s.ToString())); } if (valueValue != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Value", "PIVL", s.ToString())); } // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } // Phase if (phaseValue != null) { s.WriteStartElement("phase", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, phaseValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } // Frequency or period if (frequencyValue != null) { s.WriteStartElement("frequency", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, frequencyValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); } else if (periodValue != null) { s.WriteStartElement("period", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, periodValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(result.Details); s.WriteEndElement(); if (frequencyValue != null) { result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Warning, "'Period' and 'Frequency' specified, this is not permitted, either 'Period' xor 'Frequency' may be represented. Will only represent 'Period' property", s.ToString(), null)); } } }
/// <summary> /// Graph <paramref name="o"/> onto <paramref name="s"/> /// </summary> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Format base attributes ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); if ((o as ANY).NullFlavor != null) { return; // no need to continue formatting } // Get the values the formatter needs to represent in XML Type ivlType = o.GetType(); object operatorValue = ivlType.GetProperty("Operator").GetValue(o, null), lowValue = ivlType.GetProperty("Low").GetValue(o, null), highValue = ivlType.GetProperty("High").GetValue(o, null), widthValue = ivlType.GetProperty("Width").GetValue(o, null), originalTextValue = ivlType.GetProperty("OriginalText").GetValue(o, null), lowClosedValue = ivlType.GetProperty("LowClosed").GetValue(o, null), highClosedValue = ivlType.GetProperty("HighClosed").GetValue(o, null), valueValue = ivlType.GetProperty("Value").GetValue(o, null); // Low / high closed if (lowClosedValue != null) { s.WriteAttributeString("lowClosed", Util.ToWireFormat(lowClosedValue)); } if (highClosedValue != null) { s.WriteAttributeString("highClosed", Util.ToWireFormat(highClosedValue)); } if (operatorValue != null) { result.AddResultDetail(new UnsupportedDatatypeR2PropertyResultDetail(ResultDetailType.Warning, "Operator", "IVL", s.ToString())); } // Original text if (originalTextValue != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, originalTextValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } bool invalidCombo = false; // Valid combinations if (lowValue != null) { s.WriteStartElement("low", "urn:hl7-org:v3"); // Low value XSI? if (lowValue.GetType() != GenericArguments[0]) { s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(lowValue.GetType())); } var hostResult = this.Host.Graph(s, lowValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); if (highValue.GetType() != GenericArguments[0]) { s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(highValue.GetType())); } hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } invalidCombo |= valueValue != null || widthValue != null; } else if (highValue != null) { s.WriteStartElement("high", "urn:hl7-org:v3"); // High value XSI if (highValue.GetType() != GenericArguments[0]) { s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(highValue.GetType())); } var hostResult = this.Host.Graph(s, highValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); invalidCombo |= valueValue != null || widthValue != null; } if (widthValue != null && ((lowValue == null) ^ (highValue == null) || lowValue == null && highValue == null)) { s.WriteStartElement("width", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, widthValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); if (valueValue != null) { s.WriteStartElement("any", "urn:hl7-org:v3"); // Value value xsi type if (valueValue.GetType() != GenericArguments[0]) { s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(valueValue.GetType())); } hostResult = this.Host.Graph(s, valueValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } invalidCombo |= lowValue != null || highValue != null; } else if (valueValue != null) { s.WriteStartElement("any", "urn:hl7-org:v3"); // Value value xsi type if (valueValue.GetType() != GenericArguments[0]) { s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, DatatypeR2Formatter.CreateXSITypeName(valueValue.GetType())); } var hostResult = this.Host.Graph(s, valueValue as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); invalidCombo |= lowValue != null || highValue != null; } else { invalidCombo = true; } // Invalid combination, warn if (invalidCombo) { result.AddResultDetail(new NotSupportedChoiceResultDetail(ResultDetailType.Warning, "This IVL is not conformant to the ISO21090 data types specification. Only 'Value' and/or 'Width', or 'Low' and/or 'High' are permitted. All data has been serialized but may not be interpreted by a remote system", s.ToString(), null)); } }
/// <summary> /// Graph object <paramref name="o"/> onto <paramref name="s"/> /// </summary> /// <param name="s">The stream being graphed to</param> /// <param name="o">The object being graphed</param> /// <param name="result">The result of the graph operation</param> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Graph the QTY portions QTYFormatter qty = new QTYFormatter(); qty.Host = this.Host; qty.Graph(s, o, result); // Any null flavors IAny anyO = o as IAny; IPrimitiveDataValue ipdv = o as IPrimitiveDataValue; if (anyO.NullFlavor != null) return; // PDV Value does not support value if (ipdv.Value != null) result.AddResultDetail(new NotPermittedDatatypeR2EntityResultDetail(MARC.Everest.Connectors.ResultDetailType.Warning, "Value", "RTO", s.ToString())); // Get the numerator / denominator PropertyInfo numeratorProperty = o.GetType().GetProperty("Numerator"), denominatorProperty = o.GetType().GetProperty("Denominator"); object numerator = numeratorProperty.GetValue(o, null), denominator = denominatorProperty.GetValue(o, null); // Serialize the numerator if (numerator != null) { s.WriteStartElement("numerator", "urn:hl7-org:v3"); // Write the XSI type string xsiTypeName = DatatypeR2Formatter.CreateXSITypeName(numerator.GetType()); // Write the type if (this.Host.Host == null) s.WriteAttributeString("type", DatatypeR2Formatter.NS_XSI, xsiTypeName.ToString()); else s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName.ToString()); var hostResult = this.Host.Graph(s, (IGraphable)numerator); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Serialize Denominator if (denominator != null) { s.WriteStartElement("denominator", "urn:hl7-org:v3"); // Write the XSI type string xsiTypeName = DatatypeR2Formatter.CreateXSITypeName(denominator.GetType()); // Write the type if (this.Host.Host == null) s.WriteAttributeString("type", DatatypeR2Formatter.NS_XSI, xsiTypeName.ToString()); else s.WriteAttributeString("xsi", "type", DatatypeR2Formatter.NS_XSI, xsiTypeName.ToString()); var hostResult = this.Host.Graph(s, (IGraphable)denominator); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } }