Try OpenEdge Now
skip to main content
Working with XML
Reading XML Documents with the Simple API for XML (SAX) : ABL SAX and WebSpeed : SAX and the AppBuilder : Context management example
 
Context management example
Here is a fragment that demonstrates the OpenEdge context management system. The fragment retrieves the handle to the context management table, then finds the element added most recently, as shown:
PROCEDURE getTopElement :
DEFINE OUTPUT PARAMETER cElementname AS CHARACTER NO-UNDO.

  DEFINE VARIABLE fld AS HANDLE NO-UNDO.
  DEFINE VARIABLE bh  AS HANDLE NO-UNDO.

  mhStack = DYNAMIC-FUNCTION("getStackHandle").

IF VALID-HANDLE(mhStack) THEN DO:
    bh = mhStack:DEFAULT-BUFFER-HANDLE.
bh:FIND-LAST( ) NO-ERROR.
fld = bh:BUFFER-FIELD("cQName") NO-ERROR.
cElementname = fld:BUFFER-VALUE NO-ERROR.
END.
END PROCEDURE.