本文整理汇总了C#中HandCoded.Xml.NodeIndex类的典型用法代码示例。如果您正苦于以下问题:C# NodeIndex类的具体用法?C# NodeIndex怎么用?C# NodeIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeIndex类属于HandCoded.Xml命名空间,在下文中一共展示了NodeIndex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
/// <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)
{
foreach (string rootElement in release.RootElements) {
XmlNodeList list = nodeIndex.GetElementsByName (rootElement);
if (list.Count == 1) {
XmlElement fpml = list [0] as XmlElement;
if (fpml.LocalName.Equals("FpML"))
return (fpml.GetAttribute ("version").Equals (release.Version));
else
return (fpml.GetAttribute ("fpmlVersion").Equals (release.Version));
}
}
return (false);
}
示例2: Evaluate
/// <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);
}
示例3: 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);
}
示例4: PerformValidation
internal bool PerformValidation(NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Validate (nodeIndex, errorHandler));
}
示例5: AppliesTo
/// <summary>
/// Determines if the <b>Rule</b> applies to a document but evaluating
/// its <see cref="Precondition"/>.
/// </summary>
/// <param name="nodeIndex">The <see cref="NodeIndex"/> of the document.</param>
/// <returns><c>true</c> if the <b>Rule</b> applies, <c>false</c> otherwise.</returns>
public bool AppliesTo(NodeIndex nodeIndex)
{
return (precondition.Evaluate (nodeIndex, new Dictionary<Precondition,bool> ()));
}
示例6: Rule01
// --------------------------------------------------------------------
private static bool Rule01(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
if (nodeIndex.HasTypeInformation)
return (Rule01 (name, nodeIndex, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "PricingDataPointCoordinate"), errorHandler));
return (Rule01 (name, nodeIndex, nodeIndex.GetElementsByName ("coordinate"), errorHandler));
}
示例7: Rule02
// --------------------------------------------------------------------
private static bool Rule02(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
if (nodeIndex.HasTypeInformation)
return (Rule02 (name, nodeIndex, nodeIndex.GetElementsByType (DetermineNamespace (nodeIndex), "PaymentCalculationPeriod"), errorHandler));
return (Rule02 (name, nodeIndex, nodeIndex.GetElementsByName ("paymentCalculationPeriod"), errorHandler));
}
示例8: Rule14
// --------------------------------------------------------------------
private static bool Rule14(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
bool result = true;
foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
foreach (XmlElement seller in XPath.Paths (context, "protectionTerms", "creditEvents", "creditEventNotice", "notifyingParty", "sellerPartyReference")) {
if (Equal (seller.GetAttribute ("href"),
XPath.Path (context, "generalTerms", "sellerPartyReference").GetAttribute ("href")))
continue;
errorHandler ("305", context,
"If protectionTerms/creditEvents/creditEventNotice/notifyingParty/sellerPartyReference " +
"is present, its @href attribute must match that of generalTerms/sellerPartyReference",
name, null);
result = false;
}
}
return (result);
}
示例9: Rule12
// --------------------------------------------------------------------
private static bool Rule12(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
bool result = true;
foreach (XmlElement context in nodeIndex.GetElementsByName ("referenceInformation")) {
if (Exists (context ["referencePrice"])) {
if (GreaterOrEqual (context ["referencePrice"], 0.0))
continue;
errorHandler ("305", context,
"If referencePrice is present it must not have a negative " +
"value",
name, context ["referencePrice"].InnerText);
result = false;
}
}
return (result);
}
示例10: Rule37
// --------------------------------------------------------------------
private static bool Rule37(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Rule37 (name, nodeIndex.GetElementsByName ("cashSettlementTerms"), errorHandler));
}
示例11: Rule36
// --------------------------------------------------------------------
private static bool Rule36(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Rule36 (name, XPath.Paths (nodeIndex.GetElementsByName ("creditEvents"), "creditEventNotice", "publiclyAvailableInformation"), errorHandler));
}
示例12: Rule35
// --------------------------------------------------------------------
private static bool Rule35(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Rule35 (name, nodeIndex.GetElementsByName ("creditEvents"), errorHandler));
}
示例13: Rule34
// --------------------------------------------------------------------
private static bool Rule34(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Rule34 (name, nodeIndex.GetElementsByName ("deliverableObligations"), errorHandler));
}
示例14: Rule33
// --------------------------------------------------------------------
private static bool Rule33(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
return (Rule33 (name, nodeIndex.GetElementsByName ("periodicPayment"), errorHandler));
}
示例15: Rule30
// --------------------------------------------------------------------
private static bool Rule30(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
{
bool result = true;
foreach (XmlElement context in nodeIndex.GetElementsByName ("creditDefaultSwap")) {
XmlElement paymentDate;
XmlElement terminationDate;
if (And (
Exists (paymentDate = XPath.Path (context, "feeLeg", "periodicPayment", "lastRegularPaymentDate")),
Exists (terminationDate = XPath.Path (context, "generalTerms", "scheduledTerminationDate", "adjustableDate", "unadjustedDate")))) {
if (Less (paymentDate, terminationDate)) continue;
errorHandler ("305", context,
"Last regular periodic payment date '" + paymentDate.InnerText + "' " +
"must be before the termination date '" + terminationDate.InnerText + "'",
name, null);
result = false;
}
}
return (result);
}