• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IHtmlElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IHtmlElement的典型用法代码示例。如果您正苦于以下问题:C# IHtmlElement类的具体用法?C# IHtmlElement怎么用?C# IHtmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IHtmlElement类属于命名空间,在下文中一共展示了IHtmlElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HtmlMeta

        public HtmlMeta( IHtmlElement element )
        {
            if ( !element.Name.EqualsIgnoreCase( "meta" ) )
            throw new InvalidOperationException();

              Element = element;
        }
开发者ID:neo2018,项目名称:Jumony,代码行数:7,代码来源:HtmlMeta.cs


示例2: BindData

 public void BindData( IHtmlElement element, object data )
 {
     if ( IsComplexData( data.GetType() ) )
     BindComplexData( element, data );
       else
     BindSimpleData( element, data );
 }
开发者ID:neo2018,项目名称:Jumony,代码行数:7,代码来源:HtmlBinder.cs


示例3: StyleManager

        private StyleManager( IHtmlElement element )
        {
            if ( element == null )
            throw new ArgumentNullException( "element" );

              _element = element;
        }
开发者ID:kissstudio,项目名称:Topawes5,代码行数:7,代码来源:StyleManager.cs


示例4: GenerateTagHtml

        /// <summary>
        /// 尝试生成元素开始标签的HTML形式
        /// </summary>
        /// <param name="element">要生成HTML的元素</param>
        /// <param name="selfClosed">指示是否应产生自结束符号</param>
        /// <returns></returns>
        public static string GenerateTagHtml( IHtmlElement element, bool selfClosed )
        {
            if ( element == null )
            throw new ArgumentNullException( "element" );

              var builder = new StringBuilder( 20 );

              builder.Append( "<" );
              builder.Append( element.Name );

              foreach ( var attribute in element.Attributes() )
              {
            builder.Append( " " );
            builder.Append( attribute.Name );
            if ( attribute.AttributeValue != null )
            {
              var specification = element.Document.HtmlSpecification;

              if ( ( specification.IsUriValue( attribute ) || specification.IsScriptValue( attribute ) ) && !attribute.AttributeValue.Contains( '"' ) )
            builder.Append( "=\"" ).Append( attribute.AttributeValue ).Append( "\"" );
              else
            builder.Append( "=\"" ).Append( HtmlEncoding.HtmlAttributeEncode( attribute.AttributeValue ) ).Append( "\"" );
            }
              }

              if ( selfClosed )
            builder.Append( " /" );

              builder.Append( ">" );
              return builder.ToString();
        }
开发者ID:kissstudio,项目名称:Topawes5,代码行数:37,代码来源:ContentExtensions.cs


示例5: Apply

 public IEnumerable<IHtmlElement> Apply(IEnumerable<IHtmlElement> elems, IHtmlElement root = null) {
     var result = new List<IHtmlElement>();
     foreach (var elem in elems) {
         if (this.Check(elem,root)!=null) result.Add(elem);
     }
     return result;
 }
开发者ID:yanyitec,项目名称:Yanyitec,代码行数:7,代码来源:Filter.cs


示例6: HtmlForm

    /// <summary>
    /// 创建一个 HTML 表单对象
    /// </summary>
    /// <param name="element">表单元素</param>
    /// <param name="configuration">表单配置</param>
    /// <param name="provider">表单控件提供程序</param>
    public HtmlForm( IHtmlElement element, FormConfiguration configuration = null, IFormProvider provider = null )
    {

      if ( element == null )
        throw new ArgumentNullException( "element" );

      var document = element.Document;

      if ( document == null )
        throw new InvalidOperationException();


      var modifier = document.DomModifier as ISynchronizedDomModifier;
      if ( modifier == null )
        throw new InvalidOperationException();


      SyncRoot = modifier.SyncRoot;
      
      _element = element;

      Configuration = configuration ?? new FormConfiguration();
      Provider = provider ?? new StandardFormProvider();


      RefreshForm();
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:33,代码来源:HtmlForm.cs


示例7: GetProductItemList

 public static ApiPagedResult<List<ProductItem>> GetProductItemList(IHtmlElement stockTable, int page = 1)
 {
     var result = new ApiPagedResult<List<ProductItem>>();
     var tableEntity = new TableEntity(stockTable);
     if (tableEntity.TBody.TrList.Count == 1 && tableEntity.TBody.TrList[0].TrElement.InnerHtml().IndexOf("没有符合条件的结果") != -1)
     {
         result.HasMore = false;
         result.Data = new List<ProductItem>();
     }
     else
     {
         var list = tableEntity.TBody.TrList.Select(x => x.GetProductItem()).ToList();
         var nextUrl = stockTable.Container.Find("a.page-next");
         if (nextUrl.Any())
         {
             var pageNext = UrlHelper.GetIntValue(nextUrl.First().Attribute("href").AttributeValue, "page");
             result.HasMore = pageNext > page;
         }
         else
         {
             result.HasMore = false;
         }
         result.Data = list;
     }
     tableEntity.Dispose();
     return result;
 }
开发者ID:kissstudio,项目名称:Topawes5,代码行数:27,代码来源:ProductItemHelper.cs


示例8: FormButtonGroupItem

    internal FormButtonGroupItem( FormButtonGroup groupControl, IHtmlElement element )
      : base( groupControl )
    {

      if ( groupControl == null )
        throw new ArgumentNullException( "groupControl" );

      if ( element == null )
        throw new ArgumentNullException( "element" );

      if ( !element.Name.EqualsIgnoreCase( "input" ) )
        throw new InvalidOperationException();

      if ( !element.Attribute( "name" ).Value().EqualsIgnoreCase( groupControl.Name ) )
        throw new InvalidOperationException();

      var type = element.Attribute( "type" ).Value();

      if ( type.EqualsIgnoreCase( "radio" ) )
        ButtonType = FormGroupButtonType.RadioButton;

      else if ( type.EqualsIgnoreCase( "checkbox" ) )
        ButtonType = FormGroupButtonType.RadioButton;

      else
        throw new InvalidOperationException();

      Element = element;
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:29,代码来源:FormButtonGroupItem.cs


示例9: Count_of_empty_collection_should_be_0

        public void Count_of_empty_collection_should_be_0()
        {
            var elements = new IHtmlElement[] { };
            var collection = new HtmlCollection(elements);

            Assert.That(collection.Count, Is.EqualTo(0));
        }
开发者ID:mhenry07,项目名称:ASPUnitRunner,代码行数:7,代码来源:TestHtmlCollection.cs


示例10: GetRouteValues

    internal RouteValueDictionary GetRouteValues( IHtmlElement element, bool clearRouteAttributes )
    {

      var routeValues = new RouteValueDictionary();

      var inherits = element.Attribute( "inherits" ).Value();

      if ( inherits != null )
      {

        var inheritsKeys = GetInheritsKeys( inherits );

        foreach ( var key in inheritsKeys )
          routeValues.Add( key, RequestContext.RouteData.Values[key] );

      }


      if ( !MvcEnvironment.Configuration.DisableUnderscorePrefix )
        CustomRouteValues( element, "_", routeValues, clearRouteAttributes );
      
      CustomRouteValues( element, "route-", routeValues, clearRouteAttributes );

      return routeValues;
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:25,代码来源:JumonyUrlHelper.cs


示例11: ApplyAdorners

 protected virtual void ApplyAdorners(IHtmlElement cell)
 {
     foreach (var adorner in Adorners)
     {
         adorner.ApplyTo(cell);
     }
 }
开发者ID:VlaTo,项目名称:EmpRe.NET,代码行数:7,代码来源:GridCellHtmlRenderer.cs


示例12: Check

 public override IHtmlElement Check(IHtmlElement elem, IHtmlElement root = null)
 {
     if (elem == root) return null;
     if (AscendantFilters.Count == 0) throw new ArgumentException("Ascendant Filter is required.");
     var at = AscendantFilters.Count-1;
    
     
     var filter = AscendantFilters[at];
     if (filter.Check(elem, root) == null || --at<0) return null;
     filter = AscendantFilters[at];
     var p = elem.ParentNode;
     while (p != null)
     {
         
         var checkResult = filter.Check(p,root);
         if (checkResult != null) {
             
             if (--at < 0) return elem;
             p = checkResult.ParentNode;
             continue;
         }
         if (p == root) break;
         p = p.ParentNode;  
           
     }
     return null;
 }
开发者ID:yanyitec,项目名称:Yanyitec,代码行数:27,代码来源:DescendantFilter.cs


示例13: IsEligible

        /// <summary>
        /// 检查元素是否符合选择器
        /// </summary>
        /// <param name="element">要检验的元素</param>
        /// <returns>是否符合选择器</returns>
        public virtual bool IsEligible( IHtmlElement element )
        {
            if ( element == null )
            return false;

              return IsEligible( LeftSelector, element );
        }
开发者ID:kissstudio,项目名称:Topawes5,代码行数:12,代码来源:CssRelativeSelector.cs


示例14: HtmlListItem

    internal HtmlListItem( IHtmlElement element )
    {
      if ( !element.Name.EqualsIgnoreCase( "li" ) )
        throw new FormatException( "HTML 文档格式不正确,列表元素只能包含 li 元素" );

      _element = element;
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:7,代码来源:HtmlList.cs


示例15: IsEligibleBuffered

        /// <summary>
        /// 检查元素是否符合指定选择器要求,并缓存结果于元素当前文档版本
        /// </summary>
        /// <param name="selector">选择器</param>
        /// <param name="element">元素</param>
        /// <returns>是否符合选择器要求</returns>
        public static bool IsEligibleBuffered( this ICssSelector selector, IHtmlElement element )
        {
            if ( selector == null )
            throw new ArgumentNullException( "selector" );

              if ( element == null )
            return selector.IsEligible( element );

              var cacheContainer = element.Document as IVersionCacheContainer;
              if ( cacheContainer == null )
            return selector.IsEligible( element );

              lock ( cacheContainer.SyncRoot )
              {
            var cache = cacheContainer.CurrenctVersionCache[selector] as Dictionary<IHtmlElement, bool>;

            if ( cache != null )
            {

              bool result;
              if ( cache.TryGetValue( element, out result ) )
            return result;
            }

            else
              cacheContainer.CurrenctVersionCache[selector] = cache = new Dictionary<IHtmlElement, bool>();

            return cache[element] = selector.IsEligible( element );

              }
        }
开发者ID:neo2018,项目名称:Jumony,代码行数:37,代码来源:CssSelector.cs


示例16: IsEligible

    /// <summary>
    /// 检查元素是否符合选择器要求(此方法会自动缓存结果)
    /// </summary>
    /// <param name="element">要检查的元素</param>
    /// <returns>是否符合选择器的要求</returns>
    public virtual bool IsEligible( IHtmlElement element )
    {
      if ( element == null )
        return false;

      var cacheContainer = element.Document as IVersionCacheContainer;
      if ( cacheContainer == null )
        return IsEligibleCore( element );


      lock ( cacheContainer.SyncRoot )
      {
        var cache = cacheContainer.CurrenctVersionCache[this] as Dictionary<IHtmlElement, bool>;

        if ( cache != null )
        {

          bool result;
          if ( cache.TryGetValue( element, out result ) )
            return result;
        }

        else
          cacheContainer.CurrenctVersionCache[this] = cache = new Dictionary<IHtmlElement, bool>();

        return cache[element] = IsEligibleCore( element );

      }
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:34,代码来源:CacheableSelector.cs


示例17: TableEntity

        public TableEntity(IHtmlElement tableElement)
        {
            var head = tableElement.FindFirst("thead");
            this.THead = new THeadEntity(head);

            var headTrList = head.Find("tr");
            foreach (var tr in headTrList)
            {
                var trEntity = new TrEntity(tr);
                var tdList = tr.Find("td").ToList();
                foreach (var td in tdList)
                {
                    trEntity.TdList.Add(new TdEntity(td) { Text = td.InnerText() });
                }
                this.THead.TrList.Add(trEntity);
            }
            var body = tableElement.FindFirst("tbody");
            this.TBody = new TBodyEntity(body);

            var bodyTrList = body.Find("tr");
            foreach (var tr in bodyTrList)
            {
                var trEntity = new TrEntity(tr);
                var tdList = tr.Find("td").ToList();
                foreach (var td in tdList)
                {
                    trEntity.TdList.Add(new TdEntity(td) { Text = td.InnerText() });
                }
                this.TBody.TrList.Add(trEntity);
            }
        }
开发者ID:kissstudio,项目名称:Topawes5,代码行数:31,代码来源:TableEntity.cs


示例18:

    bool ISelector.IsEligible( IHtmlElement element )
    {
      if ( element == null )
        return false;

      return _elements.Contains( element );
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:7,代码来源:CssElementsRestrictionSelector.cs


示例19: AddStyleReferences

 private void AddStyleReferences( IHtmlElement headElement, string[] styleFiles )
 {
   foreach ( var path in styleFiles )
     headElement.AddElement( "link" )
       .SetAttribute( "rel", "stylesheet" )
       .SetAttribute( "type", "text/css" )
       .SetAttribute( "href", path );
 }
开发者ID:ajayumi,项目名称:Jumony,代码行数:8,代码来源:ResourceManager.cs


示例20: FormTextControl

    /// <summary>
    /// 派生类调用此构造函数初始化 FormTextControl 实例
    /// </summary>
    /// <param name="form">所属表单</param>
    /// <param name="element">定义文本控件的元素</param>
    protected FormTextControl( HtmlForm form, IHtmlElement element )
      : base( form )
    {

      Element = element;
      MaxLength = GetMaxLength();

    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:13,代码来源:FormTextControl.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IHtmlHelper类代码示例发布时间:2022-05-24
下一篇:
C# IHtmlEditorComponentContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap