Beispiel #1
0
        /// <summary>
        /// Parse DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent
        /// </summary>
        public static Hl7.Fhir.Model.DeviceCapabilities.DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent ParseDeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DeviceCapabilities.DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent existingInstance = null)
        {
            Hl7.Fhir.Model.DeviceCapabilities.DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DeviceCapabilities.DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if (atName == "extension")
                {
                    result.Extension = new List <Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "extension"))
                    {
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element _id
                else if (atName == "_id")
                {
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
                }

                // Parse element code
                else if (atName == "code")
                {
                    result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element scale
                else if (atName == "scale")
                {
                    result.ScaleElement = FhirDecimalParser.ParseFhirDecimal(reader, errors);
                }

                // Parse element key
                else if (atName == "key")
                {
                    result.KeyElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element info
                else if (atName == "info")
                {
                    result.Info = DeviceCapabilitiesParser.ParseDeviceCapabilitiesVirtualDeviceChannelMetricInfoComponent(reader, errors);
                }

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return(result);
        }
        public static void SerializeDeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent(Hl7.Fhir.Model.DeviceCapabilities.DeviceCapabilitiesVirtualDeviceChannelMetricFacetComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element code
            if (value.Code != null)
            {
                writer.WriteStartElement("code");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Code, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element scale
            if (value.ScaleElement != null)
            {
                writer.WriteStartElement("scale");
                FhirDecimalSerializer.SerializeFhirDecimal(value.ScaleElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element key
            if (value.KeyElement != null)
            {
                writer.WriteStartElement("key");
                FhirStringSerializer.SerializeFhirString(value.KeyElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element info
            if (value.Info != null)
            {
                writer.WriteStartElement("info");
                DeviceCapabilitiesSerializer.SerializeDeviceCapabilitiesVirtualDeviceChannelMetricInfoComponent(value.Info, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }