/// <summary>
        /// Writes the lab test type data to the specified XML writer.
        /// </summary>
        ///
        /// <param name="nodeName">
        /// The name of the outer element for the lab test type.
        /// </param>
        ///
        /// <param name="writer">
        /// The XmlWriter to write the lab test type to.
        /// </param>
        ///
        /// <exception cref="ArgumentException">
        /// The <paramref name="nodeName"/> parameter is <b>null</b> or empty.
        /// </exception>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="writer"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void WriteXml(string nodeName, XmlWriter writer)
        {
            Validator.ThrowIfStringNullOrEmpty(nodeName, "nodeName");
            Validator.ThrowIfWriterNull(writer);

            writer.WriteStartElement(nodeName);

            _when = new HealthServiceDateTime();
            _when.WriteXml("when", writer);

            XmlWriterHelper.WriteOptString(writer, "name", _name);
            XmlWriterHelper.WriteOpt(writer, "substance", _substance);
            XmlWriterHelper.WriteOpt(writer, "collection-method", _collectionMethod);
            XmlWriterHelper.WriteOptString(writer, "abbreviation", _abbreviation);
            XmlWriterHelper.WriteOptString(writer, "description", _description);

            foreach (CodableValue codeValue in _code)
            {
                codeValue.WriteXml("code", writer);
            }

            XmlWriterHelper.WriteOpt(writer, "result", _result);
            XmlWriterHelper.WriteOpt(writer, "status", _status);

            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes the mensrual flow data to the specified XmlWriter.
        /// </summary>
        ///
        /// <param name="writer">
        /// The XmlWriter to write the menstrual flow data to.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="writer"/> is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="ThingSerializationException">
        /// If <see cref="When"/> is <b>null</b>.
        /// </exception>
        ///
        public override void WriteXml(XmlWriter writer)
        {
            Validator.ThrowIfWriterNull(writer);
            Validator.ThrowSerializationIfNull(_when, Resources.WhenNullValue);

            // <menstrual-flow>
            writer.WriteStartElement("menstruation");

            // <when>
            _when.WriteXml("when", writer);

            // <is-new-cycle>
            XmlWriterHelper.WriteOptBool(writer, "is-new-cycle", _isNewCycle);

            // <amount>
            XmlWriterHelper.WriteOpt(writer, "amount", _amount);

            // </menstrual-flow>
            writer.WriteEndElement();
        }