Summary:
See also: Classes and Objects
The TypeInfo class is a built-in class provided to serialize program variables.
base.TypeInfo
Class Methods | |
Name | Description |
create( variable ) |
Creates a DOM node from a program variable |
base.TypeInfo.create()
method, write the
resulting DomNode
to
a file using the node.writeXml()
method, and give the resulting file to any
application that is able to read XML for input.
The create()
method of this class builds a DomNode
object from any kind of structured program variable, thus serializing the variable:
01
MAIN02
DEFINE n om.DomNode03
DEFINE r RECORD04
key INTEGER,05
lastname CHAR(20),06
birthdate DATE07
END RECORD08
LET r.key = 23409
LET r.lastname = "Johnson"10
LET r.birthdate = MDY(12,24,1962)11
LET n = base.TypeInfo.create( r )12
CALL n.writeXml( "r.xml" )13
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"/> <Field type="DATE" value="12/24/1962" name="birthdate"/> </Record>
Note that data is formatted according to current environment settings (DBDATE, DBFORMAT, DBMONEY).