コード例 #1
0
 /// <summary>
 /// Writes the answer to an XML writer.
 /// </summary>
 /// <param name="writer">XML writer.</param>
 /// <param name="writeDontSave">Indicates if the answer should be written even if it is not supposed to be saved.</param>
 public override void WriteXml(System.Xml.XmlWriter writer, bool writeDontSave)
 {
     if (!writeDontSave && !Save)
     {
         return;
     }
     writer.WriteStartElement("Answer");
     writer.WriteAttributeString("name", TextValue.XMLEscape(Name));
     if (!Save)
     {
         writer.WriteAttributeString("save", System.Xml.XmlConvert.ToString(Save));
     }
     if (!_userExtendible)
     {
         writer.WriteAttributeString("userExtendible", System.Xml.XmlConvert.ToString(_userExtendible));
     }
     _value.WriteXml(writer, Depth);
     writer.WriteEndElement();
 }
コード例 #2
0
        /// <summary>
        /// Writes the XML representation of the answer.
        /// </summary>
        /// <param name="writer">The XmlWriter to which to write the answer value.</param>
        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("MCValue");

            if (_protect)
            {
                writer.WriteAttributeString("userModifiable", System.Xml.XmlConvert.ToString(!_protect));
            }

            if (IsAnswered)
            {
                for (int i = 0; i < _value.Length; i++)
                {
                    writer.WriteElementString("SelValue", TextValue.XMLEscape(_value[i]));
                }
            }
            else
            {
                writer.WriteAttributeString("unans", System.Xml.XmlConvert.ToString(true));
            }

            writer.WriteEndElement();
        }