Beispiel #1
0
        //
        // - Methods -
        //
        /// <summary>
        /// Method used by the library to serialize this instance to xml.
        /// </summary>
        /// <param name="xmlTextWriter">The xml text writer.</param>
        /// <param name="serializationContext">The serialization context.</param>
        internal void ToXml(XmlTextWriter xmlTextWriter, SerializationContext serializationContext)
        {
            xmlTextWriter.WriteStartElement("numericValue");
            xmlTextWriter.WriteStartElement("value");
            xmlTextWriter.WriteString(NumericValue);
            xmlTextWriter.WriteEndElement();
            xmlTextWriter.WriteEndElement();

            if (this.measurementUnits != null)
            {
                xmlTextWriter.WriteStartElement("measurementUnits");
                this.measurementUnits.ToXml(xmlTextWriter, serializationContext);
                xmlTextWriter.WriteEndElement();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Method used by the library to serialize the value of this instance to xml.
 /// </summary>
 /// <param name="xmlTextWriter">The xml text writer.</param>
 /// <param name="serializationContext">The serialization context.</param>
 internal virtual void ValueToXml(XmlTextWriter xmlTextWriter, SerializationContext serializationContext)
 {
     // Do nothing.
 }
        //
        // - Methods -
        //
        /// <summary>
        /// Method used by the library to serialize this instance to xml.
        /// </summary>
        /// <param name="xmlTextWriter">The xml text writer.</param>
        /// <param name="serializationContext">The serialization context.</param>
        internal override void ValueToXml(XmlTextWriter xmlTextWriter, SerializationContext serializationContext)
        {
            xmlTextWriter.WriteStartElement("num");

            if (this.measuredValue != null)
            {
                xmlTextWriter.WriteStartElement("measuredValue");
                this.measuredValue.ToXml(xmlTextWriter, serializationContext);
                xmlTextWriter.WriteEndElement();
            }

            if (this.numericValueQualifier != null)
            {
                xmlTextWriter.WriteStartElement("numericValueQualifier");
                this.numericValueQualifier.ToXml(xmlTextWriter, serializationContext);
                xmlTextWriter.WriteEndElement();
            }

            xmlTextWriter.WriteEndElement();
        }
Beispiel #4
0
        /// <summary>
        /// Method used by the library to serialize this instance to xml.
        /// </summary>
        /// <param name="xmlTextWriter">The xml text writer.</param>
        /// <param name="serializationContext">The serialization context.</param>
        internal void ToXml(XmlTextWriter xmlTextWriter, SerializationContext serializationContext)
        {
            //
            // Start of Content Item.
            //

            xmlTextWriter.WriteStartElement("contentItem");

            //
            // Identifier.
            //

            xmlTextWriter.WriteAttributeString("identifier", IdentifierAsString);

            //
            // Relationship Type.
            //

            String relationshipType = RelationshipType;

            if (relationshipType != null)
            {
                xmlTextWriter.WriteStartElement("relationshipType");
                xmlTextWriter.WriteStartElement("value");
                xmlTextWriter.WriteString(relationshipType);
                xmlTextWriter.WriteEndElement();
                xmlTextWriter.WriteEndElement();
            }

            //
            // Value Type
            //

            String valueType = ValueType;

            if (valueType != null)
            {
                xmlTextWriter.WriteStartElement("valueType");
                xmlTextWriter.WriteStartElement("value");
                xmlTextWriter.WriteString(valueType);
                xmlTextWriter.WriteEndElement();
                xmlTextWriter.WriteEndElement();
            }

            //
            // Value Type specific.
            //

            xmlTextWriter.WriteStartElement("valueTypeSpecific");
            ValueToXml(xmlTextWriter, serializationContext);
            xmlTextWriter.WriteEndElement();

            //
            // Concept Name
            //

            if (this.conceptName != null)
            {
                xmlTextWriter.WriteStartElement("conceptName");
                ConceptName.ToXml(xmlTextWriter, serializationContext);
                xmlTextWriter.WriteEndElement();
            }

            //
            // Validation results.
            //

            this.validationResults.ToXml(xmlTextWriter, serializationContext);

            //
            // Visitor exceptions.
            //

            if (this.visitorExceptions.Count > 0)
            {
                xmlTextWriter.WriteStartElement("visitorExceptions");

                foreach (Exception exception in this.visitorExceptions)
                {
                    xmlTextWriter.WriteStartElement("visitorException");
                    xmlTextWriter.WriteStartElement("message");
                    xmlTextWriter.WriteString(exception.Message);
                    xmlTextWriter.WriteEndElement();

                    xmlTextWriter.WriteStartElement("innerException");
                    xmlTextWriter.WriteStartElement("message");
                    xmlTextWriter.WriteString(exception.InnerException.Message);
                    xmlTextWriter.WriteEndElement();
                    xmlTextWriter.WriteStartElement("stackTrace");
                    xmlTextWriter.WriteString(exception.InnerException.StackTrace);
                    xmlTextWriter.WriteEndElement();
                    xmlTextWriter.WriteEndElement();

                    xmlTextWriter.WriteEndElement();
                }

                xmlTextWriter.WriteEndElement();
            }

            //
            // Child Content Items.
            //

            if (this.childContentItems.Count > 0)
            {
                xmlTextWriter.WriteStartElement("childContentItems");

                foreach (ContentItem childContentItem in this.childContentItems)
                {
                    childContentItem.ToXml(xmlTextWriter, serializationContext);
                }

                xmlTextWriter.WriteEndElement();

            }

            //
            // End of Content Item.
            //

            xmlTextWriter.WriteEndElement();
        }
Beispiel #5
0
        //
        // - Methods -
        //
        /// <summary>
        /// Serialize this instance (including validation results) to xml.
        /// </summary>
        public void ToXml(string fullFileName)
        {
            XmlTextWriter xmlTextWriter = new XmlTextWriter(fullFileName, null);
            xmlTextWriter.Formatting = Formatting.Indented;
            xmlTextWriter.Indentation = 4;

            xmlTextWriter.WriteStartElement("structuredReports", "http://www.dvtk.org/schemas/SRValidationResult.xsd");
            xmlTextWriter.WriteStartElement("structuredReport");

            SerializationContext serializationContext = new SerializationContext();
            this.rootContentItem.ToXml(xmlTextWriter, serializationContext);
            serializationContext.ToXml(xmlTextWriter);

            xmlTextWriter.WriteEndElement();
            xmlTextWriter.WriteEndElement();

            xmlTextWriter.Close();
        }