Table of Contents

Struct DomNodeId

Namespace
DocWright.Dom
Assembly
DocWright.Dom.dll

The identity of a DomNode within the WordDocument instance it belongs to.

public readonly struct DomNodeId : IEquatable<DomNodeId>
Implements
Inherited Members

Remarks

An id is assigned the first time NodeId is read, from a counter the document keeps, so ids come out in the order they are first asked for and the same reads give the same ids. A node keeps its id when other nodes are inserted or removed and when it is moved within its document. Clone() gives a copy with no id of its own yet, so it never shares one with the original.

Ids live in memory only: they are never written to a file and do not survive a save and a load. A node moved into another document is given a new id there.

An id means something only to the document that gave it. Each document counts from one, so the same reads of a document always give the same numbers; the cost is that two documents, a document and its Clone() included, can give the same number to different nodes. Look an id up in the document it came from.

Properties

IsNone

Gets whether this is None.

None

Gets the id of no node: what a node not attached to a document has.

Value

Gets the id as a number: positive for a node, zero for None. Layout carries this number, since the layout model cannot reference the DOM.

Methods

Equals(DomNodeId)
Equals(object?)
FromValue(long)

Gets the id with the given Value, for a number that came back from layout. Whether a node has it is FindNode(DomNodeId)'s to say.

GetHashCode()
ToString()

Returns the id as text, for example n12, or none. Stable for the life of the document instance.

Operators

operator ==(DomNodeId, DomNodeId)

Returns whether two ids are equal.

operator !=(DomNodeId, DomNodeId)

Returns whether two ids differ.