Back to Contents


The TypeInfo class

Summary:

See also: Built-in classes


Basics

Purpose:

The TypeInfo class is a built-in class provided to serialize program variables.

Syntax:

base.TypeInfo

Notes:

  1. This class does not have to be instantiated.

Methods:

Class Methods
Name Description
create( variable )
  
RETURNING om.DomNode
Creates a DOM node from a program variable

Usage:

The create() method of this class builds a DomNode object from any kind of structured program variable, which is the serialization of the variable:

01 MAIN
02   DEFINE n om.DomNode
03   DEFINE r RECORD
04       key INTEGER,
05       lastname CHAR(20)
06   END RECORD
07   LET r.key = 234
08   LET r.lastname = "Johnson"
09   LET n = base.TypeInfo.create( r )
10   CALL n.writeXml( "r.xml" )
11 END MAIN

The generated node contains variable values and data type information. The above example creates the following file:

<?xml version="1.0"? encoding="ISO-8859-1">
<Record>
  <Field type="INTEGER" value="234" name="key"/>
  <Field type="CHAR(20)" value="Johnson" name="lastname"/>
</Record>