本文整理汇总了C#中System.Xml.XmlElement.SelectChildElementByTagName方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.SelectChildElementByTagName方法的具体用法?C# XmlElement.SelectChildElementByTagName怎么用?C# XmlElement.SelectChildElementByTagName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.SelectChildElementByTagName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseBindings
/// <summary>The parse bindings.</summary>
/// <param name="element">The element.</param>
/// <param name="parserContext">The parser context.</param>
/// <param name="builder">The builder.</param>
/// <param name="exchangeName">The exchange name.</param>
protected override void ParseBindings(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder, string exchangeName)
{
var backingType = element.GetAttribute(BACKING_TYPE_ATTRIBUTE);
var bindings = element.SelectChildElementByTagName(DIRECT_BINDINGS_ELE);
if (bindings != null && ExchangeTypes.Direct != backingType)
{
parserContext.ReaderContext.ReportFatalException(element, "Cannot have direct-bindings if backing-type not 'direct'");
}
if (bindings == null)
{
bindings = element.SelectChildElementByTagName(TOPIC_BINDINGS_ELE);
if (bindings != null && !ExchangeTypes.Topic.Equals(backingType))
{
parserContext.ReaderContext.ReportFatalException(element, "Cannot have topic-bindings if backing-type not 'topic'");
}
}
if (bindings == null)
{
bindings = element.SelectChildElementByTagName(TOPIC_FANOUT_ELE);
if (bindings != null && !ExchangeTypes.Fanout.Equals(backingType))
{
parserContext.ReaderContext.ReportFatalException(element, "Cannot have fanout-bindings if backing-type not 'fanout'");
}
}
if (bindings == null)
{
bindings = element.SelectChildElementByTagName(TOPIC_HEADERS_ELE);
if (bindings != null && !ExchangeTypes.Headers.Equals(backingType))
{
parserContext.ReaderContext.ReportFatalException(element, "Cannot have headers-bindings if backing-type not 'headers'");
}
}
if (!string.IsNullOrWhiteSpace(backingType))
{
if (ExchangeTypes.Direct.Equals(backingType))
{
this.DoParseBindings(parserContext, exchangeName, bindings, new DirectExchangeParser());
}
else if (ExchangeTypes.Topic.Equals(backingType))
{
this.DoParseBindings(parserContext, exchangeName, bindings, new TopicExchangeParser());
}
else if (ExchangeTypes.Fanout.Equals(backingType))
{
this.DoParseBindings(parserContext, exchangeName, bindings, new FanoutExchangeParser());
}
else if (ExchangeTypes.Headers.Equals(backingType))
{
this.DoParseBindings(parserContext, exchangeName, bindings, new HeadersExchangeParser());
}
}
}
示例2: DoParse
/// <summary>The do parse.</summary>
/// <param name="element">The element.</param>
/// <param name="parserContext">The parser context.</param>
/// <param name="builder">The builder.</param>
protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
{
var exchangeName = element.GetAttribute("name");
builder.AddConstructorArg(new TypedStringValue(exchangeName));
this.ParseBindings(element, parserContext, builder, exchangeName);
NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, DURABLE_ATTRIBUTE, true);
NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, AUTO_DELETE_ATTRIBUTE, false);
var argumentsElement = element.SelectChildElementByTagName(ARGUMENTS_ELEMENT);
if (argumentsElement != null)
{
var parser = new ObjectDefinitionParserHelper(parserContext);
var map = parser.ParseMapElementToTypedDictionary(argumentsElement, builder.RawObjectDefinition);
builder.AddConstructorArg(map);
}
}
示例3: ParseBindings
/// <summary>The parse bindings.</summary>
/// <param name="element">The element.</param>
/// <param name="parserContext">The parser context.</param>
/// <param name="builder">The builder.</param>
/// <param name="exchangeName">The exchange name.</param>
protected virtual void ParseBindings(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder, string exchangeName)
{
var bindings = element.SelectChildElementByTagName(BINDINGS_ELE);
this.DoParseBindings(parserContext, exchangeName, bindings, this);
}
示例4: DoParse
/// <summary>The do parse.</summary>
/// <param name="element">The element.</param>
/// <param name="parserContext">The parser context.</param>
/// <param name="builder">The builder.</param>
protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
{
if (!NamespaceUtils.IsAttributeDefined(element, "name") && !NamespaceUtils.IsAttributeDefined(element, ID_ATTRIBUTE))
{
parserContext.ReaderContext.ReportFatalException(element, "Queue must have either id or name (or both)");
}
NamespaceUtils.AddConstructorArgValueIfAttributeDefined(builder, element, "name");
if (!NamespaceUtils.IsAttributeDefined(element, "name"))
{
if (this.AttributeHasIllegalOverride(element, DURABLE_ATTRIBUTE, "false")
|| this.AttributeHasIllegalOverride(element, EXCLUSIVE_ATTRIBUTE, "true")
|| this.AttributeHasIllegalOverride(element, AUTO_DELETE_ATTRIBUTE, "true"))
{
parserContext.ReaderContext.ReportFatalException(element, "Anonymous queue cannot specify durable='true', exclusive='false' or auto-delete='false'");
return;
}
}
else
{
NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, DURABLE_ATTRIBUTE, false);
NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, EXCLUSIVE_ATTRIBUTE, false);
NamespaceUtils.AddConstructorArgBooleanValueIfAttributeDefined(builder, element, AUTO_DELETE_ATTRIBUTE, false);
}
var queueArguments = element.GetAttribute(ARGUMENTS);
var argumentsElement = element.SelectChildElementByTagName(ARGUMENTS);
if (argumentsElement != null)
{
var parser = new ObjectDefinitionParserHelper(parserContext);
if (!string.IsNullOrWhiteSpace(queueArguments))
{
parserContext.ReaderContext.ReportFatalException(element, "Queue may have either a queue-attributes attribute or element, but not both");
}
var map = parser.ParseMapElement(argumentsElement, builder.RawObjectDefinition);
builder.AddConstructorArg(map);
}
if (!string.IsNullOrWhiteSpace(queueArguments))
{
builder.AddConstructorArgReference(queueArguments);
}
}