TROXMLStreamer

Overview

The TROXMLStreamer is a simple class that allows you to serialize and deserialize objects into and from XML.

The TROXMLStreamer is used indirectly by the TDAStreamableComponent for reading and writing XML files.

We recommend to use the following wrapper functions instead of directly using the TROXMLStreamer:

  • SaveObjectToXMLNode
  • SaveObjectToStream
  • LoadObjectFromStream

Location

 

constructor Create  override

Creates a new instance.

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: owner component

Deserialize

Reads aDestination from the aStream.

procedure Deserialize(aStream: TStream; aDestination: TObject)

Parameters:

  • aStream: stream
  • aDestination: destination object

DeserializeObject  protected

Reads anObject from the anObjectNode.

procedure DeserializeObject(const anObjectNode: IXMLNode; anObject: TObject; IsRoot: Boolean)

Parameters:

  • anObjectNode: node
  • anObject: destination object
  • IsRoot:

PropertiesToIgnore

Specifies which properties should be ignored.

property PropertiesToIgnore: TStrings read write

Serialize (TObject, TStream)  overload

Writes aSource to the aStream.

procedure Serialize(const aSource: TObject; aStream: TStream)

Parameters:

  • aSource: source object
  • aStream: stream

Serialize (TObject, IXMLNode, Boolean)  overload

Writes aSource to the anObjectNode.

procedure Serialize(const aSource: TObject; const anObjectNode: IXMLNode; IsRoot: Boolean)

Parameters:

  • aSource: source object
  • anObjectNode: node
  • IsRoot:

SerializeObject  protected

Writes anObject to the anObjectNode.

procedure SerializeObject(const anObjectNode: IXMLNode; anObject: TObject; IsRoot: Boolean)

Parameters:

  • anObjectNode: node
  • anObject: source object
  • IsRoot:

SerializeSimpleType  protected

Writes anObject to the TargetNode. This method is used for writing standard simple types like integer, string, boolean, etc. to the IXMLNode.

procedure SerializeSimpleType(const aTargetNode: IXMLNode; anObject: TObject; aPropertyInfo: PPropInfo)

Parameters:

  • aTargetNode: target node
  • anObject: source object
  • aPropertyInfo:

StreamerOptions

Streamer options. At the moment, only soIncludeType can be used here.

type
  TROXMLStreamerOption = (soIncludeType);
  TROXMLStreamerOptions = set of TROXMLStreamerOption;
property StreamerOptions: TROXMLStreamerOptions read write

 

PropertiesToIgnore

Specifies which properties should be ignored.

property PropertiesToIgnore: TStrings read write

StreamerOptions

Streamer options. At the moment, only soIncludeType can be used here.

type
  TROXMLStreamerOption = (soIncludeType);
  TROXMLStreamerOptions = set of TROXMLStreamerOption;
property StreamerOptions: TROXMLStreamerOptions read write

 

constructor Create  override

Creates a new instance.

constructor Create(aOwner: TComponent)

Parameters:

  • aOwner: owner component

Deserialize

Reads aDestination from the aStream.

procedure Deserialize(aStream: TStream; aDestination: TObject)

Parameters:

  • aStream: stream
  • aDestination: destination object

DeserializeObject  protected

Reads anObject from the anObjectNode.

procedure DeserializeObject(const anObjectNode: IXMLNode; anObject: TObject; IsRoot: Boolean)

Parameters:

  • anObjectNode: node
  • anObject: destination object
  • IsRoot:

Serialize (TObject, TStream)  overload

Writes aSource to the aStream.

procedure Serialize(const aSource: TObject; aStream: TStream)

Parameters:

  • aSource: source object
  • aStream: stream

Serialize (TObject, IXMLNode, Boolean)  overload

Writes aSource to the anObjectNode.

procedure Serialize(const aSource: TObject; const anObjectNode: IXMLNode; IsRoot: Boolean)

Parameters:

  • aSource: source object
  • anObjectNode: node
  • IsRoot:

SerializeObject  protected

Writes anObject to the anObjectNode.

procedure SerializeObject(const anObjectNode: IXMLNode; anObject: TObject; IsRoot: Boolean)

Parameters:

  • anObjectNode: node
  • anObject: source object
  • IsRoot:

SerializeSimpleType  protected

Writes anObject to the TargetNode. This method is used for writing standard simple types like integer, string, boolean, etc. to the IXMLNode.

procedure SerializeSimpleType(const aTargetNode: IXMLNode; anObject: TObject; aPropertyInfo: PPropInfo)

Parameters:

  • aTargetNode: target node
  • anObject: source object
  • aPropertyInfo: