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


C# IHtmlElement类代码示例

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


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


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