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

C# IDomObject类代码示例

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

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



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

示例1: Matches

        /// <summary>
        /// Test whether an element is the last child of its type.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test.
        /// </param>
        ///
        /// <returns>
        /// true if it matches, false if not.
        /// </returns>

        public override bool Matches(IDomObject element)
        {

            return element.ParentNode.ChildElements
              .Where(item => item.NodeNameID == element.NodeNameID)
              .LastOrDefault() == element;
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:19,代码来源:LastOfType.cs


示例2: Matches

        /// <summary>
        /// Test whether an element is the only element of its type among its siblings.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test.
        /// </param>
        ///
        /// <returns>
        /// true if it matches, false if not.
        /// </returns>

        public override bool Matches(IDomObject element)
        {

            return element.ParentNode.ChildElements
               .Where(item => item.NodeNameID == element.NodeNameID)
               .SingleOrDefaultAlways() != null;
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:19,代码来源:OnlyOfType.cs


示例3: Matches

        /// <summary>
        /// Test whether an element is a parent; e.g. has children.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test.
        /// </param>
        ///
        /// <returns>
        /// true if it matches, false if not.
        /// </returns>

        public override bool Matches(IDomObject element)
        {

            return element.HasChildren ?
                !Empty.IsEmpty(element) : 
                false;
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:19,代码来源:Parent.cs


示例4: Render

        /// <summary>
        /// Renders the object to the textwriter.
        /// </summary>
        ///
        /// <exception cref="NotImplementedException">
        /// Thrown when the requested operation is unimplemented.
        /// </exception>
        ///
        /// <param name="node">
        /// The node.
        /// </param>
        /// <param name="writer">
        /// The writer to which output is written.
        /// </param>

        public void Render(IDomObject node, TextWriter writer)
        {

            switch (node.NodeType) {
                case NodeType.ELEMENT_NODE:
                    RenderElement(node,writer,true);
                    break;
                case NodeType.DOCUMENT_FRAGMENT_NODE:
                case NodeType.DOCUMENT_NODE:
                    RenderElements(node.ChildNodes,writer);
                    break;
                case NodeType.TEXT_NODE:
                    RenderTextNode(node, writer,false);
                    break;
                case NodeType.CDATA_SECTION_NODE:
                    RenderCdataNode(node, writer);
                    break;
                case NodeType.COMMENT_NODE:
                    RenderCommentNode(node, writer);
                    break;
                case NodeType.DOCUMENT_TYPE_NODE:
                    RenderDocTypeNode(node, writer);
                    break;
                default:
                    throw new NotImplementedException("An unknown node type was found while rendering the CsQuery document.");
            }
        }
开发者ID:TheX,项目名称:CsQuery,代码行数:42,代码来源:OutputFormatterDefault.cs


示例5: IsEmpty

        /// <summary>
        /// Test whether an element contains no non-empty children. An element can technically have
        /// children, but if they are text nodes with empty values, then it's considered empty.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test
        /// </param>
        ///
        /// <returns>
        /// true if an element is empty, false if not.
        /// </returns>

        public static bool IsEmpty(IDomObject element)
        {
            return !element.ChildNodes
                   .Where(item => item.NodeType == NodeType.ELEMENT_NODE ||
                       (item.NodeType == NodeType.TEXT_NODE &&
                       !String.IsNullOrEmpty(item.NodeValue)))
                   .Any();
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:21,代码来源:Empty.cs


示例6: Render

        /// <summary>
        /// Renders this object and returns the output as a string.
        /// </summary>
        ///
        /// <param name="node">
        /// The node.
        /// </param>
        ///
        /// <returns>
        /// A string of HTML.
        /// </returns>

        public string Render(IDomObject node)
        {
            using (StringWriter writer = new StringWriter())
            {
                Render(node, writer);
                return writer.ToString();
            }
        }
开发者ID:TheX,项目名称:CsQuery,代码行数:20,代码来源:FormatPlainText.cs


示例7: ParentImpl

 private IEnumerable<IDomObject> ParentImpl(IDomObject input)
 {
     if (input.ParentNode != null &&
         input.ParentNode.NodeType == NodeType.ELEMENT_NODE)
     {
         yield return input.ParentNode;
     }
 }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:8,代码来源:Parent.cs


示例8: Matches

        /// <summary>
        /// Test whether an element is a header (H1-H6)
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test.
        /// </param>
        ///
        /// <returns>
        /// true if it matches, false if not.
        /// </returns>

        public override bool Matches(IDomObject element)
        {
            var nodeName = element.NodeName;
            return nodeName[0] == 'H'
                && nodeName.Length == 2
                && nodeName[1] >= '0'
                && nodeName[1] <= '6';
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:20,代码来源:Header.cs


示例9: AddSelection

 /// <summary>
 /// Add an item to the list of selected elements. It should be part of this DOM.
 /// </summary>
 /// <param name="element"></param>
 protected bool AddSelection(IDomObject element)
 {
     //if (!ReferenceEquals(element.Dom, Dom))
     //{
     //    throw new InvalidOperationException("Cannot add unbound elements or elements bound to another DOM directly to a selection set.");
     //}
     return SelectionSet.Add(element);
 }
开发者ID:feidianbo,项目名称:CsQuery,代码行数:12,代码来源:CQ_Internal.cs


示例10: ParseCommandsNames

 static string[] ParseCommandsNames(CQ dom, IDomObject @event)
 {
     var commands =
         dom.Select(
             "td.today-name > span.command > div.today-member-name, td.name > span.command div.member-name",
             @event).Map(node => node.Cq().Text().Trim().Replace(Nbsp, ' ')).ToArray();
     Debug.Assert(commands.Count() == 2, "Teams names have not been recognized: " + @event.InnerHTML);
     return commands;
 }
开发者ID:oreshkor,项目名称:luckybird,代码行数:9,代码来源:SoccerPageParser.cs


示例11: ParseEventDate

        static DateTimeOffset ParseEventDate(CQ dom, IDomObject @event)
        {
            var date = dom.Select("td.date", @event).Text().Trim();

            DateTimeOffset eventDate;
            DateTimeOffset.TryParse(date, out eventDate);

            return eventDate;
        }
开发者ID:oreshkor,项目名称:luckybird,代码行数:9,代码来源:SoccerPageParser.cs


示例12: FindEquivalent

        public static IList<AttributeToCss> FindEquivalent(IDomObject domobject, StyleClass styles)
        {

            return (from attributeRuleMatch in _linkedAttributes
                    where domobject.HasAttribute(attributeRuleMatch.Key) && styles.Attributes.ContainsKey(attributeRuleMatch.Value)
                    select new AttributeToCss
                        {
                            AttributeName = attributeRuleMatch.Key, CssValue = styles.Attributes[attributeRuleMatch.Value].Value
                        }).ToList();
        }
开发者ID:burningice2866,项目名称:PreMailer.Net,代码行数:10,代码来源:CssStyleEquivalence.cs


示例13: LinkTagCssSource

		public LinkTagCssSource(IDomObject node, Uri baseUri)
		{
			// There must be an href
			var href = node.Attributes.First(a => a.Key.Equals("href", StringComparison.OrdinalIgnoreCase)).Value;

			if (Uri.IsWellFormedUriString(href, UriKind.Relative) && baseUri != null)
				_downloadUri = new Uri(baseUri, href);
			else // Assume absolute
				_downloadUri = new Uri(href);
		}
开发者ID:burningice2866,项目名称:PreMailer.Net,代码行数:10,代码来源:LinkTagCssSource.cs


示例14: extractTurkceWord

 private string extractTurkceWord(IDomObject de)
 {
     // remove whitespaces and etc.
     string text = Regex.Replace(de.InnerText,@"\t|\n|\r", " ");
     // remove Square Brackets and its content
     text = Regex.Replace(text,@"\[[^\]]*\]",""); // \[ [ ^ \] ]* \]
     // get string before before Colon
     Regex re = new Regex(@"[^\:]*(?=\:)");
     text = re.Match(text).ToString().Trim();
     return text;
 }
开发者ID:aytacyildiz,项目名称:lazcasozlukfetcher,代码行数:11,代码来源:Program.cs


示例15: ParseEvents

 static IEnumerable<ParsedEventData> ParseEvents(CQ dom, IDomObject @event)
 {
     return dom.Select("td.js-price", @event)
               .Map(node =>
                        {
                            var domNode = node.Cq();
                            var coefficient = double.Parse(domNode.Find("span.selection-link").Text().Trim());
                            var specification = domNode.Children().Remove().End().Text().Trim();
                            return new ParsedEventData {Coefficient = coefficient, Specification = specification};
                        });
 }
开发者ID:oreshkor,项目名称:luckybird,代码行数:11,代码来源:SoccerPageParser.cs


示例16: Create

 /// <summary>
 /// Create a new CQ object from a single element. Unlike the constructor method <see cref="CsQuery.CQ"/>
 /// this new objet is not bound to any context from the element.
 /// </summary>
 ///
 /// <param name="element">
 /// The element to wrap
 /// </param>
 ///
 /// <returns>
 /// A new CQ object
 /// </returns>
 
 public static CQ Create(IDomObject element)
 {
     CQ csq = new CQ();
     if (element is IDomDocument) {
         csq.Document = (IDomDocument)element;
         csq.AddSelection(csq.Document.ChildNodes);
     } else {
         csq.CreateNewFragment(Objects.Enumerate(element));
     }
     return csq;
 }
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:24,代码来源:Create.cs


示例17: OnlyChildOrNull

 private IDomObject OnlyChildOrNull(IDomObject parent)
 {
     if (parent.NodeType == NodeType.DOCUMENT_NODE)
     {
         return null;
     }
     else
     {
         return parent.ChildElements.SingleOrDefaultAlways();
     }
 }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:11,代码来源:OnlyChild.cs


示例18: Matches

        /// <summary>
        /// Test whether the element is empty
        /// </summary>
        ///
        /// <param name="element">
        /// The element to test.
        /// </param>
        ///
        /// <returns>
        /// true if it has no non-whitespace children, false if not
        /// </returns>

        public override bool Matches(IDomObject element)
        {
            // try to optimize this by checking for the least labor-intensive things first
            if (!element.HasChildren)
            {
                return true;
            }
            else
            {
                return IsEmpty(element);
            }
        }
开发者ID:emrahoner,项目名称:CsQuery,代码行数:24,代码来源:Empty.cs


示例19: GetValueBasedOnNode

        private static string GetValueBasedOnNode(IDomObject node)
        {
            if (node.NodeName == "REFERENCE")
                return node.Attributes["Include"];

            if (node.NodeName == "COMPILE")
                return node.Attributes["Include"];

            if (node.NodeName == "EMBEDDEDRESOURCE")
                return node.Attributes["Include"];

            return null;
        }
开发者ID:robcthegeek,项目名称:CsProjSorter,代码行数:13,代码来源:CsQueryExtensions.cs


示例20: Matches

        public override bool Matches(IDomObject element)
        {
           
            //StartNewSelector(SelectorType.Attribute);
            //Current.AttributeSelectorType = AttributeSelectorType.StartsWithOrHyphen;
            //Current.TraversalType = TraversalType.Inherited;
            //Current.AttributeName = "lang";

            //Current.Criteria = scanner.GetBoundedBy('(', false);
            //break;
            // 
            throw new NotImplementedException(":lang is not currently implemented.");
        }
开发者ID:kaleb,项目名称:CsQuery,代码行数:13,代码来源:Lang.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IDomainObjectDTORepository类代码示例发布时间:2022-05-24
下一篇:
C# IDocumentationProvider类代码示例发布时间: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