<PackageReference Include="System.Xml.XDocument" Version="4.0.11-beta-23409" />

System.Xml.Linq.XNode

public abstract class XNode : XObject
Represents the abstract concept of a node (element, comment, document type, processing instruction, or text node) in the XML tree.

Gets a comparer that can compare the relative position of two nodes.

public static XNodeEqualityComparer EqualityComparer { get; }

Gets a comparer that can compare two nodes for value equality.

public XNode NextNode { get; }

Gets the next sibling node of this node.

public XNode PreviousNode { get; }

Gets the previous sibling node of this node.

public static int CompareDocumentOrder(XNode n1, XNode n2)

Compares two nodes to determine their relative XML document order.

public static bool DeepEquals(XNode n1, XNode n2)

Compares the values of two nodes, including the values of all descendant nodes.

public static XNode ReadFrom(XmlReader reader)

Creates an XNode from an XmlReader.

public void AddAfterSelf(object content)

Adds the specified content immediately after this node.

public void AddAfterSelf(object[] content)

Adds the specified content immediately after this node.

public void AddBeforeSelf(object content)

Adds the specified content immediately before this node.

public void AddBeforeSelf(object[] content)

Adds the specified content immediately before this node.

Returns a collection of the ancestor elements of this node.

Returns a filtered collection of the ancestor elements of this node. Only elements that have a matching XName are included in the collection.

Creates an XmlReader for this node.

public XmlReader CreateReader(ReaderOptions readerOptions)

Creates an XmlReader with the options specified by the readerOptions parameter.

Returns a collection of the sibling elements after this node, in document order.

Returns a filtered collection of the sibling elements after this node, in document order. Only elements that have a matching XName are included in the collection.

Returns a collection of the sibling elements before this node, in document order.

Returns a filtered collection of the sibling elements before this node, in document order. Only elements that have a matching XName are included in the collection.

public bool IsAfter(XNode node)

Determines if the current node appears after a specified node in terms of document order.

public bool IsBefore(XNode node)

Determines if the current node appears before a specified node in terms of document order.

Returns a collection of the sibling nodes after this node, in document order.

Returns a collection of the sibling nodes before this node, in document order.

public void Remove()

Removes this node from its parent.

public void ReplaceWith(object content)

Replaces this node with the specified content.

public void ReplaceWith(object[] content)

Replaces this node with the specified content.

public string ToString(SaveOptions options)

Returns the XML for this node, optionally disabling formatting.

public abstract void WriteTo(XmlWriter writer)

Writes this node to an XmlWriter.