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


C# IElement.GetAttribute方法代码示例

本文整理汇总了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;
 }
开发者ID:dburriss,项目名称:UiMatic,代码行数:8,代码来源:RadioButton.cs

示例2: Do

 public void Do(IElement element)
 {
     if(element.HasAttribute(_attributeName))
     {
         element.RemoveAttribute(element.GetAttribute(_attributeName));
     }
 }
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:7,代码来源:RemoveAttributeAction.cs

示例3: SelectionOption

 public SelectionOption(IElement el)
 {
     element = el;
     var text = el.Text;
     var value = el.GetAttribute("value");
     Text = text;
     Value = value;
 }
开发者ID:dburriss,项目名称:UiMatic,代码行数:8,代码来源:SelectionOption.cs

示例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);
 }
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:10,代码来源:ConvertAttributeAction.cs

示例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();
     }
 }
开发者ID:jennifersmith,项目名称:openrasta-sparkcodec,代码行数:11,代码来源:ConvertPropertyValueToInnerText.cs

示例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))
            };
        }
开发者ID:lecode-official,项目名称:ninegag-dotnet,代码行数:20,代码来源:Section.cs

示例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
            };
        }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:18,代码来源:Program.cs

示例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;
        }
开发者ID:lecode-official,项目名称:ninegag-dotnet,代码行数:20,代码来源:Post.cs

示例10: Stringify

 public override String Stringify(IElement element)
 {
     return element.GetAttribute(_attribute) ?? String.Empty;
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:4,代码来源:CssContentProperty.cs

示例11: CalculateCondition

 public override bool CalculateCondition(IElement element)
 {
     return !((element.GetAttribute(_attributeName) == _attributeValue) ^ IncludeMatchingElements);
 }
开发者ID:sunstream,项目名称:Framework_v2_0_ProofOfConcept,代码行数:4,代码来源:FilterBy.cs


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