Consultor Eletrônico



Kbase P24217: How to save an XML document to a character variable or field
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/16/2009
Status: Unverified

GOAL:

How to save an XML document to a character variable or field

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

Save the document to a MEMPTR variable, then use the GET-STRING() function to store it in a CHARACTER or LONGCHAR variable or field as per the following code:
DEFINE VARIABLE memDoc AS MEMPTR.

... build your XML document ...

hXML:SAVE("MEMPTR":U, memDoc).
myCharVar = GET-STRING(memDoc, 1).
SET-SIZE(memDoc) = 0.
The SAVE method automatically resizes the area pointed to by the the MEMPTR variable to the amount of memory needed for the XML document, but then you must free it manually.