Show / Hide Table of Contents

Class NodeBase

Abstract base class for an INode, containing functionality which is neutral to the specific implementation.

Inheritance
System.Object
NodeBase
AngleSharpNode
HapNode
XmlNode
Implements
INode
IHasDocumentSourceInfo
IHasNodes
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ZptSharp.Dom
Assembly: ZptSharp.Abstractions.dll
Syntax
public abstract class NodeBase : INode, IHasDocumentSourceInfo, IHasNodes

Constructors

| Improve this Doc View Source

NodeBase(IDocument, INode, NodeSourceInfo)

Initializes a new instance of the NodeBase class.

Declaration
protected NodeBase(IDocument document, INode parent = null, NodeSourceInfo sourceInfo = null)
Parameters
Type Name Description
IDocument document

The node's document.

INode parent

The parent node.

NodeSourceInfo sourceInfo

The node source info.

Fields

| Improve this Doc View Source

Doc

A field for the IDocument to which this node belongs.

Declaration
protected readonly IDocument Doc
Field Value
Type Description
IDocument
| Improve this Doc View Source

IsImportedNode

A field for whether or not the node is imported.

Declaration
protected bool IsImportedNode
Field Value
Type Description
System.Boolean
| Improve this Doc View Source

Source

A field for the source information relating to this node.

Declaration
protected readonly NodeSourceInfo Source
Field Value
Type Description
NodeSourceInfo

Properties

| Improve this Doc View Source

Attributes

Gets a collection of the node's attributes.

Declaration
public abstract IList<IAttribute> Attributes { get; }
Property Value
Type Description
System.Collections.Generic.IList<IAttribute>

The attributes.

| Improve this Doc View Source

ChildNodes

Gets the nodes contained within the current node.

Declaration
public abstract IList<INode> ChildNodes { get; }
Property Value
Type Description
System.Collections.Generic.IList<INode>

The child nodes.

| Improve this Doc View Source

Document

Gets the parent document for the current node.

Declaration
public virtual IDocument Document { get; }
Property Value
Type Description
IDocument

The document.

| Improve this Doc View Source

IsElement

Gets a value indicating whether this INode is an node node.

Declaration
public abstract bool IsElement { get; }
Property Value
Type Description
System.Boolean

true if the current instance is an node; otherwise, false.

| Improve this Doc View Source

IsImported

Gets a value indicating whether this INode is imported. A node is imported if it was not a part of the document, as the document was originally loaded.

For example, a node included via a METAL macro or TAL content/replace directive is imported.

Declaration
public virtual bool IsImported { get; }
Property Value
Type Description
System.Boolean

true if this node is imported; otherwise, false.

| Improve this Doc View Source

ParentNode

Gets or sets the parent for the current node. This will be a null reference if the current instance is the root node of the document or if the node is not attached to a DOM.

Declaration
public virtual INode ParentNode { get; set; }
Property Value
Type Description
INode

The parent node.

| Improve this Doc View Source

PreReplacementSourceInfo

Gets or sets information about the source of the node (for example, a file path and line number) before it was replaced. For most nodes this will be null, but when the current node is a replacement (such as METAL macro usage), this property will contain source information for the replaced node.

Declaration
public virtual NodeSourceInfo PreReplacementSourceInfo { get; set; }
Property Value
Type Description
NodeSourceInfo

The pre-replacement source info.

| Improve this Doc View Source

SourceInfo

Gets information which indicates the original source of the node (for example, a file path and line number).

Declaration
public virtual NodeSourceInfo SourceInfo { get; }
Property Value
Type Description
NodeSourceInfo

The source info.

Methods

| Improve this Doc View Source

CreateAttribute(AttributeSpec)

Creates and returns a new attribute from the specified specification.

Declaration
public abstract IAttribute CreateAttribute(AttributeSpec spec)
Parameters
Type Name Description
AttributeSpec spec

The attribute specification which will be used to name the attribute.

Returns
Type Description
IAttribute

An attribute.

| Improve this Doc View Source

CreateComment(String)

Creates and returns a new comment node.

Declaration
public abstract INode CreateComment(string commentText)
Parameters
Type Name Description
System.String commentText

The text for the comment.

Returns
Type Description
INode

The comment node.

| Improve this Doc View Source

CreateTextNode(String)

Creates and returns a new text node from the specified content. Even if the content contains valid markup, it is strictly to be treated as text.

Declaration
public abstract INode CreateTextNode(string content)
Parameters
Type Name Description
System.String content

The text content for the node.

Returns
Type Description
INode

A text node.

| Improve this Doc View Source

GetCopy()

Gets a copy of the current node and all of its children.

Declaration
public abstract INode GetCopy()
Returns
Type Description
INode

The copied node.

| Improve this Doc View Source

IsInNamespace(Namespace)

Gets a value which indicates whether or not the current node is in the specified namespace.

Declaration
public abstract bool IsInNamespace(Namespace namespace)
Parameters
Type Name Description
Namespace namespace

A namespace.

Returns
Type Description
System.Boolean

true, if the node is in the specified namespace, false otherwise.

| Improve this Doc View Source

ParseAsNodes(String)

Parses the specified text markup and returns the resulting nodes.

Declaration
public abstract IList<INode> ParseAsNodes(string markup)
Parameters
Type Name Description
System.String markup

Markup text.

Returns
Type Description
System.Collections.Generic.IList<INode>

The parsed nodes.

Explicit Interface Implementations

| Improve this Doc View Source

IHasDocumentSourceInfo.SourceInfo

Declaration
IDocumentSourceInfo IHasDocumentSourceInfo.SourceInfo { get; }
Returns
Type Description
IDocumentSourceInfo
| Improve this Doc View Source

IHasNodes.GetChildNodes()

Declaration
IEnumerable<INode> IHasNodes.GetChildNodes()
Returns
Type Description
System.Collections.Generic.IEnumerable<INode>

Implements

INode
IHasDocumentSourceInfo
IHasNodes

Extension Methods

NodeExtensions.GetMatchingAttribute(INode, AttributeSpec)
NodeExtensions.GetMatchingAttribute(INode, IEnumerable<AttributeSpec>, out AttributeSpec)
NodeExtensions.AddChildren(INode, IEnumerable<INode>, Nullable<Int32>)
NodeExtensions.AddChildren(INode, IList<INode>, Nullable<Int32>)
NodeExtensions.Remove(INode)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX