public GetAttributesByName ( string name ) : |
||
name | string | The name of the required elements. |
return |
/// <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) { HandCoded.FpML.Util.Version version; // Find the document version XmlNodeList list = nodeIndex.GetElementsByName ("FpML"); if (list.Count > 0) version = FpML.Util.Version.Parse (((XmlElement) list [0]).GetAttribute ("version")); else { list = nodeIndex.GetAttributesByName ("fpmlVersion"); if (list.Count > 0) version = FpML.Util.Version.Parse (((XmlAttribute) list [0]).Value); else return (false); } // System.Console.Write ("Range (Doc=" + version // + " Min=" + ((minimumVersion != null) ? minimumVersion.ToString () : "*") // + " Max=" + ((maximumVersion != null) ? maximumVersion.ToString () : "*")); bool validMin = (minimumVersion != null) ? (version.CompareTo (minimumVersion) >= 0) : true; bool validMax = (maximumVersion != null) ? (version.CompareTo (maximumVersion) <= 0) : true; // System.Console.WriteLine (") => " + (validMin & validMax)); return (validMin & validMax); }