/// <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) { // 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> /// 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"/> 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 <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> /// 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"/> /// </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(); // 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) { 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) { // 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> /// 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> /// 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 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> /// 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 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"/> /// </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) { 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) { 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> /// 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> /// 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) { // 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)); } }
public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { ANY instance = o as ANY; IResultDetail[] enumer = new IResultDetail[0], flavor = new IResultDetail[0], invalidAttributes = new IResultDetail[0]; // Now render if (instance == null) { throw new InvalidOperationException("Could not cast object to the ANY data type"); } if (instance.Flavor != null && (instance.NullFlavor == null || (instance is ICodedSimple && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Other)) || (instance is IQuantity && ((NullFlavor)instance.NullFlavor).IsChildConcept(NullFlavor.Derived)) ) ) { s.WriteAttributeString("flavorId", instance.Flavor); } if (instance.NullFlavor != null) { s.WriteAttributeString("nullFlavor", Util.ToWireFormat(instance.NullFlavor)); } else { // Warn if items can't be represented in R2 if (instance.ControlActExt != null) { s.WriteAttributeString("controlInformationExtension", instance.ControlActExt); } if (instance.ControlActRoot != null) { s.WriteAttributeString("controlInformationRoot", instance.ControlActRoot); } if (instance.ValidTimeHigh != null && !instance.ValidTimeHigh.IsNull) { s.WriteAttributeString("validTimeHigh", instance.ValidTimeHigh.Value); } if (instance.ValidTimeLow != null && !instance.ValidTimeLow.IsNull) { s.WriteAttributeString("validTimeLow", instance.ValidTimeLow.Value); } if (instance.UpdateMode != null && !instance.UpdateMode.IsNull) { s.WriteAttributeString("updateMode", Util.ToWireFormat(instance.UpdateMode)); } } string currentElementName = ""; if (s is MARC.Everest.Xml.XmlStateWriter) { currentElementName = (s as MARC.Everest.Xml.XmlStateWriter).CurrentPath; } // Validate if (result.ValidateConformance && !instance.Validate()) { foreach (var r in instance.ValidateEx()) { r.Location = currentElementName; result.AddResultDetail(r); } } //{ // result.AddResultDetail(new DatatypeValidationResultDetail(ResultDetailType.Error, o.GetType().Name, currentElementName)); //} // Disabled for test // Validate flavor... if (result.ValidateConformance && instance.Flavor != null && Util.ValidateFlavor(instance.Flavor.ToUpper(), instance, out flavor) == false) { result.AddResultDetail(new DatatypeFlavorValidationResultDetail(ResultDetailType.Warning, instance.GetType().Name, instance.Flavor, currentElementName)); result.AddResultDetail(flavor); } }
/// <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 <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(); } }
/// <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 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> /// <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) { // 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(); } }
/// <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> public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result) { // Base formatter ANYFormatter baseFormatter = new ANYFormatter(); baseFormatter.Graph(s, o, result); // Next, start to format the properties ICodedSimple cs = o as ICodedSimple; ICodedValue cv = o as ICodedValue; ICodedEquivalents ce = o as ICodedEquivalents; IConceptDescriptor cd = o as IConceptDescriptor; ST displayName = cv.DisplayName; IAny any = o as IAny; // Unless "other" is specified don't serialize if (any.NullFlavor != null && !((NullFlavor)any.NullFlavor).IsChildConcept(NullFlavor.Other)) { return; } // First we need to serialize code, now Code in R2 is a little wierd // It is an IHTSDO standard as described: // http://www.ihtsdo.org/fileadmin/user_upload/Docs_01/Technical_Docs/abstract_models_and_representational_forms.pdf // Serialize attributes first if (cs.CodeValue != null) { try { if (cd != null && cd.Qualifier != null && cd.Qualifier.Count > 0) { s.WriteAttributeString("code", CreateCodeExpression(cd)); displayName = null; } else { s.WriteAttributeString("code", Util.ToWireFormat(cs.CodeValue)); } } catch (Exception e) { result.AddResultDetail(new VocabularyIssueResultDetail(ResultDetailType.Error, e.Message, s.ToString(), e)); } } if (cv.CodeSystem != null) { s.WriteAttributeString("codeSystem", Util.ToWireFormat(cv.CodeSystem)); } if (cv.CodeSystemName != null) { s.WriteAttributeString("codeSystemName", Util.ToWireFormat(cv.CodeSystemName)); } if (cv.CodeSystemVersion != null) { s.WriteAttributeString("codeSystemVersion", Util.ToWireFormat(cv.CodeSystemVersion)); } if (cv.ValueSet != null) { s.WriteAttributeString("valueSet", Util.ToWireFormat(cv.ValueSet)); } if (cv.ValueSetVersion != null) { s.WriteAttributeString("valueSetVersion", Util.ToWireFormat(cv.ValueSetVersion)); } if (cv.CodingRationale != null) { s.WriteAttributeString("codingRationale", Util.ToWireFormat(cv.CodingRationale)); } // Elements // Display name if (displayName != null) { s.WriteStartElement("displayName", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, displayName as IGraphable); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Original text if (cv.OriginalText != null) { s.WriteStartElement("originalText", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, cv.OriginalText); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } // Translation if (ce != null && ce.Translation != null) { foreach (var translation in ce.Translation) { s.WriteStartElement("translation", "urn:hl7-org:v3"); var hostResult = this.Host.Graph(s, translation); result.Code = hostResult.Code; result.AddResultDetail(hostResult.Details); s.WriteEndElement(); } } // Done }