本文整理汇总了C#中IElement.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetAttribute方法的具体用法?C# IElement.GetAttribute怎么用?C# IElement.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IElement
的用法示例。
在下文中一共展示了IElement.GetAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RadioButton
public RadioButton(IElement el)
{
element = el;
var name = el.GetAttribute("name");
var value = el.GetAttribute("value");
Name = Name;
Value = value;
}
示例2: Do
public void Do(IElement element)
{
if(element.HasAttribute(_attributeName))
{
element.RemoveAttribute(element.GetAttribute(_attributeName));
}
}
示例3: SelectionOption
public SelectionOption(IElement el)
{
element = el;
var text = el.Text;
var value = el.GetAttribute("value");
Text = text;
Value = value;
}
示例4: Do
public void Do(IElement element)
{
if (element.HasAttribute(_fromAttribute) == false)
{
return;
}
IAttribute fromAttribute = element.GetAttribute(_fromAttribute);
IAttribute attribute = element.AddAttribute(_toAttribute);
_attributeModifer.Modify(fromAttribute, attribute);
}
示例5: Do
public void Do(IElement element)
{
if(element.HasAttribute("for"))
{
IAttribute attribute = element.GetAttribute("for");
IConditionalExpressionNodeWrapper codeExpressionNode = element.AddConditionalExpressionNode();
string conditional = _syntaxProvider.CreateNullCheckExpression(attribute.GetTextValue().Split('.').First());
codeExpressionNode.SetExpressionBody(new ConditionalExpression(conditional, attribute.GetTextValue()));
element.ClearInnerText();
}
}
示例6: Do
public void Do(IElement element)
{
string resourceValue = element.GetAttribute("for").GetTextValue();
IEnumerable<IElement> childElements = element.GetChildElements("option");
childElements.ForEach(x=>
{
if(x.HasAttribute("selected"))
{
x.RemoveAttribute(x.GetAttribute("selected"));
}
IConditionalExpressionNodeWrapper wrapper = x.AddAttribute("selected").AddConditionalExpressionNode();
wrapper.SetExpressionBody(new ConditionalExpression(_syntaxProvider.CreateNullCheckAndEvalExpression(resourceValue), resourceValue));
});
}
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:14,代码来源:ConvertResourceValueToSelectedOptionAction.cs
示例7: FromHtml
/// <summary>
/// Parses the specified DOM element and creates a section from it.
/// </summary>
/// <param name="sectionElement">The DOM element, which is to be parsed.</param>
/// <returns>Returns the section, which was created from the DOM element.</returns>
internal static Section FromHtml(IElement sectionElement)
{
// Parses the section kind, if the section kind could not be parsed, then the section kind is set to unknown
SectionKind sectionKind;
if (!Enum.TryParse(sectionElement.TextContent.Trim().Replace(" ", string.Empty), true, out sectionKind))
sectionKind = SectionKind.Unknown;
// Creates the new section and adds it to the list of sections
return new Section
{
Title = sectionElement.TextContent.Trim(),
Kind = sectionKind,
RelativeUri = Section.baseUri.MakeRelativeUri(new Uri(sectionElement.GetAttribute("href"), UriKind.Absolute))
};
}
示例8: ParsePicture
private static async Task<Picture> ParsePicture(IElement obj)
{
var picturePageUrl = new Url(new Url("http://gallerix.ru/"),obj.GetAttribute("href"));
var picturePage = await BrowsingContext.New(Configuration).OpenAsync(picturePageUrl);
var table = picturePage.QuerySelector("#n_mainleft table.tbgnd");
var imgUrl = table.QuerySelector("td.pbgnd img").GetAttribute("src");
var caption = table.QuerySelector("td.pii h4").TextContent;
var parts = caption.Split(':');
var painter = parts[0].Trim();
var picture = parts[1].Trim();
return new Picture()
{
Url = imgUrl,
Name = picture,
Painter = painter
};
}
示例9: ParseGeneralInformation
/// <summary>
/// Parses the specified post element and parses the general information about the post.
/// </summary>
/// <param name="postElement">The post element, which is to be parsed.</param>
internal virtual void ParseGeneralInformation(IElement postElement)
{
// Parses the ID and the title of the post
this.Id = postElement.GetAttribute("data-entry-id");
this.Title = postElement.QuerySelector("header").TextContent.Trim();
// Checks if the post is a NSFW post
this.IsNotSafeForWork = postElement.QuerySelector(".nsfw-post") != null;
// Parses the number of comments and the number of upvotes of the post
int numberOfComments, numberOfUpVotes;
int.TryParse(postElement.GetAttribute("data-entry-comments").Trim(), out numberOfComments);
int.TryParse(postElement.GetAttribute("data-entry-votes").Trim(), out numberOfUpVotes);
this.NumberOfComments = numberOfComments;
this.NumberOfUpVotes = numberOfUpVotes;
}
示例10: Stringify
public override String Stringify(IElement element)
{
return element.GetAttribute(_attribute) ?? String.Empty;
}
示例11: CalculateCondition
public override bool CalculateCondition(IElement element)
{
return !((element.GetAttribute(_attributeName) == _attributeValue) ^ IncludeMatchingElements);
}