Table of Contents

Method ReplacePlaceholders

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

ReplacePlaceholders(DomNode, IReadOnlyDictionary<string, object?>, PlaceholderOptions?)

Substitutes every placeholder whose name the values supply.

public static PlaceholderResult ReplacePlaceholders(this DomNode root, IReadOnlyDictionary<string, object?> values, PlaceholderOptions? options = null)

Parameters

root DomNode

The document or subtree to fill.

values IReadOnlyDictionary<string, object>

The values, keyed by placeholder name. A key present with a null value substitutes as empty; a key that is absent is unresolved.

options PlaceholderOptions

The options, or null for the defaults.

Returns

PlaceholderResult

What the substitution did.

Exceptions

ArgumentNullException

root or values is null.

ArgumentException

Prefix or Suffix is empty.

InvalidDocumentException

A placeholder had no value and Unresolved is Throw (DXP1004).

RegexMatchTimeoutException

A match attempt exceeded the one-second default timeout.