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
Type: TSerializer
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):
Delphi | Copy Code |
---|---|
szr.RootValue['MyValue'].Value(7); |
Since, RootValue is a default indexed property, its property name can be suppressed to make code more readable:
Delphi | Copy Code |
---|---|
szr['MyValue'].Value(7); |