Create a simple DOM and having it serialize to:

 <?xml version="1.0" ?>
 <root>
     <element>
         Some text here
     </element>
 </root>

 
DEFINE VARIABLE hxdoc      AS HANDLE NO-UNDO.
DEFINE VARIABLE hxroot     AS HANDLE NO-UNDO.
DEFINE VARIABLE hxelement  AS HANDLE NO-UNDO.
DEFINE VARIABLE hxtext     AS HANDLE NO-UNDO.
DEFINE VARIABLE lcc        AS LONGCHAR NO-UNDO.
 
CREATE X-DOCUMENT hxdoc.
 
CREATE X-NODEREF hxroot.
hxdoc:CREATE-NODE( hxroot, 'root', 'ELEMENT' ).
hxdoc:APPEND-CHILD( hxroot ).
 
CREATE X-NODEREF hxelement.
hxdoc:CREATE-NODE( hxelement, 'element', 'ELEMENT' ).
hxroot:APPEND-CHILD( hxelement ).
 
CREATE X-NODEREF hxtext.
hxdoc:CREATE-NODE( hxtext, 'element', 'TEXT' ).
hxelement:APPEND-CHILD( hxtext ).
hxtext:NODE-VALUE = 'Some text here'.
 
hxdoc:SAVE( 'LONGCHAR', lcc ).
MESSAGE STRING( lcc ) VIEW-AS ALERT-BOX.
 