/// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/> saving
        /// results in <paramref name="result"/>
        /// </summary>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result)
        {
            // Base formatter is the CD type
            CDFormatter baseFormatter = new CDFormatter();

            baseFormatter.Host = this.Host;

            // Graph the value if the null flavor of the object is not null
            PQR opqr = o as PQR;

            if (opqr.NullFlavor == null && opqr.Value.HasValue)
            {
                // Precision
                if (opqr.Precision == null)
                {
                    s.WriteAttributeString("value", Util.ToWireFormat(opqr.Value));
                }
                else
                {
                    s.WriteAttributeString("value", String.Format(String.Format("{{0:0.{0}}}", new String('0', opqr.Precision)), opqr.Value));
                }
            }

            // Graph the base stuff
            baseFormatter.Graph(s, o, result);
        }
Exemple #2
0
        /// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        public void Graph(System.Xml.XmlWriter s, object o, DatatypeR2FormatterGraphResult result)
        {
            var any = o as IAny;

            // Output flavor id
            if (any.Flavor == null && (any.NullFlavor == null || ((NullFlavor)any.NullFlavor).IsChildConcept(NullFlavor.Other)))
            {
                s.WriteAttributeString("flavorId", "CD.CV");
            }

            // Do a base format
            CDFormatter realFormatter = new CDFormatter();

            realFormatter.Host = this.Host;
            realFormatter.Graph(s, o, result);
        }