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


C# DOM.Node类代码示例

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


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


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