TOXML

TOXML( record )

recordThe row (record) of data to convert to an XML format.
Return:TOXML returns a UTF8.

The TOXML function returns a single UTF-8 string with the data in the record re-formatted as XML. If the RECORD structure of the record has XPATHs defined, then they will be used, otherwise the lower-cased field names are used as the XML tag names.

Example:

namesRec1 := RECORD
  UNSIGNED2 EmployeeID{xpath('EmpID')};
  STRING10  Firstname{xpath('FName')};
  STRING10  Lastname{xpath('LName')};
END;
rec1 := TOXML(ROW({42,'Fred','Flintstone'},namesRec1));
OUTPUT(rec1);

//returns this string:
//'<EmpID>42</EmpID><FName>Fred</FName><LName>Flintstone</LName>'

namesRec2 := RECORD
  UNSIGNED2 EmployeeID;
  STRING10  Firstname;
  STRING10  Lastname;
END;
rec2 := TOXML(ROW({42,'Fred','Flintstone'},namesRec2));
OUTPUT(rec2);
//returns this string:
//'<employeeid>42</employeeid><firstname>Fred</firstname><lastname>Flintstone</lastname>'

See Also: ROW, FROMXML