Class XmlLimits

Namespace: redb.Route.Core
Assembly: redb.Route.dll

Structure limits for XML read through : how deep, how wide and how large a document may be.
The reader checks them while it reads, so a document over a limit is refused before it is built, and whatever
comes after the read (canonicalization, signature checks, XPath, XSLT, a deserializer) only ever sees a bounded
document, whatever version of the XML libraries the application runs on.

A null limit is not checked. bounds the structure only, generously enough that no ordinary
document meets it; a receiver that knows the shape of what it reads (an AS4 envelope) sets tighter ones.

public sealed record XmlLimits : IEquatable<XmlLimits>

Inheritance

Object→XmlLimits

Implements

Properties

Default

The limits every loader applies when the caller names none: depth, attributes and

public static XmlLimits Default { get; }

MaxAttributesPerElement

Attributes on one element, namespace declarations included. Default .

public int? MaxAttributesPerElement { get; init; }

MaxCharacters

Characters in the whole document, after entity references are resolved ().

public long? MaxCharacters { get; init; }

MaxDepth

Nesting depth of elements, the root counting as 1. Deep nesting is what recursive processing of a document

public int? MaxDepth { get; init; }

MaxElements

Elements in the whole document. Default: not bounded.

public long? MaxElements { get; init; }

MaxNamespaceDeclarations

Namespace declarations in the whole document. Default: not bounded.

public long? MaxNamespaceDeclarations { get; init; }

MaxNamespaceDeclarationsPerElement

Namespace declarations (xmlns, xmlns:p) on one element: canonicalization works through the

public int? MaxNamespaceDeclarationsPerElement { get; init; }

Methods

Validate()

Throws when a limit is set to zero or less: such a limit would refuse every document.

public void Validate()