Ejemplo n.º 1
0
        /// <summary>
        /// Determine if two <see cref="XmlElement"/> structures containing
        /// <b>currency</b> instances have the same currency codes belonging to
        /// the same currency code scheme.
        /// </summary>
        /// <param name="ccy1">The first currency <see cref="XmlElement"/>.</param>
        /// <param name="ccy2">The second currency <see cref="XmlElement"/>.</param>
        /// <returns><c>true</c> if both <b>currency</b> structures have the same code.</returns>
        protected static bool IsSameCurrency(XmlElement ccy1, XmlElement ccy2)
        {
            string uri1 = DOM.GetAttribute(ccy1, "currencyScheme");
            string uri2 = DOM.GetAttribute(ccy2, "currencyScheme");

            if ((uri1 != null) && (uri2 != null) && uri1.Equals(uri2))
            {
                return(Equal(ccy1, ccy2));
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// If the releases file defines a custom class loader to be used the process
        /// the data block identified by the context element then return its name,
        /// otherwise return the indicated default class name.
        /// </summary>
        /// <param name="context">The context <see cref="XmlElement"/>.</param>
        /// <param name="defaultClass">The name of the default class loader if not overridden.</param>
        /// <returns>The name of the class loader to be instantiated.</returns>
        private static string GetClassLoader(XmlElement context, string defaultClass)
        {
            foreach (XmlElement element in XPath.Paths(context, "classLoader"))
            {
                string platform = DOM.GetAttribute(element, "platform");

                if ((platform != null) && platform.Equals(".Net"))
                {
                    return(DOM.GetAttribute(element, "class"));
                }
            }
            return(defaultClass);
        }
        private static bool Rule38(string name, XmlNodeList list, ValidationErrorHandler errorHandler)
        {
            bool result = true;

            foreach (XmlElement context     in list)
            {
                XmlElement dateRef  = XPath.Path(context, "cashSettlement", "cashSettlementValuationDate", "dateRelativeTo");
                XmlElement termDate = XPath.Path(context, "mandatoryEarlyTerminationDate");

                if ((dateRef == null) || (termDate == null) ||
                    DOM.GetAttribute(dateRef, "href").Equals(DOM.GetAttribute(termDate, "id")))
                {
                    continue;
                }

                errorHandler("305", context,
                             "The cash settlement valuation date should reference the" +
                             "mandatory termination date",
                             name, DOM.GetAttribute(dateRef, "href"));
                result = false;
            }
            return(result);
        }