/// <summary>
        /// Used primarily by <see cref="ICdsElement.ToXml"/> implementations.
        /// <para>
        /// Implementation will assign some default implementaitons
        /// to the unassigned <see cref="ToXmlFormatter.Method"/> fields
        /// of the "formatter" argument, unless information in
        /// the "data" argument specify otherwise.
        /// The assigned delegates are obtained from the "obj" argument's
        /// implementations of the <see cref="IToXmlData"/> methods.
        /// </para>
        /// <para>
        /// After assigning delegate implementations to the "formatter", the
        /// method calls <see cref="ToXmlFormatter.ToXml"/> to complete
        /// the standard implementation.
        /// </para>
        /// </summary>
        /// <param name="obj">This object provides the implementations assigned to the formatter argument.</param>
        /// <param name="formatter">
        /// A <see cref="ToXmlFormatter"/> object that
        /// specifies method implementations for printing
        /// media objects. Delegate fields may be reassigned here
        /// if they are null.
        /// </param>
        /// <param name="data">
        /// This object should be a <see cref="ToXmlData"/>
        /// object that contains additional instructions used
        /// by the "formatter" argument.
        /// </param>
        /// <param name="xmlWriter">
        /// The <see cref="XmlTextWriter"/> object that
        /// will format the representation in an XML
        /// valid way.
        /// </param>
        public static void ToXml(IToXmlData obj, ToXmlFormatter formatter, ToXmlData data, XmlTextWriter xmlWriter)
        {
            ToXmlData _d = (ToXmlData)data;

            if ((formatter.StartElement == null) && (_d.IncludeElementDeclaration == true))
            {
                formatter.StartElement = new ToXmlFormatter.Method(obj.StartElement);
            }

            if ((formatter.WriteInnerXml == null) && (_d.IncludeInnerXml == true))
            {
                formatter.WriteInnerXml = new ToXmlFormatter.Method(obj.WriteInnerXml);
            }

            if ((formatter.WriteValue == null) && (_d.IncludeValue == true))
            {
                formatter.WriteValue = new ToXmlFormatter.Method(obj.WriteValue);
            }

            if ((formatter.EndElement == null) && (_d.IncludeElementDeclaration == true))
            {
                formatter.EndElement = new ToXmlFormatter.Method(obj.EndElement);
            }

            // Now call those implementations.
            ToXmlFormatter.ToXml(formatter, data, xmlWriter);
        }
Esempio n. 2
0
		/// <summary>
		/// Used primarily by <see cref="ICdsElement.ToXml"/> implementations.
		/// <para>
		/// Implementation will assign some default implementaitons
		/// to the unassigned <see cref="ToXmlFormatter.Method"/> fields 
		/// of the "formatter" argument, unless information in
		/// the "data" argument specify otherwise.
		/// The assigned delegates are obtained from the "obj" argument's
		/// implementations of the <see cref="IToXmlData"/> methods.
		/// </para>
		/// <para>
		/// After assigning delegate implementations to the "formatter", the
		/// method calls <see cref="ToXmlFormatter.ToXml"/> to complete
		/// the standard implementation.
		/// </para>
		/// </summary>
		/// <param name="obj">This object provides the implementations assigned to the formatter argument.</param>
		/// <param name="formatter">
		/// A <see cref="ToXmlFormatter"/> object that
		/// specifies method implementations for printing
		/// media objects. Delegate fields may be reassigned here
		/// if they are null.
		/// </param>
		/// <param name="data">
		/// This object should be a <see cref="ToXmlData"/>
		/// object that contains additional instructions used
		/// by the "formatter" argument.
		/// </param>
		/// <param name="xmlWriter">
		/// The <see cref="XmlTextWriter"/> object that
		/// will format the representation in an XML
		/// valid way.
		/// </param>
		public static void ToXml(IToXmlData obj, ToXmlFormatter formatter, ToXmlData data, XmlTextWriter xmlWriter)
		{
			ToXmlData _d = (ToXmlData) data;
			if ((formatter.StartElement == null) && (_d.IncludeElementDeclaration == true))
			{
				formatter.StartElement = new ToXmlFormatter.Method (obj.StartElement);
			}
			
			if ((formatter.WriteInnerXml == null) && (_d.IncludeInnerXml == true))
			{
				formatter.WriteInnerXml = new ToXmlFormatter.Method (obj.WriteInnerXml);
			}

			if ((formatter.WriteValue == null) && (_d.IncludeValue == true))
			{
				formatter.WriteValue = new ToXmlFormatter.Method (obj.WriteValue);
			}

			if ((formatter.EndElement == null) && (_d.IncludeElementDeclaration == true))
			{
				formatter.EndElement = new ToXmlFormatter.Method (obj.EndElement);
			}

			// Now call those implementations.
			ToXmlFormatter.ToXml(formatter, data, xmlWriter);
		}