本文整理汇总了C#中System.Xml.XmlNode.SelectSingleNode方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.SelectSingleNode方法的具体用法?C# XmlNode.SelectSingleNode怎么用?C# XmlNode.SelectSingleNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.SelectSingleNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: from
public void from(XmlNode node, XmlNamespaceManager xnm, string prefix, string subfix)
{
Type type = this.GetType();
FieldInfo[] fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
foreach (FieldInfo field in fields)
{
string query = prefix +ObjectUtil.GetSimpleName(field) + subfix;
try
{
string value = null;
XmlNode tempNode;
if (xnm != null)
{
tempNode = node.SelectSingleNode(query, xnm);
}
else
{
tempNode = node.SelectSingleNode(query);
}
if (tempNode == null) {
field.SetValue(this,XML_NULL);
continue;
}
value = tempNode.InnerText;
field.SetValue(this, value);
}
catch (Exception ex) { }
}
}
示例2: CreditDefaultSwapOption
public CreditDefaultSwapOption(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode strikeNode = xmlNode.SelectSingleNode("strike");
if (strikeNode != null)
{
if (strikeNode.Attributes["href"] != null || strikeNode.Attributes["id"] != null)
{
if (strikeNode.Attributes["id"] != null)
{
strikeIDRef_ = strikeNode.Attributes["id"].Value;
CreditOptionStrike ob = new CreditOptionStrike(strikeNode);
IDManager.SetID(strikeIDRef_, ob);
}
else if (strikeNode.Attributes["href"] != null)
{
strikeIDRef_ = strikeNode.Attributes["href"].Value;
}
else
{
strike_ = new CreditOptionStrike(strikeNode);
}
}
else
{
strike_ = new CreditOptionStrike(strikeNode);
}
}
XmlNode creditDefaultSwapNode = xmlNode.SelectSingleNode("creditDefaultSwap");
if (creditDefaultSwapNode != null)
{
if (creditDefaultSwapNode.Attributes["href"] != null || creditDefaultSwapNode.Attributes["id"] != null)
{
if (creditDefaultSwapNode.Attributes["id"] != null)
{
creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["id"].Value;
CreditDefaultSwap ob = new CreditDefaultSwap(creditDefaultSwapNode);
IDManager.SetID(creditDefaultSwapIDRef_, ob);
}
else if (creditDefaultSwapNode.Attributes["href"] != null)
{
creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["href"].Value;
}
else
{
creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
}
}
else
{
creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
}
}
}
示例3: Excel_cds
public Excel_cds(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode excel_swapLegNode = xmlNode.SelectSingleNode("excel_swapLeg");
if (excel_swapLegNode != null)
{
if (excel_swapLegNode.Attributes["href"] != null || excel_swapLegNode.Attributes["id"] != null)
{
if (excel_swapLegNode.Attributes["id"] != null)
{
excel_swapLegIDRef_ = excel_swapLegNode.Attributes["id"].Value;
Excel_swapLeg ob = new Excel_swapLeg(excel_swapLegNode);
IDManager.SetID(excel_swapLegIDRef_, ob);
}
else if (excel_swapLegNode.Attributes["href"] != null)
{
excel_swapLegIDRef_ = excel_swapLegNode.Attributes["href"].Value;
}
else
{
excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
}
}
else
{
excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
}
}
XmlNode excel_creditEventSwapLegNode = xmlNode.SelectSingleNode("excel_creditEventSwapLeg");
if (excel_creditEventSwapLegNode != null)
{
if (excel_creditEventSwapLegNode.Attributes["href"] != null || excel_creditEventSwapLegNode.Attributes["id"] != null)
{
if (excel_creditEventSwapLegNode.Attributes["id"] != null)
{
excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["id"].Value;
Excel_creditEventSwapLeg ob = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
IDManager.SetID(excel_creditEventSwapLegIDRef_, ob);
}
else if (excel_creditEventSwapLegNode.Attributes["href"] != null)
{
excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["href"].Value;
}
else
{
excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
}
}
else
{
excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
}
}
}
示例4: OnSystemSettingsLoaded
// Make sure the default company name and acronym are in the config file under system settings
protected override void OnSystemSettingsLoaded(XmlDocument configurationFile, XmlNode systemSettingsNode)
{
XmlNode companyNameNode = systemSettingsNode.SelectSingleNode("add[@name = 'CompanyName']");
XmlNode companyAcronymNode = systemSettingsNode.SelectSingleNode("add[@name = 'CompanyAcronym']");
// Modify or add the CompanyName parameter.
if (companyNameNode != null)
{
companyNameNode.Attributes["value"].Value = Context.Parameters["DP_CompanyName"];
}
else
{
companyNameNode = configurationFile.CreateNode(XmlNodeType.Element, "add", string.Empty);
companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "name", "CompanyName"));
companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "value", Context.Parameters["DP_CompanyName"]));
companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "description", "The name of the company who owns this instance of the SIEGate."));
companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "encrypted", "false"));
systemSettingsNode.AppendChild(companyNameNode);
}
// Modify or add the CompanyAcronym parameter.
if (companyAcronymNode != null)
{
companyAcronymNode.Attributes["value"].Value = Context.Parameters["DP_CompanyAcronym"];
}
else
{
companyAcronymNode = configurationFile.CreateNode(XmlNodeType.Element, "add", string.Empty);
companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "name", "CompanyAcronym"));
companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "value", Context.Parameters["DP_CompanyAcronym"]));
companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "description", "The acronym representing the company who owns this instance of the SIEGate."));
companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "encrypted", "false"));
systemSettingsNode.AppendChild(companyAcronymNode);
}
}
示例5: ExcelFontXml
internal ExcelFontXml(XmlNamespaceManager nsm, XmlNode topNode) :
base(nsm, topNode)
{
_name = GetXmlNodeString(namePath);
_size = (float)GetXmlNodeDecimal(sizePath);
_family = GetXmlNodeInt(familyPath);
_scheme = GetXmlNodeString(schemePath);
_color = new ExcelColorXml(nsm, topNode.SelectSingleNode(_colorPath, nsm));
_bold = (topNode.SelectSingleNode(boldPath, NameSpaceManager) != null);
_italic = (topNode.SelectSingleNode(italicPath, NameSpaceManager) != null);
_strike = (topNode.SelectSingleNode(strikePath, NameSpaceManager) != null);
_verticalAlign = GetXmlNodeString(verticalAlignPath);
if (topNode.SelectSingleNode(underLinedPath, NameSpaceManager) != null)
{
string ut = GetXmlNodeString(underLinedPath + "/@val");
if (ut == "")
{
_underlineType = ExcelUnderLineType.Single;
}
else
{
_underlineType = (ExcelUnderLineType)Enum.Parse(typeof(ExcelUnderLineType), ut, true);
}
}
else
{
_underlineType = ExcelUnderLineType.None;
}
}
示例6: ForwardModel
public ForwardModel(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode tenorNode = xmlNode.SelectSingleNode("tenor");
if (tenorNode != null)
{
if (tenorNode.Attributes["href"] != null || tenorNode.Attributes["id"] != null)
{
if (tenorNode.Attributes["id"] != null)
{
tenorIDRef_ = tenorNode.Attributes["id"].Value;
Tenor ob = new Tenor(tenorNode);
IDManager.SetID(tenorIDRef_, ob);
}
else if (tenorNode.Attributes["href"] != null)
{
tenorIDRef_ = tenorNode.Attributes["href"].Value;
}
else
{
tenor_ = new Tenor(tenorNode);
}
}
else
{
tenor_ = new Tenor(tenorNode);
}
}
XmlNode fittingYieldCurveNode = xmlNode.SelectSingleNode("fittingYieldCurve");
if (fittingYieldCurveNode != null)
{
if (fittingYieldCurveNode.Attributes["href"] != null || fittingYieldCurveNode.Attributes["id"] != null)
{
if (fittingYieldCurveNode.Attributes["id"] != null)
{
fittingYieldCurveIDRef_ = fittingYieldCurveNode.Attributes["id"].Value;
FittingYieldCurve ob = new FittingYieldCurve(fittingYieldCurveNode);
IDManager.SetID(fittingYieldCurveIDRef_, ob);
}
else if (fittingYieldCurveNode.Attributes["href"] != null)
{
fittingYieldCurveIDRef_ = fittingYieldCurveNode.Attributes["href"].Value;
}
else
{
fittingYieldCurve_ = new FittingYieldCurve(fittingYieldCurveNode);
}
}
else
{
fittingYieldCurve_ = new FittingYieldCurve(fittingYieldCurveNode);
}
}
}
示例7: GroupFullInfo
internal GroupFullInfo(XmlNode node)
{
if( node.Attributes.GetNamedItem("id") != null )
GroupId = node.Attributes.GetNamedItem("id").Value;
if( node.SelectSingleNode("name") != null )
GroupName = node.SelectSingleNode("name").InnerText;
if( node.SelectSingleNode("description") != null )
Description = node.SelectSingleNode("description").InnerXml;
if( node.SelectSingleNode("members") != null )
Members = int.Parse(node.SelectSingleNode("members").InnerText);
if( node.SelectSingleNode("privacy") != null )
Privacy = (PoolPrivacy)int.Parse(node.SelectSingleNode("privacy").InnerText);
if( node.SelectSingleNode("throttle") != null )
{
XmlNode throttle = node.SelectSingleNode("throttle");
ThrottleInfo = new GroupThrottleInfo();
if( throttle.Attributes.GetNamedItem("count") != null )
ThrottleInfo.Count = int.Parse(throttle.Attributes.GetNamedItem("count").Value);
if( throttle.Attributes.GetNamedItem("mode") != null )
ThrottleInfo.setMode(throttle.Attributes.GetNamedItem("mode").Value);
if( throttle.Attributes.GetNamedItem("remaining") != null )
ThrottleInfo.Remaining = int.Parse(throttle.Attributes.GetNamedItem("remaining").Value);
}
}
示例8: FromXml
public void FromXml(XmlNode node)
{
Id = Dml.Attribute(node, "Id", "");
Name = Dml.Attribute(node, "Name", "");
Text = Dml.Attribute(node, "Text", "");
LibId = Dml.Attribute(node, "LibId", "");
XmlNode temp = node.SelectSingleNode("Resource/Config");
if (temp != null)
{
ConnectionString = temp.InnerText;
}
temp = node.SelectSingleNode("Resource/Uri");
if (temp != null)
{
Uri = temp.InnerText;
}
temp = node.SelectSingleNode("Resource/User");
if (temp != null)
{
User = temp.InnerText;
}
temp = node.SelectSingleNode("Resource/Password");
if (temp != null)
{
Password = temp.InnerText;
}
}
示例9: RateCouponCalculation
public RateCouponCalculation(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode typeNode = xmlNode.SelectSingleNode("type");
if (typeNode != null)
{
if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null)
{
if (typeNode.Attributes["id"] != null)
{
typeIDRef_ = typeNode.Attributes["id"].Value;
XsdTypeToken ob = new XsdTypeToken(typeNode);
IDManager.SetID(typeIDRef_, ob);
}
else if (typeNode.Attributes["href"] != null)
{
typeIDRef_ = typeNode.Attributes["href"].Value;
}
else
{
type_ = new XsdTypeToken(typeNode);
}
}
else
{
type_ = new XsdTypeToken(typeNode);
}
}
XmlNode fixedRateCouponCalculationNode = xmlNode.SelectSingleNode("fixedRateCouponCalculation");
if (fixedRateCouponCalculationNode != null)
{
if (fixedRateCouponCalculationNode.Attributes["href"] != null || fixedRateCouponCalculationNode.Attributes["id"] != null)
{
if (fixedRateCouponCalculationNode.Attributes["id"] != null)
{
fixedRateCouponCalculationIDRef_ = fixedRateCouponCalculationNode.Attributes["id"].Value;
FixedRateCouponCalculation ob = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
IDManager.SetID(fixedRateCouponCalculationIDRef_, ob);
}
else if (fixedRateCouponCalculationNode.Attributes["href"] != null)
{
fixedRateCouponCalculationIDRef_ = fixedRateCouponCalculationNode.Attributes["href"].Value;
}
else
{
fixedRateCouponCalculation_ = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
}
}
else
{
fixedRateCouponCalculation_ = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
}
}
}
示例10: CompileModelsFromScene
public IList<XmlNode> CompileModelsFromScene( XmlNode xmlNode )
{
IList< XmlNode > models = new List<XmlNode>( );
var entitiesNode = xmlNode.SelectSingleNode( "/scene/nodes" );
if ( entitiesNode != null )
{
foreach ( XmlNode entity in entitiesNode.ChildNodes )
{
var userDataNode = xmlNode.SelectSingleNode( ".//userData" );
if( userDataNode != null )
{
userDataNode.ParentNode.RemoveChild( userDataNode );
}
var modelFile = new XmlDocument( );
var modelNode = modelFile.ImportNode( entity, true );
modelFile.AppendChild( modelNode );
models.Add( modelFile );
}
}
return models;
}
示例11: YieldCurve
public YieldCurve(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode algorithmNode = xmlNode.SelectSingleNode("algorithm");
if (algorithmNode != null)
{
if (algorithmNode.Attributes["href"] != null || algorithmNode.Attributes["id"] != null)
{
if (algorithmNode.Attributes["id"] != null)
{
algorithmIDRef_ = algorithmNode.Attributes["id"].Value;
XsdTypeString ob = new XsdTypeString(algorithmNode);
IDManager.SetID(algorithmIDRef_, ob);
}
else if (algorithmNode.Attributes["href"] != null)
{
algorithmIDRef_ = algorithmNode.Attributes["href"].Value;
}
else
{
algorithm_ = new XsdTypeString(algorithmNode);
}
}
else
{
algorithm_ = new XsdTypeString(algorithmNode);
}
}
XmlNode forecastRateIndexNode = xmlNode.SelectSingleNode("forecastRateIndex");
if (forecastRateIndexNode != null)
{
if (forecastRateIndexNode.Attributes["href"] != null || forecastRateIndexNode.Attributes["id"] != null)
{
if (forecastRateIndexNode.Attributes["id"] != null)
{
forecastRateIndexIDRef_ = forecastRateIndexNode.Attributes["id"].Value;
ForecastRateIndex ob = new ForecastRateIndex(forecastRateIndexNode);
IDManager.SetID(forecastRateIndexIDRef_, ob);
}
else if (forecastRateIndexNode.Attributes["href"] != null)
{
forecastRateIndexIDRef_ = forecastRateIndexNode.Attributes["href"].Value;
}
else
{
forecastRateIndex_ = new ForecastRateIndex(forecastRateIndexNode);
}
}
else
{
forecastRateIndex_ = new ForecastRateIndex(forecastRateIndexNode);
}
}
}
示例12: IndexChange
public IndexChange(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode indexFactorNode = xmlNode.SelectSingleNode("indexFactor");
if (indexFactorNode != null)
{
if (indexFactorNode.Attributes["href"] != null || indexFactorNode.Attributes["id"] != null)
{
if (indexFactorNode.Attributes["id"] != null)
{
indexFactorIDRef_ = indexFactorNode.Attributes["id"].Value;
XsdTypeDecimal ob = new XsdTypeDecimal(indexFactorNode);
IDManager.SetID(indexFactorIDRef_, ob);
}
else if (indexFactorNode.Attributes["href"] != null)
{
indexFactorIDRef_ = indexFactorNode.Attributes["href"].Value;
}
else
{
indexFactor_ = new XsdTypeDecimal(indexFactorNode);
}
}
else
{
indexFactor_ = new XsdTypeDecimal(indexFactorNode);
}
}
XmlNode factoredCalculationAmountNode = xmlNode.SelectSingleNode("factoredCalculationAmount");
if (factoredCalculationAmountNode != null)
{
if (factoredCalculationAmountNode.Attributes["href"] != null || factoredCalculationAmountNode.Attributes["id"] != null)
{
if (factoredCalculationAmountNode.Attributes["id"] != null)
{
factoredCalculationAmountIDRef_ = factoredCalculationAmountNode.Attributes["id"].Value;
Money ob = new Money(factoredCalculationAmountNode);
IDManager.SetID(factoredCalculationAmountIDRef_, ob);
}
else if (factoredCalculationAmountNode.Attributes["href"] != null)
{
factoredCalculationAmountIDRef_ = factoredCalculationAmountNode.Attributes["href"].Value;
}
else
{
factoredCalculationAmount_ = new Money(factoredCalculationAmountNode);
}
}
else
{
factoredCalculationAmount_ = new Money(factoredCalculationAmountNode);
}
}
}
示例13: FxRateAsset
public FxRateAsset(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode quotedCurrencyPairNode = xmlNode.SelectSingleNode("quotedCurrencyPair");
if (quotedCurrencyPairNode != null)
{
if (quotedCurrencyPairNode.Attributes["href"] != null || quotedCurrencyPairNode.Attributes["id"] != null)
{
if (quotedCurrencyPairNode.Attributes["id"] != null)
{
quotedCurrencyPairIDRef_ = quotedCurrencyPairNode.Attributes["id"].Value;
QuotedCurrencyPair ob = new QuotedCurrencyPair(quotedCurrencyPairNode);
IDManager.SetID(quotedCurrencyPairIDRef_, ob);
}
else if (quotedCurrencyPairNode.Attributes["href"] != null)
{
quotedCurrencyPairIDRef_ = quotedCurrencyPairNode.Attributes["href"].Value;
}
else
{
quotedCurrencyPair_ = new QuotedCurrencyPair(quotedCurrencyPairNode);
}
}
else
{
quotedCurrencyPair_ = new QuotedCurrencyPair(quotedCurrencyPairNode);
}
}
XmlNode rateSourceNode = xmlNode.SelectSingleNode("rateSource");
if (rateSourceNode != null)
{
if (rateSourceNode.Attributes["href"] != null || rateSourceNode.Attributes["id"] != null)
{
if (rateSourceNode.Attributes["id"] != null)
{
rateSourceIDRef_ = rateSourceNode.Attributes["id"].Value;
FxSpotRateSource ob = new FxSpotRateSource(rateSourceNode);
IDManager.SetID(rateSourceIDRef_, ob);
}
else if (rateSourceNode.Attributes["href"] != null)
{
rateSourceIDRef_ = rateSourceNode.Attributes["href"].Value;
}
else
{
rateSource_ = new FxSpotRateSource(rateSourceNode);
}
}
else
{
rateSource_ = new FxSpotRateSource(rateSourceNode);
}
}
}
示例14: ReportIdentification
public ReportIdentification(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode numberOfSectionsNode = xmlNode.SelectSingleNode("numberOfSections");
if (numberOfSectionsNode != null)
{
if (numberOfSectionsNode.Attributes["href"] != null || numberOfSectionsNode.Attributes["id"] != null)
{
if (numberOfSectionsNode.Attributes["id"] != null)
{
numberOfSectionsIDRef_ = numberOfSectionsNode.Attributes["id"].Value;
XsdTypePositiveInteger ob = new XsdTypePositiveInteger(numberOfSectionsNode);
IDManager.SetID(numberOfSectionsIDRef_, ob);
}
else if (numberOfSectionsNode.Attributes["href"] != null)
{
numberOfSectionsIDRef_ = numberOfSectionsNode.Attributes["href"].Value;
}
else
{
numberOfSections_ = new XsdTypePositiveInteger(numberOfSectionsNode);
}
}
else
{
numberOfSections_ = new XsdTypePositiveInteger(numberOfSectionsNode);
}
}
XmlNode submissionsCompleteNode = xmlNode.SelectSingleNode("submissionsComplete");
if (submissionsCompleteNode != null)
{
if (submissionsCompleteNode.Attributes["href"] != null || submissionsCompleteNode.Attributes["id"] != null)
{
if (submissionsCompleteNode.Attributes["id"] != null)
{
submissionsCompleteIDRef_ = submissionsCompleteNode.Attributes["id"].Value;
XsdTypeBoolean ob = new XsdTypeBoolean(submissionsCompleteNode);
IDManager.SetID(submissionsCompleteIDRef_, ob);
}
else if (submissionsCompleteNode.Attributes["href"] != null)
{
submissionsCompleteIDRef_ = submissionsCompleteNode.Attributes["href"].Value;
}
else
{
submissionsComplete_ = new XsdTypeBoolean(submissionsCompleteNode);
}
}
else
{
submissionsComplete_ = new XsdTypeBoolean(submissionsCompleteNode);
}
}
}
示例15: Protocol
public Protocol(SystemDescription parent, XmlNode xml, XmlNamespaceManager nsm)
: this(parent)
{
if (xml == null)
throw new ArgumentNullException();
if (nsm == null)
throw new ArgumentNullException();
XmlAttribute attr = xml.SelectSingleNode("@name", nsm) as XmlAttribute;
if (attr != null)
this.Name = attr.Value;
attr = xml.SelectSingleNode("@docId", nsm) as XmlAttribute;
if (attr != null)
this.DocumentationId = attr.Value;
attr = xml.SelectSingleNode("@abstract", nsm) as XmlAttribute;
if (attr != null)
this.IsAbstract = Boolean.Parse(attr.Value);
foreach (XmlAttribute node in xml.SelectNodes("sd:ConformsTo/@protocol", nsm))
this.ConformsTo.Add(node.Value);
foreach (XmlElement node in xml.SelectNodes("sd:Description", nsm))
this.Description = new HtmlString(node);
foreach (XmlElement node in xml.SelectNodes("sd:StandardGlobal", nsm))
this.StandardGlobals.Add(new Global(this, node, nsm));
foreach (XmlElement node in xml.SelectNodes("sd:Message", nsm))
this.Messages.Add(new Message(this, node, nsm));
}