HandCoded.FpML.Validation.FpMLRuleSet.DetermineNamespace C# (CSharp) Method

DetermineNamespace() protected static method

Determines the namespace URI of the FpML document.
protected static DetermineNamespace ( NodeIndex nodeIndex ) : String
nodeIndex HandCoded.Xml.NodeIndex A of the entire document.
return String
        protected internal static String DetermineNamespace(NodeIndex nodeIndex)
        {
            return (nodeIndex.Document.DocumentElement.NamespaceURI);
        }

Usage Example

        /// <summary>
        /// Evaluates this <see cref="Precondition"/> against the contents of the
        /// indicated <see cref="NodeIndex"/>.
        /// </summary>
        /// <param name="nodeIndex">The <see cref="NodeIndex"/> of a <see cref="XmlDocument"/></param>
        /// <param name="cache">A cache of previously evaluated precondition results.</param>
        /// <returns>A <see cref="bool"/> value indicating the applicability of this
        /// <see cref="Precondition"/> to the <see cref="XmlDocument"/>.</returns>
        public override bool Evaluate(NodeIndex nodeIndex, Dictionary <Precondition, bool> cache)
        {
            if (nodeIndex.HasTypeInformation)
            {
                string ns = FpMLRuleSet.DetermineNamespace(nodeIndex);

                foreach (string type in types)
                {
                    XmlNodeList list = nodeIndex.GetElementsByType(ns, type);

                    if ((list != null) && (list.Count > 0))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                foreach (String element in elements)
                {
                    XmlNodeList list = nodeIndex.GetElementsByName(element);

                    if ((list != null) && (list.Count > 0))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
All Usage Examples Of HandCoded.FpML.Validation.FpMLRuleSet::DetermineNamespace