XmlSerializer
extends BaseSerializer
in package
Transform data models to XML.
Tags
Table of Contents
Properties
- $normalizerFactory : NormalizerFactory
- $xmlEncoding : string
- $xmlVersion : string
Methods
- __construct() : mixed
- serialize() : string
- Serialize a {@see Bom} to string.
- realNormalize() : TNormalizedBom
- Normalize a {@see Bom} to the data structure that {@see realSerialize()} can handle.
- realSerialize() : string
- Serialize a {@see realNormalize() normalized} version of a {@see Bom}.
- getAllBomRefs() : array<string|int, BomRef>
- Get a list of all {@see BomRef} in {@see Bom}.
- normalize() : TNormalizedBom
- Normalize for serialization.
Properties
$normalizerFactory read-only
protected
NormalizerFactory
$normalizerFactory
$xmlEncoding read-only
protected
string
$xmlEncoding
= 'UTF-8'
$xmlVersion read-only
protected
string
$xmlVersion
= '1.0'
Methods
__construct()
public
__construct(NormalizerFactory $normalizerFactory[, string $xmlVersion = '1.0' ][, string $xmlEncoding = 'UTF-8' ]) : mixed
Parameters
- $normalizerFactory : NormalizerFactory
- $xmlVersion : string = '1.0'
- $xmlEncoding : string = 'UTF-8'
serialize()
Serialize a {@see Bom} to string.
public
final serialize(Bom $bom[, bool|null $prettyPrint = null ]) : string
Parameters
- $bom : Bom
-
the BOM to serialize
- $prettyPrint : bool|null = null
-
whether to beatify the resulting string. A
null
value means no preference.
Return values
stringrealNormalize()
Normalize a {@see Bom} to the data structure that {@see realSerialize()} can handle.
protected
realNormalize(Bom $bom) : TNormalizedBom
Parameters
- $bom : Bom
Return values
TNormalizedBom —a version of the Bom that was normalized for serialization
realSerialize()
Serialize a {@see realNormalize() normalized} version of a {@see Bom}.
protected
realSerialize(mixed $normalizedBom, bool|null $prettyPrint) : string
Parameters
- $normalizedBom : mixed
-
a version of the Bom that was normalized for serialization
- $prettyPrint : bool|null
Return values
stringgetAllBomRefs()
Get a list of all {@see BomRef} in {@see Bom}.
private
getAllBomRefs(Bom $bom) : array<string|int, BomRef>
The list might contain duplicates.
Parameters
- $bom : Bom
Tags
Return values
array<string|int, BomRef>normalize()
Normalize for serialization.
private
normalize(Bom $bom) : TNormalizedBom
Also utilizes BomRefDiscriminator to guarantee that each BomRef has a unique value.
Parameters
- $bom : Bom
Tags
Return values
TNormalizedBom —a version of the Bom that was normalized for serialization