本文整理汇总了C#中HandCoded.Xml.NodeIndex.GetElementById方法的典型用法代码示例。如果您正苦于以下问题:C# NodeIndex.GetElementById方法的具体用法?C# NodeIndex.GetElementById怎么用?C# NodeIndex.GetElementById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HandCoded.Xml.NodeIndex
的用法示例。
在下文中一共展示了NodeIndex.GetElementById方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Rule01
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);
}
示例2: Rule17
//---------------------------------------------------------------------
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);
}
示例3: Rule02
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);
}
示例4: Rule14B
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);
}
示例5: Rule13A
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);
}
示例6: Rule26
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);
}
示例7: Rule24
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);
}
示例8: Rule02
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);
}