public GetElementById ( string id ) : |
||
id | string | The required id attribute value. |
return |
private static bool Rule01(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in list) { XmlElement generic = XPath.Path (context, "generic"); XmlAttribute href; XmlElement target; if ((generic == null) || ((href = generic.GetAttributeNode ("href")) == null) || ((target = nodeIndex.GetElementById (href.Value)) == null)) continue; string targetName = target.LocalName; if (targetName.Equals ("basket") || targetName.Equals ("cash") || targetName.Equals ("commodity") || targetName.Equals ("deposit") || targetName.Equals ("bond") || targetName.Equals ("convertibleBond") || targetName.Equals ("equity") || targetName.Equals ("exchangeTradedFund") || targetName.Equals ("index") || targetName.Equals ("future") || targetName.Equals ("fxRate") || targetName.Equals ("loan") || targetName.Equals ("mortgage") || targetName.Equals ("mutualFund") || targetName.Equals ("rateIndex") || targetName.Equals ("simpleCreditDefautSwap") || targetName.Equals ("simpleFra") || targetName.Equals ("simpleIrSwap") || targetName.Equals ("dealSummary") || targetName.Equals ("facilitySummary")) continue; errorHandler ("305", context, "generic/@href must match the @id attribute of an element of type Asset", name, targetName); result = false; } return (result); }
//--------------------------------------------------------------------- private static bool Rule17(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in XPath.Paths (nodeIndex.GetElementsByName ("tradeSide"), "*", "account")) { string href = context.GetAttribute ("href"); XmlElement target = nodeIndex.GetElementById (href); if (target.LocalName.Equals ("account")) continue; errorHandler ("305", context, "The value of the href attribute does not refer to an account structure", name, href); result = false; } return (result); }
private static bool Rule02(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in list) { XmlAttribute href; XmlElement target; if (((href = context.GetAttributeNode ("href")) == null) || ((target = nodeIndex.GetElementById (href.Value)) == null)) continue; string targetName = target.LocalName; if (targetName.Equals ("creditCurve") || targetName.Equals ("fxCurve") || targetName.Equals ("volatilityRepresentation") || targetName.Equals ("yieldCurve")) continue; errorHandler ("305", context, "@href must match the @id attribute of an element of type PricingStructure", name, targetName); result = false; } return (result); }
private static bool Rule14B(string name, XmlNodeList list, ValidationErrorHandler errorHandler, NodeIndex nodeIndex) { bool result = true; foreach (XmlElement context in list) { string href = context.GetAttribute ("href"); XmlElement referred = nodeIndex.GetElementById (href); if ((referred != null) && referred.LocalName.Equals ("party")) continue; errorHandler ("305", context, "Calculation agent party reference '" + context.GetAttribute ("href") + "' does not match a party defined in the document.", name, context.GetAttribute ("href")); result = false; } return (result); }
private static bool Rule13A(string name, XmlNodeList list, ValidationErrorHandler errorHandler, NodeIndex nodeIndex) { bool result = true; foreach (XmlElement context in list) { string href = context.GetAttribute ("href"); if ((href == null) || (href.Length < 2) || (href [0] != '#')) { errorHandler ("305", context, "The @href attribute is not a valid XPointer", name, href); result = false; continue; } XmlElement referred = nodeIndex.GetElementById (href.Substring (1)); if ((referred != null) && (referred.LocalName.Equals ("party") || referred.LocalName.Equals ("tradeSide"))) continue; errorHandler ("305", context, "Seller party reference '" + context.GetAttribute ("href") + "' does not match a party defined in the document.", name, context.GetAttribute ("href")); result = false; } return (result); }
private static bool Rule26(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in nodeIndex.GetElementsByName ("businessCentersReference")) { string href = context.GetAttribute ("href"); // Handle XPointer syntax if ((href != null) && (href.Length > 1) && (href [0] == '#')) href = href.Substring (1); XmlElement target = nodeIndex.GetElementById (href); if ((target == null) || (target.LocalName.Equals ("businessCenters"))) continue; errorHandler ("305", context, "The businessCenterReference/@href attribute must reference a businessCenters element", name, context.GetAttribute ("href")); result = false; } return (result); }
private static bool Rule24(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in list) { XmlElement datesRef = XPath.Path (context, "calculationPeriodDatesReference"); if (datesRef == null) continue; string href = datesRef.GetAttribute ("href"); // Remove leading # from XPointer type references if ((href != null) && (href.Length > 0) && (href [0] == '#')) href = href.Substring (1); XmlElement periodDates = nodeIndex.GetElementById (href); if (periodDates == null) continue; if (Implies ( Exists (XPath.Path (context, "finalStub")), Exists (XPath.Path (periodDates, "lastRegularPeriodEndDate")))) continue; errorHandler ("305", context, "Final stub is present but no last regular period end date is defined " + "in the referenced calculation period dates", name, null); result = false; } return (result); }
private static bool Rule02(string name, NodeIndex nodeIndex, XmlNodeList list, ValidationErrorHandler errorHandler) { bool result = true; foreach (XmlElement context in list) { XmlElement startDate = XPath.Path (context, "novation", "firstPeriodStartDate"); XmlAttribute href; if ((startDate == null) || (href = startDate.GetAttributeNode ("href"))== null) continue; XmlElement target = nodeIndex.GetElementById (href.Value); if ((target == null) || !target.LocalName.Equals("party")) { errorHandler ("305", context, "The @href attribute on the firstPeriodStartDate must reference a party", name, href.Value); result = false; } } return (result); }