%ToXML

This special method converts an internal object to an XML string.

All special method names and keywords are case-insensitive.

Syntax

object->%ToXML()

Syntax elements

objectAn expression that evaluates to an internal object.

Applicability

Internal objects only.

Comments

Each element of the object is converted to an XML element of the same name. The type of each element is identified by a type attribute which can have one of the following single-letter values:

Bboolean

Iinteger

Sstring

Ffloat

Oobject

Nnull

Examples

Given:

Dylan = %New()
Dylan->firstNname = "Bob"
Dylan->lastName = "Dylan"
Dylan->dateOfBirth = 1941

Converts the Dylan object to an XML string.

PRINT Dylan->%ToXML()

which produces:

<root>
 <firstName type="S">Bob</firstName>
 <lastName type="S">Dylan</lastName>
 <dateOfBirth type="I">1941</dateOfBirth>
<root>

See also

%New, %ToJSON, %ToMV