当前位置: 首页>>代码示例>>C#>>正文


C# Xml.NodeIndex类代码示例

本文整理汇总了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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:24,代码来源:VersionPrecondition.cs

示例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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:28,代码来源:ContentPrecondition.cs

示例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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:22,代码来源:BusinessProcessRules.cs

示例4: PerformValidation

 internal bool PerformValidation(NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Validate (nodeIndex, errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:4,代码来源:Validator.cs

示例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> ()));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:10,代码来源:Rule.cs

示例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));
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:8,代码来源:PricingAndRiskRules.cs

示例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));
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:8,代码来源:PricingAndRiskRules.cs

示例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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:21,代码来源:CdsRules.cs

示例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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:20,代码来源:CdsRules.cs

示例10: Rule37

 // --------------------------------------------------------------------
 private static bool Rule37(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule37 (name, nodeIndex.GetElementsByName ("cashSettlementTerms"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs

示例11: Rule36

 // --------------------------------------------------------------------
 private static bool Rule36(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule36 (name, XPath.Paths (nodeIndex.GetElementsByName ("creditEvents"), "creditEventNotice", "publiclyAvailableInformation"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs

示例12: Rule35

 // --------------------------------------------------------------------
 private static bool Rule35(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule35 (name, nodeIndex.GetElementsByName ("creditEvents"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs

示例13: Rule34

 // --------------------------------------------------------------------
 private static bool Rule34(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule34 (name, nodeIndex.GetElementsByName ("deliverableObligations"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs

示例14: Rule33

 // --------------------------------------------------------------------
 private static bool Rule33(string name, NodeIndex nodeIndex, ValidationErrorHandler errorHandler)
 {
     return (Rule33 (name, nodeIndex.GetElementsByName ("periodicPayment"), errorHandler));
 }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:5,代码来源:CdsRules.cs

示例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);
        }
开发者ID:formicary,项目名称:fpml-toolkit-csharp,代码行数:24,代码来源:CdsRules.cs


注:本文中的HandCoded.Xml.NodeIndex类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。