本文整理汇总了C#中System.Xml.XmlNode.SelectNodes方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.SelectNodes方法的具体用法?C# XmlNode.SelectNodes怎么用?C# XmlNode.SelectNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.SelectNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public object Create (object parent, object configContext, XmlNode section)
{
Hashtable engines = new Hashtable ();
foreach (XmlNode engineNode in section.SelectNodes ("engines/engine")) {
EngineConfig engine = EngineConfig.FromXml (engineNode);
if (engines.Contains (engine.Name)) {
string msg = string.Format (CultureInfo.InvariantCulture,
"A engine with name '{0}' already exists.",
engine.Name);
throw new ConfigurationErrorsException (msg, engineNode);
}
engines.Add (engine.Name, engine);
}
Hashtable connections = new Hashtable ();
foreach (XmlNode connNode in section.SelectNodes ("connections/connection")) {
ConnectionConfig conn = ConnectionConfig.FromXml (connNode, engines);
if (connections.Contains (conn.Name)) {
string msg = string.Format (CultureInfo.InvariantCulture,
"A connection with name '{0}' already exists.",
conn.Name);
throw new ConfigurationErrorsException (msg, connNode);
}
connections.Add (conn.Name, conn);
}
ConnectionConfig [] c = new ConnectionConfig [connections.Count];
connections.Values.CopyTo (c, 0);
return c;
}
示例2: ValuationDocument
public ValuationDocument(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList marketNodeList = xmlNode.SelectNodes("market");
if (marketNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in marketNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
marketIDRef = item.Attributes["id"].Name;
Market ob = Market();
IDManager.SetID(marketIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
marketIDRef = item.Attributes["href"].Name;
}
else
{
market = new Market(item);
}
}
}
XmlNodeList valuationSetNodeList = xmlNode.SelectNodes("valuationSet");
if (valuationSetNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in valuationSetNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
valuationSetIDRef = item.Attributes["id"].Name;
ValuationSet ob = ValuationSet();
IDManager.SetID(valuationSetIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
valuationSetIDRef = item.Attributes["href"].Name;
}
else
{
valuationSet = new ValuationSet(item);
}
}
}
}
示例3: IndexChange
public IndexChange(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList indexFactorNodeList = xmlNode.SelectNodes("indexFactor");
if (indexFactorNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in indexFactorNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
indexFactorIDRef = item.Attributes["id"].Name;
XsdTypeDecimal ob = XsdTypeDecimal();
IDManager.SetID(indexFactorIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
indexFactorIDRef = item.Attributes["href"].Name;
}
else
{
indexFactor = new XsdTypeDecimal(item);
}
}
}
XmlNodeList factoredCalculationAmountNodeList = xmlNode.SelectNodes("factoredCalculationAmount");
if (factoredCalculationAmountNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in factoredCalculationAmountNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
factoredCalculationAmountIDRef = item.Attributes["id"].Name;
Money ob = Money();
IDManager.SetID(factoredCalculationAmountIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
factoredCalculationAmountIDRef = item.Attributes["href"].Name;
}
else
{
factoredCalculationAmount = new Money(item);
}
}
}
}
示例4: PortfolioReference
public PortfolioReference(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList sequenceNumberNodeList = xmlNode.SelectNodes("sequenceNumber");
if (sequenceNumberNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in sequenceNumberNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
sequenceNumberIDRef = item.Attributes["id"].Name;
XsdTypePositiveInteger ob = XsdTypePositiveInteger();
IDManager.SetID(sequenceNumberIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
sequenceNumberIDRef = item.Attributes["href"].Name;
}
else
{
sequenceNumber = new XsdTypePositiveInteger(item);
}
}
}
XmlNodeList submissionsCompleteNodeList = xmlNode.SelectNodes("submissionsComplete");
if (submissionsCompleteNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in submissionsCompleteNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
submissionsCompleteIDRef = item.Attributes["id"].Name;
XsdTypeBoolean ob = XsdTypeBoolean();
IDManager.SetID(submissionsCompleteIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
submissionsCompleteIDRef = item.Attributes["href"].Name;
}
else
{
submissionsComplete = new XsdTypeBoolean(item);
}
}
}
}
示例5: CommoditySpread
public CommoditySpread(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList spreadConversionFactorNodeList = xmlNode.SelectNodes("spreadConversionFactor");
if (spreadConversionFactorNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in spreadConversionFactorNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
spreadConversionFactorIDRef = item.Attributes["id"].Name;
XsdTypeDecimal ob = XsdTypeDecimal();
IDManager.SetID(spreadConversionFactorIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
spreadConversionFactorIDRef = item.Attributes["href"].Name;
}
else
{
spreadConversionFactor = new XsdTypeDecimal(item);
}
}
}
XmlNodeList spreadUnitNodeList = xmlNode.SelectNodes("spreadUnit");
if (spreadUnitNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in spreadUnitNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
spreadUnitIDRef = item.Attributes["id"].Name;
QuantityUnit ob = QuantityUnit();
IDManager.SetID(spreadUnitIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
spreadUnitIDRef = item.Attributes["href"].Name;
}
else
{
spreadUnit = new QuantityUnit(item);
}
}
}
}
示例6: CreditDefaultSwapOption
public CreditDefaultSwapOption(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList strikeNodeList = xmlNode.SelectNodes("strike");
if (strikeNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in strikeNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
strikeIDRef = item.Attributes["id"].Name;
CreditOptionStrike ob = CreditOptionStrike();
IDManager.SetID(strikeIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
strikeIDRef = item.Attributes["href"].Name;
}
else
{
strike = new CreditOptionStrike(item);
}
}
}
XmlNodeList creditDefaultSwapNodeList = xmlNode.SelectNodes("creditDefaultSwap");
if (creditDefaultSwapNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in creditDefaultSwapNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
creditDefaultSwapIDRef = item.Attributes["id"].Name;
CreditDefaultSwap ob = CreditDefaultSwap();
IDManager.SetID(creditDefaultSwapIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
creditDefaultSwapIDRef = item.Attributes["href"].Name;
}
else
{
creditDefaultSwap = new CreditDefaultSwap(item);
}
}
}
}
示例7: ReturnSwapLegUnderlyer
public ReturnSwapLegUnderlyer(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList strikeDateNodeList = xmlNode.SelectNodes("strikeDate");
if (strikeDateNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in strikeDateNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
strikeDateIDRef = item.Attributes["id"].Name;
AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
IDManager.SetID(strikeDateIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
strikeDateIDRef = item.Attributes["href"].Name;
}
else
{
strikeDate = new AdjustableOrRelativeDate(item);
}
}
}
XmlNodeList underlyerNodeList = xmlNode.SelectNodes("underlyer");
if (underlyerNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in underlyerNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
underlyerIDRef = item.Attributes["id"].Name;
Underlyer ob = Underlyer();
IDManager.SetID(underlyerIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
underlyerIDRef = item.Attributes["href"].Name;
}
else
{
underlyer = new Underlyer(item);
}
}
}
}
示例8: GlobalClass
public GlobalClass(Global parent, XmlNode xml, XmlNamespaceManager nsm)
: this(parent)
{
if (xml == null)
throw new ArgumentNullException();
if (nsm == null)
throw new ArgumentNullException();
XmlAttribute attr = xml.SelectSingleNode("@superclass", nsm) as XmlAttribute;
if (attr != null)
this.Superclass = attr.Value;
attr = xml.SelectSingleNode("@instaneState", nsm) as XmlAttribute;
if (attr != null)
{
if (attr.Value == "byte")
this.InstanceState = InstanceStateEnum.Byte;
else if (attr.Value == "object")
this.InstanceState = InstanceStateEnum.Object;
else
this.InstanceState = InstanceStateEnum.None;
}
foreach (XmlAttribute node in xml.SelectNodes("sd:InstanceVariable/@name", nsm))
this.InstanceVariables.Add(node.Value);
foreach (XmlAttribute node in xml.SelectNodes("sd:ClassVariable/@name", nsm))
this.ClassVariables.Add(node.Value);
foreach (XmlAttribute node in xml.SelectNodes("sd:ClassInstanceVariable/@name", nsm))
this.ClassInstanceVariables.Add(node.Value);
foreach (XmlAttribute node in xml.SelectNodes("sd:ImportedPool/@name", nsm))
this.ImportedPools.Add(node.Value);
}
示例9: XmlValidationRuleset
public XmlValidationRuleset(IXmlDocumentProvider docProvider, XmlNode node, XmlNamespaceManager nsmgr)
{
if (node.Attributes["name"] != null)
this.Name = node.Attributes["name"].Value;
if (node.Attributes["nameString"] != null)
this.NameString = node.Attributes["nameString"].Value;
if (node.Attributes["descriptionString"] != null)
this.DescriptionString = node.Attributes["descriptionString"].Value;
List<IValidationRule> rules = new List<IValidationRule>();
string prefix = nsmgr.LookupPrefix("http://icalvalid.wikidot.com/validation");
if (node.Attributes["basedOn"] != null)
{
// Inherit rules from the ruleset this one is based on.
string name = node.Attributes["basedOn"].Value;
foreach (XmlNode rule in node.SelectNodes("parent::" + prefix + ":rulesets/" + prefix + ":ruleset[@name='" + name + "']/" + prefix + ":rule", nsmgr))
rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));
}
foreach (XmlNode rule in node.SelectNodes(prefix + ":rule", nsmgr))
rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));
Rules = rules.ToArray();
}
示例10: RelativeDates
public RelativeDates(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList periodSkipNodeList = xmlNode.SelectNodes("periodSkip");
if (periodSkipNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in periodSkipNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
periodSkipIDRef = item.Attributes["id"].Name;
XsdTypePositiveInteger ob = XsdTypePositiveInteger();
IDManager.SetID(periodSkipIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
periodSkipIDRef = item.Attributes["href"].Name;
}
else
{
periodSkip = new XsdTypePositiveInteger(item);
}
}
}
XmlNodeList scheduleBoundsNodeList = xmlNode.SelectNodes("scheduleBounds");
if (scheduleBoundsNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in scheduleBoundsNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
scheduleBoundsIDRef = item.Attributes["id"].Name;
DateRange ob = DateRange();
IDManager.SetID(scheduleBoundsIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
scheduleBoundsIDRef = item.Attributes["href"].Name;
}
else
{
scheduleBounds = new DateRange(item);
}
}
}
}
示例11: FixedPaymentAmount
public FixedPaymentAmount(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList paymentAmountNodeList = xmlNode.SelectNodes("paymentAmount");
if (paymentAmountNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in paymentAmountNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
paymentAmountIDRef = item.Attributes["id"].Name;
NonNegativeMoney ob = NonNegativeMoney();
IDManager.SetID(paymentAmountIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
paymentAmountIDRef = item.Attributes["href"].Name;
}
else
{
paymentAmount = new NonNegativeMoney(item);
}
}
}
XmlNodeList paymentDateNodeList = xmlNode.SelectNodes("paymentDate");
if (paymentDateNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in paymentDateNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
paymentDateIDRef = item.Attributes["id"].Name;
RelativeDateOffset ob = RelativeDateOffset();
IDManager.SetID(paymentDateIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
paymentDateIDRef = item.Attributes["href"].Name;
}
else
{
paymentDate = new RelativeDateOffset(item);
}
}
}
}
示例12: MultipleValuationDates
public MultipleValuationDates(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList businessDaysThereafterNodeList = xmlNode.SelectNodes("businessDaysThereafter");
if (businessDaysThereafterNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in businessDaysThereafterNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
businessDaysThereafterIDRef = item.Attributes["id"].Name;
XsdTypePositiveInteger ob = XsdTypePositiveInteger();
IDManager.SetID(businessDaysThereafterIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
businessDaysThereafterIDRef = item.Attributes["href"].Name;
}
else
{
businessDaysThereafter = new XsdTypePositiveInteger(item);
}
}
}
XmlNodeList numberValuationDatesNodeList = xmlNode.SelectNodes("numberValuationDates");
if (numberValuationDatesNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in numberValuationDatesNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
numberValuationDatesIDRef = item.Attributes["id"].Name;
XsdTypePositiveInteger ob = XsdTypePositiveInteger();
IDManager.SetID(numberValuationDatesIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
numberValuationDatesIDRef = item.Attributes["href"].Name;
}
else
{
numberValuationDates = new XsdTypePositiveInteger(item);
}
}
}
}
示例13: PercentageRule
public PercentageRule(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList paymentPercentNodeList = xmlNode.SelectNodes("paymentPercent");
if (paymentPercentNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in paymentPercentNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
paymentPercentIDRef = item.Attributes["id"].Name;
XsdTypeDecimal ob = XsdTypeDecimal();
IDManager.SetID(paymentPercentIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
paymentPercentIDRef = item.Attributes["href"].Name;
}
else
{
paymentPercent = new XsdTypeDecimal(item);
}
}
}
XmlNodeList notionalAmountReferenceNodeList = xmlNode.SelectNodes("notionalAmountReference");
if (notionalAmountReferenceNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in notionalAmountReferenceNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
notionalAmountReferenceIDRef = item.Attributes["id"].Name;
NotionalAmountReference ob = NotionalAmountReference();
IDManager.SetID(notionalAmountReferenceIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
notionalAmountReferenceIDRef = item.Attributes["href"].Name;
}
else
{
notionalAmountReference = new NotionalAmountReference(item);
}
}
}
}
示例14: FxOptionPremium
public FxOptionPremium(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList settlementInformationNodeList = xmlNode.SelectNodes("settlementInformation");
if (settlementInformationNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in settlementInformationNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
settlementInformationIDRef = item.Attributes["id"].Name;
SettlementInformation ob = SettlementInformation();
IDManager.SetID(settlementInformationIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
settlementInformationIDRef = item.Attributes["href"].Name;
}
else
{
settlementInformation = new SettlementInformation(item);
}
}
}
XmlNodeList quoteNodeList = xmlNode.SelectNodes("quote");
if (quoteNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in quoteNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
quoteIDRef = item.Attributes["id"].Name;
PremiumQuote ob = PremiumQuote();
IDManager.SetID(quoteIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
quoteIDRef = item.Attributes["href"].Name;
}
else
{
quote = new PremiumQuote(item);
}
}
}
}
示例15: Stub
public Stub(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList stubStartDateNodeList = xmlNode.SelectNodes("stubStartDate");
if (stubStartDateNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in stubStartDateNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
stubStartDateIDRef = item.Attributes["id"].Name;
AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
IDManager.SetID(stubStartDateIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
stubStartDateIDRef = item.Attributes["href"].Name;
}
else
{
stubStartDate = new AdjustableOrRelativeDate(item);
}
}
}
XmlNodeList stubEndDateNodeList = xmlNode.SelectNodes("stubEndDate");
if (stubEndDateNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in stubEndDateNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
stubEndDateIDRef = item.Attributes["id"].Name;
AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
IDManager.SetID(stubEndDateIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
stubEndDateIDRef = item.Attributes["href"].Name;
}
else
{
stubEndDate = new AdjustableOrRelativeDate(item);
}
}
}
}