Para gerar um XML no Progress 4gl, eh facil e funciona muito bem.
Veja o exemplo abaixo…

DEFINE VARIABLE c-msg-xml  AS MEMPTR  NO-UNDO.
DEFINE VARIABLE hSAXWriter AS HANDLE  NO-UNDO.
DEFINE VARIABLE lok        AS LOGICAL NO-UNDO.

CREATE SAX-WRITER hSAXWriter.
hSAXWriter:STRICT    = FALSE.
hSAXWriter:FORMATTED = TRUE.

lok = hSAXWriter:SET-OUTPUT-DESTINATION(“MEMPTR”, c-msg-xml).
lok = hSAXWriter:START-DOCUMENT().
lok = hSAXWriter:START-ELEMENT(“pessoas”).

FOR EACH pessoas
NO-LOCK:

lok = hSAXWriter:START-ELEMENT(“pessoa”).
lok = hSAXWriter:WRITE-DATA-ELEMENT(“codigo” , pessoas.codigo).
lok = hSAXWriter:WRITE-DATA-ELEMENT(“nome” , pessoas.nome).
lok = hSAXWriter:WRITE-DATA-ELEMENT(“departamento” , pessoas.dpto).
lok = hSAXWriter:WRITE-DATA-ELEMENT(“salario” , pessoas.salario).
lok = hSAXWriter:END-ELEMENT(“pessoa”).

END.

lok = hSAXWriter:END-ELEMENT(“pessoas”).
lok = hSAXWriter:END-DOCUMENT().

DELETE OBJECT hSAXWriter.

OUTPUT TO pessoas.xml.

EXPORT c-msg-xml.

OUTPUT CLOSE.

😀