Class NodeExtensions
Extension methods for INode.
Inheritance
Inherited Members
Namespace: ZptSharp.Dom
Assembly: ZptSharp.dll
Syntax
public static class NodeExtensions
Methods
| Improve this Doc View SourceAddChildren(INode, IEnumerable<INode>, Nullable<Int32>)
Adds the specified nodesToAdd to the specified node.
By default, the nodes to add are appended to the end of the node's children.
In an insertIndex is specified, though, the nodes to add are inserted into
node's children at the specified (zero-based) index position.
Declaration
public static void AddChildren(this INode node, IEnumerable<INode> nodesToAdd, int? insertIndex = default(int? ))
Parameters
| Type | Name | Description |
|---|---|---|
| INode | node | The node to which the new children should be added. |
| System.Collections.Generic.IEnumerable<INode> | nodesToAdd | Nodes to add. |
| System.Nullable<System.Int32> | insertIndex | If specified and non-null then the nodes to add are inserted into the node's children at this index. Otherwise the nodes to add are appended to the end of node's children. |
AddChildren(INode, IList<INode>, Nullable<Int32>)
Adds the specified nodesToAdd to the specified node.
By default, the nodes to add are appended to the end of the node's children.
In an insertIndex is specified, though, the nodes to add are inserted into
node's children at the specified (zero-based) index position.
Declaration
public static void AddChildren(this INode node, IList<INode> nodesToAdd, int? insertIndex = default(int? ))
Parameters
| Type | Name | Description |
|---|---|---|
| INode | node | The node to which the new children should be added. |
| System.Collections.Generic.IList<INode> | nodesToAdd | Nodes to add. |
| System.Nullable<System.Int32> | insertIndex | If specified and non-null then the nodes to add are inserted into the node's children at this index. Otherwise the nodes to add are appended to the end of node's children. |
GetMatchingAttribute(INode, IEnumerable<AttributeSpec>, out AttributeSpec)
Gets the first IAttribute from the node which matches any of the specified a specs.
Declaration
public static IAttribute GetMatchingAttribute(this INode node, IEnumerable<AttributeSpec> specs, out AttributeSpec matchingSpec)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | node | The node from which to get the attribute. |
| System.Collections.Generic.IEnumerable<AttributeSpec> | specs | A collection of attribute specification. |
| AttributeSpec | matchingSpec | Exposes the specification (if any) which was matched. |
Returns
| Type | Description |
|---|---|
| IAttribute | The matching attribute, or a null reference if there is no match. |
GetMatchingAttribute(INode, AttributeSpec)
Gets the first IAttribute from the node which matches a spec.
Declaration
public static IAttribute GetMatchingAttribute(this INode node, AttributeSpec spec)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | node | The node from which to get the attribute. |
| AttributeSpec | spec | An attribute specification. |
Returns
| Type | Description |
|---|---|
| IAttribute | The matching attribute, or a null reference if there is no match. |
Remove(INode)
Removes the specified node from its parent.
From this point onwards, the node should be discarded, as it
is no longer a valid part of the document.
Declaration
public static void Remove(this INode node)
Parameters
| Type | Name | Description |
|---|---|---|
| INode | node | The node to remove. |