Class NodeBase
Abstract base class for an INode, containing functionality which is neutral to the specific implementation.
Inherited Members
Namespace: ZptSharp.Dom
Assembly: ZptSharp.Abstractions.dll
Syntax
public abstract class NodeBase : INode, IHasDocumentSourceInfo, IHasNodes
Constructors
| Improve this Doc View SourceNodeBase(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 SourceDoc
A field for the IDocument to which this node belongs.
Declaration
protected readonly IDocument Doc
Field Value
Type | Description |
---|---|
IDocument |
IsImportedNode
A field for whether or not the node is imported.
Declaration
protected bool IsImportedNode
Field Value
Type | Description |
---|---|
System.Boolean |
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 SourceAttributes
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. |
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. |
Document
Gets the parent document for the current node.
Declaration
public virtual IDocument Document { get; }
Property Value
Type | Description |
---|---|
IDocument | The document. |
IsElement
Gets a value indicating whether this INode is an node node.
Declaration
public abstract bool IsElement { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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 |
|
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. |
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. |
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 SourceCreateAttribute(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. |
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. |
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. |
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. |
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 |
|
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 SourceIHasDocumentSourceInfo.SourceInfo
Declaration
IDocumentSourceInfo IHasDocumentSourceInfo.SourceInfo { get; }
Returns
Type | Description |
---|---|
IDocumentSourceInfo |
IHasNodes.GetChildNodes()
Declaration
IEnumerable<INode> IHasNodes.GetChildNodes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<INode> |