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

C# DOM.Node类代码示例

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

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



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

示例1: RemoveChild

 public override Node RemoveChild(Node child)
 {
     throw new DOMException(ErrorCode.HierarchyRequestError);
 }
开发者ID:Rajbandi,项目名称:AngleSharp,代码行数:4,代码来源:Attr.cs


示例2: InsertChild

 public override Node InsertChild(int index, Node child)
 {
     throw new DOMException(ErrorCode.NotSupported);
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:CharacterData.cs


示例3: AppendChild

 public override Node AppendChild(Node child)
 {
     throw new DOMException(ErrorCode.NotSupported);
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:CharacterData.cs


示例4: CopyProperties

        /// <summary>
        /// Copies all (Node) properties of the source to the target.
        /// </summary>
        /// <param name="source">The source node.</param>
        /// <param name="target">The target node.</param>
        /// <param name="deep">Is a deep-copy required?</param>
        protected static void CopyProperties(Node source, Node target, Boolean deep)
        {
            target._baseURI = source._baseURI;
            target._name = source._name;
            target._type = source.NodeType;
            target._ns = source._ns;

            if (deep)
            {
                for (int i = 0; i < source._children.Length; i++)
                    target._children.Add(source._children[i].CloneNode(true));

                for (int i = 0; i < source._attributes.Length; i++)
                    target._attributes.SetNamedItem(source._attributes[i].CloneNode(true) as Attr);
            }
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:22,代码来源:Node.cs


示例5: CompareRelativePositionInNodeList

        /// <summary>
        /// Compares the relative position in a node list.
        /// </summary>
        /// <param name="list">The node list as a base.</param>
        /// <param name="nodeA">The first node.</param>
        /// <param name="nodeB">The other node.</param>
        /// <returns>The position.</returns>
        static DocumentPosition CompareRelativePositionInNodeList(NodeList list, Node nodeA, Node nodeB)
        {
            var aPos = -1;
            var bPos = -1;

            for (int i = 0; i < list.Length; i++)
            {
                if (aPos == -1 && list[i].Contains(nodeA))
                    aPos = i;

                if (bPos == -1 && list[i].Contains(nodeB))
                    bPos = i;
            }

            if (aPos < bPos)
                return DocumentPosition.Preceding;
            else if (bPos < aPos)
                return DocumentPosition.Following;
            else if (aPos != -1 && bPos != -1)
                return CompareRelativePositionInNodeList(list[aPos].ChildNodes, nodeA, nodeB);

            return DocumentPosition.Disconnected;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:30,代码来源:Node.cs


示例6: IsEqualNode

        public virtual Boolean IsEqualNode(Node otherNode)
        {
            if (this._baseURI != otherNode._baseURI)
                return false;

            if (this._name != otherNode._name)
                return false;

            if (this._ns != otherNode._ns)
                return false;

            if (this._attributes.Length != otherNode._attributes.Length)
                return false;

            if (this._children.Length != otherNode._children.Length)
                return false;

            for (int i = 0; i < this._attributes.Length; i++)
            {
                if(!this._attributes[i].IsEqualNode(otherNode._attributes[i]))
                    return false;
            }

            for (int i = 0; i < this._children.Length; i++)
            {
                if(!this._children[i].IsEqualNode(otherNode._children[i]))
                    return false;
            }

            return true;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:31,代码来源:Node.cs


示例7: ReplaceChild

        public virtual Node ReplaceChild(Node newChild, Node oldChild)
        {
            if (newChild is Attr || newChild is Document || newChild.Contains(this))
                throw new DOMException(ErrorCode.HierarchyRequestError);
            else if (newChild == oldChild)
                return oldChild;
            else if (newChild.ParentNode != null)
                throw new DOMException(ErrorCode.InUse);

            var n = _children.Length;

            for (int i = 0; i < n; i++)
            {
                if (_children[i] == oldChild)
                {
                    RemoveChild(oldChild);
                    InsertChild(i, newChild);
                    return oldChild;
                }
            }

            return null;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:23,代码来源:Node.cs


示例8: ComparePoint

 public RangePosition ComparePoint(Node node, int offset)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例9: IntersectsNode

 public bool IntersectsNode(Node node)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例10: SurroundContents

 public void SurroundContents(Node newParent)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例11: IsPointInRange

 public bool IsPointInRange(Node node, int offset)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例12: InsertNode

 public void InsertNode(Node node)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例13: HtmlFragment

        /// <summary>
        /// Builds a list of nodes according with 8.4 Parsing HTML fragments.
        /// </summary>
        /// <param name="sourceCode">The string to use as source code.</param>
        /// <param name="context">The context node to use.</param>
        /// <returns>A list of parsed nodes.</returns>
        public static NodeList HtmlFragment(String sourceCode, Node context = null)
        {
            var source = new SourceManager(sourceCode);
            var doc = new HTMLDocument();
            var db = new DocumentBuilder(source, doc);

            if (context != null)
            {
                if (context.OwnerDocument != null && context.OwnerDocument.QuirksMode != QuirksMode.Off)
                    doc.QuirksMode = context.OwnerDocument.QuirksMode;

                //    Note: For performance reasons, an implementation that does not report errors and that uses
                //          the actual state machine described in this specification directly could use the
                //          PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned
                //          in the list above. Except for rules regarding parse errors, they are equivalent, since
                //          there is no appropriate end tag token in the fragment case, yet they involve far
                //          fewer state transitions.

                ((HtmlParser)db.parser).SwitchToFragment(context);
                return db.HtmlResult.DocumentElement.ChildNodes;
            }

            return db.HtmlResult.ChildNodes;
        }
开发者ID:ranjancse26,项目名称:AngleSharp,代码行数:30,代码来源:DocumentBuilder.cs


示例14: ReplaceChild

 public override Node ReplaceChild(Node newChild, Node oldChild)
 {
     throw new DOMException(ErrorCode.HierarchyRequestError);
 }
开发者ID:Rajbandi,项目名称:AngleSharp,代码行数:4,代码来源:Attr.cs


示例15: InsertBefore

        public virtual Node InsertBefore(Node newElement, Node referenceElement)
        {
            if (newElement is Attr || newElement is Document || newElement.Contains(this))
                throw new DOMException(ErrorCode.HierarchyRequestError);

            var n = _children.Length;

            for (int i = 0; i < n; i++)
            {
                if (_children[i] == referenceElement)
                    return InsertChild(i, newElement);
            }

            return AppendChild(newElement);
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:15,代码来源:Node.cs


示例16: SetEnd

 public void SetEnd(Node refNode, int offset)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例17: InsertChild

        public virtual Node InsertChild(Int32 index, Node child)
        {
            if (child is DocumentFragment)
            {
                var childs = child.ChildNodes;

                for (int i = 0; i < childs.Length; i++)
                    InsertChild(index + i, childs[i]);
            }
            else if (child is Attr || child is Document || child.Contains(this))
            {
                throw new DOMException(ErrorCode.HierarchyRequestError);
            }
            else
            {
                if (child.ParentNode != null)
                    throw new DOMException(ErrorCode.InUse);

                child._parent = this;
                child.OwnerDocument = _owner ?? (this as Document);
                _children.Insert(index, child);
            }

            return child;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:25,代码来源:Node.cs


示例18: SetEndBefore

 public void SetEndBefore(Node refNode)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs


示例19: RemoveChild

        public virtual Node RemoveChild(Node child)
        {
            if (_children.Contains(child))
            {
                child._parent = null;
                _children.Remove(child);
            }

            return child;
        }
开发者ID:rrsc,项目名称:AngleSharp,代码行数:10,代码来源:Node.cs


示例20: SetEndAfter

 public void SetEndAfter(Node refNode)
 {
     throw new NotImplementedException();
 }
开发者ID:mydataprovider,项目名称:.NET-AngleSharp,代码行数:4,代码来源:Range.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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