/// <summary> /// Writes the XML representation of the CarePlan into /// the specified XML writer. /// </summary> /// /// <param name="writer"> /// The XML writer into which the CarePlan should be /// written. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="writer"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ThingSerializationException"> /// If <see cref="Name"/> is <b>null</b> or empty or contains only whitespace. /// </exception> /// public override void WriteXml(XmlWriter writer) { Validator.ThrowIfArgumentNull(writer, nameof(writer), Resources.WriteXmlNullWriter); if (string.IsNullOrEmpty(_name) || string.IsNullOrEmpty(_name.Trim())) { throw new ThingSerializationException(Resources.CarePlanNameNullOrEmpty); } writer.WriteStartElement("care-plan"); { writer.WriteElementString("name", _name); XmlWriterHelper.WriteOpt(writer, "start-date", _startDate); XmlWriterHelper.WriteOpt(writer, "end-date", _endDate); XmlWriterHelper.WriteOpt(writer, "status", _status); XmlWriterHelper.WriteXmlCollection(writer, "care-team", _careTeam, "person"); XmlWriterHelper.WriteOpt(writer, "care-plan-manager", _carePlanManager); XmlWriterHelper.WriteXmlCollection(writer, "tasks", _tasks, "task"); XmlWriterHelper.WriteXmlCollection(writer, "goal-groups", _goalGroups, "goal-group"); } writer.WriteEndElement(); }
/// <summary> /// Writes the XML representation of the MealDefinition into /// the specified XML writer. /// </summary> /// /// <param name="writer"> /// The XML writer into which the MealDefinition should be /// written. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="writer"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ThingSerializationException"> /// If <see cref="Name"/> is <b>null</b>. /// </exception> /// public override void WriteXml(XmlWriter writer) { Validator.ThrowIfWriterNull(writer); Validator.ThrowSerializationIfNull(_name, Resources.MealDefinitionNameNullValue); writer.WriteStartElement("meal-definition"); _name.WriteXml("name", writer); XmlWriterHelper.WriteOpt(writer, "meal-type", _mealType); XmlWriterHelper.WriteOptString(writer, "description", _description); XmlWriterHelper.WriteXmlCollection(writer, "dietary-items", _dietaryIntakeItems, "dietary-item"); writer.WriteEndElement(); }
/// <summary> /// Writes the defibrillator episode data to the specified XmlWriter. /// </summary> /// /// <param name="writer"> /// The XmlWriter to write the defibrillator data to. /// </param> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="writer"/> is <b>null</b>. /// </exception> /// public override void WriteXml(XmlWriter writer) { Validator.ThrowIfWriterNull(writer); Validator.ThrowSerializationIfNull(_when, Resources.DefibrillatorEpisodeWhenNullValue); writer.WriteStartElement("defibrillator-episode"); _when.WriteXml("when", writer); XmlWriterHelper.WriteOpt(writer, "episode-type-group", _episodeTypeGroup); XmlWriterHelper.WriteOpt(writer, "episode-type", _episodeType); XmlWriterHelper.WriteOpt(writer, "data-source", _dataSource); XmlWriterHelper.WriteOptUInt(writer, "duration-in-seconds", _durationInSeconds); writer.WriteStartElement("episode-fields"); XmlWriterHelper.WriteXmlCollection(writer, _episodeFields, "episode-field"); writer.WriteEndElement(); writer.WriteEndElement(); }
/// <summary> /// Writes the XML representation of the CarePlanGoalGroup into /// the specified XML writer. /// </summary> /// /// <param name="nodeName"> /// The name of the outer node for the medical image study series. /// </param> /// /// <param name="writer"> /// The XML writer into which the CarePlanGoalGroup should be /// written. /// </param> /// /// <exception cref="ArgumentException"> /// If <paramref name="nodeName"/> parameter is <b>null</b> or empty. /// </exception> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="writer"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ThingSerializationException"> /// If <see cref="Name"/> is <b>null</b>. /// If <see cref="Goals"/> is <b>null</b>. /// </exception> /// public override void WriteXml(string nodeName, XmlWriter writer) { Validator.ThrowIfStringNullOrEmpty(nodeName, "nodeName"); Validator.ThrowIfWriterNull(writer); Validator.ThrowSerializationIfNull(_name, Resources.CarePlanGoalGroupNameNull); Validator.ThrowSerializationIfNull(_goals, Resources.CarePlanGoalGroupGroupsNull); if (_goals.Count == 0) { throw new ThingSerializationException(Resources.CarePlanGoalGroupGroupsEmpty); } writer.WriteStartElement("goal-group"); { _name.WriteXml("name", writer); XmlWriterHelper.WriteOptString(writer, "description", _description); XmlWriterHelper.WriteXmlCollection(writer, "goals", _goals, "goal"); } writer.WriteEndElement(); }