Summary

Allows to specify XML element name for subsequently serializing root-level value.

Syntax

property RootValue[const AName: string]: TSerializer read GetRootValue; default;

Parameters

AName

Type: string

XML element name for subsequently serializing root-level value.

Property Value

RootValue property always returns a reference to the same serializer object.

Remarks

Every element in XML document should have a name (sometimes called "tag"). Since core serializer API does not support root-level values naming, additional API has been provided: RootValue property should be used before actual writing of any root-level value (otherwise, invalid state exception will be thrown):

DelphiCopyCode imageCopy Code
szr.RootValue['MyValue'].Value(7);

Since, RootValue is a default indexed property, its property name can be suppressed to make code more readable:

DelphiCopyCode imageCopy Code
szr['MyValue'].Value(7);