Progress
Version 9
Product Update Bulletin


NODE-VALUE-TO-MEMPTR() Method

Copies the contents of an XML X-NODEREF node to a MEMPTR. This makes it easier to manipulate when its length exceeds the Progress text string limit, which is approximately 32K.

Return Type: LOGICAL

Applies To: X-NODEREF Object Handle

SYNTAX

NODE-VALUE-TO-MEMPTR( memptr ) 

memptr

An expression of type MEMPTR.

NODE-VALUE-TO-MEMPTR() frees the memory currently allocated by memptr (if any), allocates sufficient memory to the MEMPTR to accommodate the node, and copies the node to the MEMPTR.

If X-NODEREF:NODE-VALUE is "" (the empty string), the resulting memptr has a size of zero.

NOTE: When you no longer need the memory used by memptr, you must free it yourself. To do so, use the SET-SIZE statement.

The following fragment uses NODE-VALUE-TO-MEMPTR() to access a large text node:

IF my-xnoderef:SUBTYPE = "#TEXT" THEN DO:
  IF my-xnoderef:LENGTH > 32000 THEN DO:
    success = my-xnoderef:NODE-VALUE-TO-MEMPTR(my-memptr).
    pos = 1. 
    len = 32000.
    DO WHILE pos < GET-SIZE(my-memptr):
      my-nodeval = GET-STRING(my-memptr, pos, len). 
      /* do something with my-nodeval */
      pos = pos + len. 
    END. 
    SET-SIZE(my-memptr) = 0.
  END. 
  ELSE
    my-nodeval = my-xnoderef:NODE-VALUE.
END. 

For more information on accessing XML documents using the Document Object Model (DOM) interface, see the Progress External Program Interfaces book.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095