Method SetValue
SetValue(RdlElement, string, string?)
Sets a simple child element's text, creating it in the position the schema declares, updating it where it already exists, and removing it when the value is null.
public RdlElement? SetValue(RdlElement parent, string localName, string? value)
Parameters
parentRdlElementThe element to set the child on.
localNamestringThe child's local name.
valuestringThe text, or null to remove the child.
Returns
- RdlElement
The element that now holds the value, or null when it was removed.
Remarks
Position is not cosmetic for every type, and a caller cannot tell which. Of the 253 types the schema describes, 66 constrain child order and 187 do not. Appending would therefore be correct most of the time — the failure mode that produces a file that works until it does not. The schema's own declaration order is followed in both cases, which also keeps a saved file reading the way Report Builder writes one.
Where the schema has nothing to say — a type it does not describe, or a child it does not declare — the element is appended, because there is no better answer and guessing one would be worse.
A new element is created in the report's own namespace rather than the schema version's, so a definition in an unrecognized namespace stays internally consistent.
Exceptions
- ArgumentNullException
parentorlocalNameis null.