Kbase P27267: How can I dump data from a Progress in XML Format?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/28/2006 |
|
Status: Verified
SYMPTOM(s):
Is there a Progress tool can I use to dump data from a Progress in XML Format?
OpenEdge 10.1x
FIX:
The following code shows how to use the new WRITE-XML method that was introduced in OpenEdge 10.1A. This code has an internal procedure which accepts a database table name (fully qualified, if needed) and dumps the entire contents of the table out to an XML file.
run dumptempTableAsXML (input 'sports2000.customer').
procedure dumpTempTableAsXML:
define input parameter cFullyQualifiedTableName as character no-undo.
define variable hSourceBuffer as handle no-undo.
define variable hTargetTable as handle no-undo.
define variable hTargetBuffer as handle no-undo.
define variable hQuery as handle no-undo.
create buffer hSourceBuffer for table cFullyQualifiedTableName buffer-name 'Source'.
create temp-table hTargetTable.
hTargetTable:create-like(hSourceBuffer).
hTargetTable:temp-table-prepare("Target").
assign hTargetBuffer = hTargetTable:default-buffer-handle.
create query hQuery.
hQuery:set-buffers(hSourceBuffer).
hQuery:query-prepare('for each Source no-lock').
hQuery:query-open().
hQuery:get-first().
repeat while hQuery:query-off-end = false:
hTargetBuffer:buffer-create().
hTargetBuffer:buffer-copy(hSourceBuffer).
hTargetBuffer:buffer-release().
hQuery:get-next().
end.
hQuery:query-close().
hTargetTable:write-xml('file', cFullyQualifiedTableName + '.xml', ?, ?, ?, true, ?, ?).
delete object hQuery.
delete object hTargetTable.
delete object hSourceBuffer.
end procedure.